Release 4.94
[exim-website.git] / docbook / 4.94 / 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 01 Jun 2020
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.94</revnumber>
22 <date>01 Jun 2020</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 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</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-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>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>
5787 <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>
5788 <listitem>
5789 <para>
5790 <indexterm role="option">
5791 <primary><option>-MCt</option></primary>
5792 </indexterm>
5793 This option is not intended for use by external callers. It is used internally
5794 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5795 connection is being proxied by a parent process for handling TLS encryption.
5796 The arguments give the local address and port being proxied, and the TLS cipher.
5797 </para>
5798 </listitem></varlistentry>
5799 <varlistentry>
5800 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5801 <listitem>
5802 <para>
5803 <indexterm role="option">
5804 <primary><option>-Mc</option></primary>
5805 </indexterm>
5806 <indexterm role="concept">
5807 <primary>hints database</primary>
5808 <secondary>not overridden by <option>-Mc</option></secondary>
5809 </indexterm>
5810 <indexterm role="concept">
5811 <primary>delivery</primary>
5812 <secondary>manually started &ndash; not forced</secondary>
5813 </indexterm>
5814 This option requests Exim to run a delivery attempt on each message, in turn,
5815 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5816 that are found. This option is not very useful to external callers. It is
5817 provided mainly for internal use by Exim when it needs to re-invoke itself in
5818 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5819 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5820 respects retry times and other options such as <option>hold_domains</option> that are
5821 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5822 If you want to run a specific delivery as if in a queue run, you should use
5823 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5824 and other deliveries is made in one or two places.
5825 </para>
5826 </listitem></varlistentry>
5827 <varlistentry>
5828 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5829 <listitem>
5830 <para>
5831 <indexterm role="option">
5832 <primary><option>-Mes</option></primary>
5833 </indexterm>
5834 <indexterm role="concept">
5835 <primary>message</primary>
5836 <secondary>changing sender</secondary>
5837 </indexterm>
5838 <indexterm role="concept">
5839 <primary>sender</primary>
5840 <secondary>changing</secondary>
5841 </indexterm>
5842 This option requests Exim to change the sender address in the message to the
5843 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5844 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5845 be a message id, and the second one an email address. However, if the message
5846 is active (in the middle of a delivery attempt), its status is not altered.
5847 This option can be used only by an admin user.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-Mf</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>freezing messages</primary>
5859 </indexterm>
5860 <indexterm role="concept">
5861 <primary>message</primary>
5862 <secondary>manually freezing</secondary>
5863 </indexterm>
5864 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5865 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5866 either manually or as a result of the <option>auto_thaw</option> configuration option.
5867 However, if any of the messages are active (in the middle of a delivery
5868 attempt), their status is not altered. This option can be used only by an admin
5869 user.
5870 </para>
5871 </listitem></varlistentry>
5872 <varlistentry>
5873 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5874 <listitem>
5875 <para>
5876 <indexterm role="option">
5877 <primary><option>-Mg</option></primary>
5878 </indexterm>
5879 <indexterm role="concept">
5880 <primary>giving up on messages</primary>
5881 </indexterm>
5882 <indexterm role="concept">
5883 <primary>message</primary>
5884 <secondary>abandoning delivery attempts</secondary>
5885 </indexterm>
5886 <indexterm role="concept">
5887 <primary>delivery</primary>
5888 <secondary>abandoning further attempts</secondary>
5889 </indexterm>
5890 This option requests Exim to give up trying to deliver the listed messages,
5891 including any that are frozen. However, if any of the messages are active,
5892 their status is not altered. For non-bounce messages, a delivery error message
5893 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5894 Bounce messages are just discarded. This option can be used only by an admin
5895 user.
5896 </para>
5897 </listitem></varlistentry>
5898 <varlistentry>
5899 <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>
5900 <listitem>
5901 <para>
5902 <indexterm role="option">
5903 <primary><option>-MG</option></primary>
5904 </indexterm>
5905 <indexterm role="concept">
5906 <primary>queue</primary>
5907 <secondary>named</secondary>
5908 </indexterm>
5909 <indexterm role="concept">
5910 <primary>named queues</primary>
5911 <secondary>moving messages</secondary>
5912 </indexterm>
5913 <indexterm role="concept">
5914 <primary>queue</primary>
5915 <secondary>moving messages</secondary>
5916 </indexterm>
5917 This option requests that each listed message be moved from its current
5918 queue to the given named queue.
5919 The destination queue name argument is required, but can be an empty
5920 string to define the default queue.
5921 If the messages are not currently located in the default queue,
5922 a <option>-qG&lt;name&gt;</option> option will be required to define the source queue.
5923 </para>
5924 </listitem></varlistentry>
5925 <varlistentry>
5926 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5927 <listitem>
5928 <para>
5929 <indexterm role="option">
5930 <primary><option>-Mmad</option></primary>
5931 </indexterm>
5932 <indexterm role="concept">
5933 <primary>delivery</primary>
5934 <secondary>cancelling all</secondary>
5935 </indexterm>
5936 This option requests Exim to mark all the recipient addresses in the messages
5937 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5938 message is active (in the middle of a delivery attempt), its status is not
5939 altered. This option can be used only by an admin user.
5940 </para>
5941 </listitem></varlistentry>
5942 <varlistentry>
5943 <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>
5944 <listitem>
5945 <para>
5946 <indexterm role="option">
5947 <primary><option>-Mmd</option></primary>
5948 </indexterm>
5949 <indexterm role="concept">
5950 <primary>delivery</primary>
5951 <secondary>cancelling by address</secondary>
5952 </indexterm>
5953 <indexterm role="concept">
5954 <primary>recipient</primary>
5955 <secondary>removing</secondary>
5956 </indexterm>
5957 <indexterm role="concept">
5958 <primary>removing recipients</primary>
5959 </indexterm>
5960 This option requests Exim to mark the given addresses as already delivered
5961 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5962 the remaining ones must be email addresses. These are matched to recipient
5963 addresses in the message in a case-sensitive manner. If the message is active
5964 (in the middle of a delivery attempt), its status is not altered. This option
5965 can be used only by an admin user.
5966 </para>
5967 </listitem></varlistentry>
5968 <varlistentry>
5969 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5970 <listitem>
5971 <para>
5972 <indexterm role="option">
5973 <primary><option>-Mrm</option></primary>
5974 </indexterm>
5975 <indexterm role="concept">
5976 <primary>removing messages</primary>
5977 </indexterm>
5978 <indexterm role="concept">
5979 <primary>abandoning mail</primary>
5980 </indexterm>
5981 <indexterm role="concept">
5982 <primary>message</primary>
5983 <secondary>manually discarding</secondary>
5984 </indexterm>
5985 This option requests Exim to remove the given messages from the queue. No
5986 bounce messages are sent; each message is simply forgotten. However, if any of
5987 the messages are active, their status is not altered. This option can be used
5988 only by an admin user or by the user who originally caused the message to be
5989 placed in the queue.
5990 </para>
5991 </listitem></varlistentry>
5992 <varlistentry>
5993 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5994 <listitem>
5995 <para>
5996 <indexterm role="option">
5997 <primary><option>-Mset</option></primary>
5998 </indexterm>
5999 <indexterm role="concept">
6000 <primary>testing</primary>
6001 <secondary>string expansion</secondary>
6002 </indexterm>
6003 <indexterm role="concept">
6004 <primary>expansion</primary>
6005 <secondary>testing</secondary>
6006 </indexterm>
6007 This option is useful only in conjunction with <option>-be</option> (that is, when testing
6008 string expansions). Exim loads the given message from its spool before doing
6009 the test expansions, thus setting message-specific variables such as
6010 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
6011 available. This feature is provided to make it easier to test expansions that
6012 make use of these variables. However, this option can be used only by an admin
6013 user. See also <option>-bem</option>.
6014 </para>
6015 </listitem></varlistentry>
6016 <varlistentry>
6017 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6018 <listitem>
6019 <para>
6020 <indexterm role="option">
6021 <primary><option>-Mt</option></primary>
6022 </indexterm>
6023 <indexterm role="concept">
6024 <primary>thawing messages</primary>
6025 </indexterm>
6026 <indexterm role="concept">
6027 <primary>unfreezing messages</primary>
6028 </indexterm>
6029 <indexterm role="concept">
6030 <primary>frozen messages</primary>
6031 <secondary>thawing</secondary>
6032 </indexterm>
6033 <indexterm role="concept">
6034 <primary>message</primary>
6035 <secondary>thawing frozen</secondary>
6036 </indexterm>
6037 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
6038 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
6039 messages are active, their status is not altered. This option can be used only
6040 by an admin user.
6041 </para>
6042 </listitem></varlistentry>
6043 <varlistentry>
6044 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6045 <listitem>
6046 <para>
6047 <indexterm role="option">
6048 <primary><option>-Mvb</option></primary>
6049 </indexterm>
6050 <indexterm role="concept">
6051 <primary>listing</primary>
6052 <secondary>message body</secondary>
6053 </indexterm>
6054 <indexterm role="concept">
6055 <primary>message</primary>
6056 <secondary>listing body of</secondary>
6057 </indexterm>
6058 This option causes the contents of the message body (-D) spool file to be
6059 written to the standard output. This option can be used only by an admin user.
6060 </para>
6061 </listitem></varlistentry>
6062 <varlistentry>
6063 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6064 <listitem>
6065 <para>
6066 <indexterm role="option">
6067 <primary><option>-Mvc</option></primary>
6068 </indexterm>
6069 <indexterm role="concept">
6070 <primary>message</primary>
6071 <secondary>listing in RFC 2822 format</secondary>
6072 </indexterm>
6073 <indexterm role="concept">
6074 <primary>listing</primary>
6075 <secondary>message in RFC 2822 format</secondary>
6076 </indexterm>
6077 This option causes a copy of the complete message (header lines plus body) to
6078 be written to the standard output in RFC 2822 format. This option can be used
6079 only by an admin user.
6080 </para>
6081 </listitem></varlistentry>
6082 <varlistentry>
6083 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6084 <listitem>
6085 <para>
6086 <indexterm role="option">
6087 <primary><option>-Mvh</option></primary>
6088 </indexterm>
6089 <indexterm role="concept">
6090 <primary>listing</primary>
6091 <secondary>message headers</secondary>
6092 </indexterm>
6093 <indexterm role="concept">
6094 <primary>header lines</primary>
6095 <secondary>listing</secondary>
6096 </indexterm>
6097 <indexterm role="concept">
6098 <primary>message</primary>
6099 <secondary>listing header lines</secondary>
6100 </indexterm>
6101 This option causes the contents of the message headers (-H) spool file to be
6102 written to the standard output. This option can be used only by an admin user.
6103 </para>
6104 </listitem></varlistentry>
6105 <varlistentry>
6106 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6107 <listitem>
6108 <para>
6109 <indexterm role="option">
6110 <primary><option>-Mvl</option></primary>
6111 </indexterm>
6112 <indexterm role="concept">
6113 <primary>listing</primary>
6114 <secondary>message log</secondary>
6115 </indexterm>
6116 <indexterm role="concept">
6117 <primary>message</primary>
6118 <secondary>listing message log</secondary>
6119 </indexterm>
6120 This option causes the contents of the message log spool file to be written to
6121 the standard output. This option can be used only by an admin user.
6122 </para>
6123 </listitem></varlistentry>
6124 <varlistentry>
6125 <term><option>-m</option></term>
6126 <listitem>
6127 <para>
6128 <indexterm role="option">
6129 <primary><option>-m</option></primary>
6130 </indexterm>
6131 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
6132 treats it that way too.
6133 </para>
6134 </listitem></varlistentry>
6135 <varlistentry>
6136 <term><option>-N</option></term>
6137 <listitem>
6138 <para>
6139 <indexterm role="option">
6140 <primary><option>-N</option></primary>
6141 </indexterm>
6142 <indexterm role="concept">
6143 <primary>debugging</primary>
6144 <secondary><option>-N</option> option</secondary>
6145 </indexterm>
6146 <indexterm role="concept">
6147 <primary>debugging</primary>
6148 <secondary>suppressing delivery</secondary>
6149 </indexterm>
6150 This is a debugging option that inhibits delivery of a message at the transport
6151 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6152 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6153 had successfully done so. However, it does not make any updates to the retry
6154 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6155 than <quote>=&gt;</quote>.
6156 </para>
6157 <para>
6158 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6159 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6160 words, an ordinary user can use it only when supplying an incoming message to
6161 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6162 address may be deferred because of a configuration problem on a transport, or a
6163 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6164 the message, and applies to any subsequent delivery attempts that may happen
6165 for that message.
6166 </para>
6167 </listitem></varlistentry>
6168 <varlistentry>
6169 <term><option>-n</option></term>
6170 <listitem>
6171 <para>
6172 <indexterm role="option">
6173 <primary><option>-n</option></primary>
6174 </indexterm>
6175 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6176 For normal modes of operation, it is ignored by Exim.
6177 When combined with <option>-bP</option> it makes the output more terse (suppresses
6178 option names, environment values and config pretty printing).
6179 </para>
6180 </listitem></varlistentry>
6181 <varlistentry>
6182 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6183 <listitem>
6184 <para>
6185 <indexterm role="option">
6186 <primary><option>-O</option></primary>
6187 </indexterm>
6188 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6189 Exim.
6190 </para>
6191 </listitem></varlistentry>
6192 <varlistentry>
6193 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6194 <listitem>
6195 <para>
6196 <indexterm role="option">
6197 <primary><option>-oA</option></primary>
6198 </indexterm>
6199 <indexterm role="concept">
6200 <primary>Sendmail compatibility</primary>
6201 <secondary><option>-oA</option> option</secondary>
6202 </indexterm>
6203 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6204 alternative alias filename. Exim handles <option>-bi</option> differently; see the
6205 description above.
6206 </para>
6207 </listitem></varlistentry>
6208 <varlistentry>
6209 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6210 <listitem>
6211 <para>
6212 <indexterm role="option">
6213 <primary><option>-oB</option></primary>
6214 </indexterm>
6215 <indexterm role="concept">
6216 <primary>SMTP</primary>
6217 <secondary>passed connection</secondary>
6218 </indexterm>
6219 <indexterm role="concept">
6220 <primary>SMTP</primary>
6221 <secondary>multiple deliveries</secondary>
6222 </indexterm>
6223 <indexterm role="concept">
6224 <primary>multiple SMTP deliveries</primary>
6225 </indexterm>
6226 This is a debugging option which limits the maximum number of messages that can
6227 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6228 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6229 </para>
6230 </listitem></varlistentry>
6231 <varlistentry>
6232 <term><option>-odb</option></term>
6233 <listitem>
6234 <para>
6235 <indexterm role="option">
6236 <primary><option>-odb</option></primary>
6237 </indexterm>
6238 <indexterm role="concept">
6239 <primary>background delivery</primary>
6240 </indexterm>
6241 <indexterm role="concept">
6242 <primary>delivery</primary>
6243 <secondary>in the background</secondary>
6244 </indexterm>
6245 This option applies to all modes in which Exim accepts incoming messages,
6246 including the listening daemon. It requests <quote>background</quote> delivery of such
6247 messages, which means that the accepting process automatically starts a
6248 delivery process for each message received, but does not wait for the delivery
6249 processes to finish.
6250 </para>
6251 <para>
6252 When all the messages have been received, the reception process exits,
6253 leaving the delivery processes to finish in their own time. The standard output
6254 and error streams are closed at the start of each delivery process.
6255 This is the default action if none of the <option>-od</option> options are present.
6256 </para>
6257 <para>
6258 If one of the queueing options in the configuration file
6259 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6260 overrides it if <option>queue_only_override</option> is set true, which is the default
6261 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6262 </para>
6263 </listitem></varlistentry>
6264 <varlistentry>
6265 <term><option>-odf</option></term>
6266 <listitem>
6267 <para>
6268 <indexterm role="option">
6269 <primary><option>-odf</option></primary>
6270 </indexterm>
6271 <indexterm role="concept">
6272 <primary>foreground delivery</primary>
6273 </indexterm>
6274 <indexterm role="concept">
6275 <primary>delivery</primary>
6276 <secondary>in the foreground</secondary>
6277 </indexterm>
6278 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6279 accepted a locally-generated message. (For the daemon it is exactly the same as
6280 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6281 and Exim waits for it to complete before proceeding.
6282 </para>
6283 <para>
6284 The original Exim reception process does not finish until the delivery
6285 process for the final message has ended. The standard error stream is left open
6286 during deliveries.
6287 </para>
6288 <para>
6289 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6290 false and one of the queueing options in the configuration file is in effect.
6291 </para>
6292 <para>
6293 If there is a temporary delivery error during foreground delivery, the
6294 message is left in the queue for later delivery, and the original reception
6295 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6296 restricted configuration that never queues messages.
6297 </para>
6298 </listitem></varlistentry>
6299 <varlistentry>
6300 <term><option>-odi</option></term>
6301 <listitem>
6302 <para>
6303 <indexterm role="option">
6304 <primary><option>-odi</option></primary>
6305 </indexterm>
6306 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6307 Sendmail.
6308 </para>
6309 </listitem></varlistentry>
6310 <varlistentry>
6311 <term><option>-odq</option></term>
6312 <listitem>
6313 <para>
6314 <indexterm role="option">
6315 <primary><option>-odq</option></primary>
6316 </indexterm>
6317 <indexterm role="concept">
6318 <primary>non-immediate delivery</primary>
6319 </indexterm>
6320 <indexterm role="concept">
6321 <primary>delivery</primary>
6322 <secondary>suppressing immediate</secondary>
6323 </indexterm>
6324 <indexterm role="concept">
6325 <primary>queueing incoming messages</primary>
6326 </indexterm>
6327 This option applies to all modes in which Exim accepts incoming messages,
6328 including the listening daemon. It specifies that the accepting process should
6329 not automatically start a delivery process for each message received. Messages
6330 are placed in the queue, and remain there until a subsequent queue runner
6331 process encounters them. There are several configuration options (such as
6332 <option>queue_only</option>) that can be used to queue incoming messages under certain
6333 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6334 forces queueing.
6335 </para>
6336 </listitem></varlistentry>
6337 <varlistentry>
6338 <term><option>-odqs</option></term>
6339 <listitem>
6340 <para>
6341 <indexterm role="option">
6342 <primary><option>-odqs</option></primary>
6343 </indexterm>
6344 <indexterm role="concept">
6345 <primary>SMTP</primary>
6346 <secondary>delaying delivery</secondary>
6347 </indexterm>
6348 <indexterm role="concept">
6349 <primary>first pass routing</primary>
6350 </indexterm>
6351 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6352 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6353 <option>queue_only_override</option> is false and one of the queueing options in the
6354 configuration file is in effect.
6355 </para>
6356 <para>
6357 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6358 message, in the background by default, but in the foreground if <option>-odi</option> is
6359 also present. The recipient addresses are routed, and local deliveries are done
6360 in the normal way. However, if any SMTP deliveries are required, they are not
6361 done at this time, so the message remains in the queue until a subsequent queue
6362 runner process encounters it. Because routing was done, Exim knows which
6363 messages are waiting for which hosts, and so a number of messages for the same
6364 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6365 configuration option has the same effect for specific domains. See also the
6366 <option>-qq</option> option.
6367 </para>
6368 </listitem></varlistentry>
6369 <varlistentry>
6370 <term><option>-oee</option></term>
6371 <listitem>
6372 <para>
6373 <indexterm role="option">
6374 <primary><option>-oee</option></primary>
6375 </indexterm>
6376 <indexterm role="concept">
6377 <primary>error</primary>
6378 <secondary>reporting</secondary>
6379 </indexterm>
6380 If an error is detected while a non-SMTP message is being received (for
6381 example, a malformed address), the error is reported to the sender in a mail
6382 message.
6383 </para>
6384 <para>
6385 <indexterm role="concept">
6386 <primary>return code</primary>
6387 <secondary>for <option>-oee</option></secondary>
6388 </indexterm>
6389 Provided
6390 this error message is successfully sent, the Exim receiving process
6391 exits with a return code of zero. If not, the return code is 2 if the problem
6392 is that the original message has no recipients, or 1 for any other error.
6393 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6394 </para>
6395 </listitem></varlistentry>
6396 <varlistentry>
6397 <term><option>-oem</option></term>
6398 <listitem>
6399 <para>
6400 <indexterm role="option">
6401 <primary><option>-oem</option></primary>
6402 </indexterm>
6403 <indexterm role="concept">
6404 <primary>error</primary>
6405 <secondary>reporting</secondary>
6406 </indexterm>
6407 <indexterm role="concept">
6408 <primary>return code</primary>
6409 <secondary>for <option>-oem</option></secondary>
6410 </indexterm>
6411 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6412 return code, whether or not the error message was successfully sent.
6413 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6414 </para>
6415 </listitem></varlistentry>
6416 <varlistentry>
6417 <term><option>-oep</option></term>
6418 <listitem>
6419 <para>
6420 <indexterm role="option">
6421 <primary><option>-oep</option></primary>
6422 </indexterm>
6423 <indexterm role="concept">
6424 <primary>error</primary>
6425 <secondary>reporting</secondary>
6426 </indexterm>
6427 If an error is detected while a non-SMTP message is being received, the
6428 error is reported by writing a message to the standard error file (stderr).
6429 <indexterm role="concept">
6430 <primary>return code</primary>
6431 <secondary>for <option>-oep</option></secondary>
6432 </indexterm>
6433 The return code is 1 for all errors.
6434 </para>
6435 </listitem></varlistentry>
6436 <varlistentry>
6437 <term><option>-oeq</option></term>
6438 <listitem>
6439 <para>
6440 <indexterm role="option">
6441 <primary><option>-oeq</option></primary>
6442 </indexterm>
6443 <indexterm role="concept">
6444 <primary>error</primary>
6445 <secondary>reporting</secondary>
6446 </indexterm>
6447 This option is supported for compatibility with Sendmail, but has the same
6448 effect as <option>-oep</option>.
6449 </para>
6450 </listitem></varlistentry>
6451 <varlistentry>
6452 <term><option>-oew</option></term>
6453 <listitem>
6454 <para>
6455 <indexterm role="option">
6456 <primary><option>-oew</option></primary>
6457 </indexterm>
6458 <indexterm role="concept">
6459 <primary>error</primary>
6460 <secondary>reporting</secondary>
6461 </indexterm>
6462 This option is supported for compatibility with Sendmail, but has the same
6463 effect as <option>-oem</option>.
6464 </para>
6465 </listitem></varlistentry>
6466 <varlistentry>
6467 <term><option>-oi</option></term>
6468 <listitem>
6469 <para>
6470 <indexterm role="option">
6471 <primary><option>-oi</option></primary>
6472 </indexterm>
6473 <indexterm role="concept">
6474 <primary>dot</primary>
6475 <secondary>in incoming non-SMTP message</secondary>
6476 </indexterm>
6477 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6478 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6479 single dot does terminate, though Exim does no special processing for other
6480 lines that start with a dot. This option is set by default if Exim is called as
6481 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6482 </para>
6483 </listitem></varlistentry>
6484 <varlistentry>
6485 <term><option>-oitrue</option></term>
6486 <listitem>
6487 <para>
6488 <indexterm role="option">
6489 <primary><option>-oitrue</option></primary>
6490 </indexterm>
6491 This option is treated as synonymous with <option>-oi</option>.
6492 </para>
6493 </listitem></varlistentry>
6494 <varlistentry>
6495 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6496 <listitem>
6497 <para>
6498 <indexterm role="option">
6499 <primary><option>-oMa</option></primary>
6500 </indexterm>
6501 <indexterm role="concept">
6502 <primary>sender</primary>
6503 <secondary>host address, specifying for local message</secondary>
6504 </indexterm>
6505 A number of options starting with <option>-oM</option> can be used to set values associated
6506 with remote hosts on locally-submitted messages (that is, messages not received
6507 over TCP/IP). These options can be used by any caller in conjunction with the
6508 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6509 other circumstances, they are ignored unless the caller is trusted.
6510 </para>
6511 <para>
6512 The <option>-oMa</option> option sets the sender host address. This may include a port
6513 number at the end, after a full stop (period). For example:
6514 </para>
6515 <literallayout class="monospaced">
6516 exim -bs -oMa 10.9.8.7.1234
6517 </literallayout>
6518 <para>
6519 An alternative syntax is to enclose the IP address in square brackets,
6520 followed by a colon and the port number:
6521 </para>
6522 <literallayout class="monospaced">
6523 exim -bs -oMa [10.9.8.7]:1234
6524 </literallayout>
6525 <para>
6526 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6527 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6528 are present on the command line, the sender host IP address is taken from
6529 whichever one is last.
6530 </para>
6531 </listitem></varlistentry>
6532 <varlistentry>
6533 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6534 <listitem>
6535 <para>
6536 <indexterm role="option">
6537 <primary><option>-oMaa</option></primary>
6538 </indexterm>
6539 <indexterm role="concept">
6540 <primary>authentication</primary>
6541 <secondary>name, specifying for local message</secondary>
6542 </indexterm>
6543 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6544 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6545 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6546 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6547 authenticated SMTP session without actually using the SMTP AUTH command.
6548 </para>
6549 </listitem></varlistentry>
6550 <varlistentry>
6551 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6552 <listitem>
6553 <para>
6554 <indexterm role="option">
6555 <primary><option>-oMai</option></primary>
6556 </indexterm>
6557 <indexterm role="concept">
6558 <primary>authentication</primary>
6559 <secondary>id, specifying for local message</secondary>
6560 </indexterm>
6561 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6562 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6563 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6564 where there is no default) for messages from local sources. See chapter
6565 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6566 </para>
6567 </listitem></varlistentry>
6568 <varlistentry>
6569 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6570 <listitem>
6571 <para>
6572 <indexterm role="option">
6573 <primary><option>-oMas</option></primary>
6574 </indexterm>
6575 <indexterm role="concept">
6576 <primary>authentication</primary>
6577 <secondary>sender, specifying for local message</secondary>
6578 </indexterm>
6579 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6580 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6581 overrides the sender address that is created from the caller&#x2019;s login id for
6582 messages from local sources, except when <option>-bh</option> is used, when there is no
6583 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6584 specified on a MAIL command overrides this value. See chapter
6585 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6586 </para>
6587 </listitem></varlistentry>
6588 <varlistentry>
6589 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6590 <listitem>
6591 <para>
6592 <indexterm role="option">
6593 <primary><option>-oMi</option></primary>
6594 </indexterm>
6595 <indexterm role="concept">
6596 <primary>interface</primary>
6597 <secondary>address, specifying for local message</secondary>
6598 </indexterm>
6599 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6600 option sets the IP interface address value. A port number may be included,
6601 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6602 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6603 </para>
6604 </listitem></varlistentry>
6605 <varlistentry>
6606 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6607 <listitem>
6608 <para>
6609 <indexterm role="option">
6610 <primary><option>-oMm</option></primary>
6611 </indexterm>
6612 <indexterm role="concept">
6613 <primary>message reference</primary>
6614 <secondary>message reference, specifying for local message</secondary>
6615 </indexterm>
6616 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6617 option sets the message reference, e.g. message-id, and is logged during
6618 delivery. This is useful when some kind of audit trail is required to tie
6619 messages together. The format of the message reference is checked and will
6620 abort if the format is invalid. The option will only be accepted if exim is
6621 running in trusted mode, not as any regular user.
6622 </para>
6623 <para>
6624 The best example of a message reference is when Exim sends a bounce message.
6625 The message reference is the message-id of the original message for which Exim
6626 is sending the bounce.
6627 </para>
6628 </listitem></varlistentry>
6629 <varlistentry>
6630 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6631 <listitem>
6632 <para>
6633 <indexterm role="option">
6634 <primary><option>-oMr</option></primary>
6635 </indexterm>
6636 <indexterm role="concept">
6637 <primary>protocol, specifying for local message</primary>
6638 </indexterm>
6639 <indexterm role="variable">
6640 <primary><varname>$received_protocol</varname></primary>
6641 </indexterm>
6642 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6643 option sets the received protocol value that is stored in
6644 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6645 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6646 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6647 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6648 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6649 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6650 </para>
6651 </listitem></varlistentry>
6652 <varlistentry>
6653 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6654 <listitem>
6655 <para>
6656 <indexterm role="option">
6657 <primary><option>-oMs</option></primary>
6658 </indexterm>
6659 <indexterm role="concept">
6660 <primary>sender</primary>
6661 <secondary>host name, specifying for local message</secondary>
6662 </indexterm>
6663 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6664 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6665 present, Exim does not attempt to look up a host name from an IP address; it
6666 uses the name it is given.
6667 </para>
6668 </listitem></varlistentry>
6669 <varlistentry>
6670 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6671 <listitem>
6672 <para>
6673 <indexterm role="option">
6674 <primary><option>-oMt</option></primary>
6675 </indexterm>
6676 <indexterm role="concept">
6677 <primary>sender</primary>
6678 <secondary>ident string, specifying for local message</secondary>
6679 </indexterm>
6680 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6681 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6682 local callers is the login id of the calling process, except when <option>-bh</option> is
6683 used, when there is no default.
6684 </para>
6685 </listitem></varlistentry>
6686 <varlistentry>
6687 <term><option>-om</option></term>
6688 <listitem>
6689 <para>
6690 <indexterm role="option">
6691 <primary><option>-om</option></primary>
6692 </indexterm>
6693 <indexterm role="concept">
6694 <primary>Sendmail compatibility</primary>
6695 <secondary><option>-om</option> option ignored</secondary>
6696 </indexterm>
6697 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6698 message should receive a copy of the message if the sender appears in an alias
6699 expansion. Exim always does this, so the option does nothing.
6700 </para>
6701 </listitem></varlistentry>
6702 <varlistentry>
6703 <term><option>-oo</option></term>
6704 <listitem>
6705 <para>
6706 <indexterm role="option">
6707 <primary><option>-oo</option></primary>
6708 </indexterm>
6709 <indexterm role="concept">
6710 <primary>Sendmail compatibility</primary>
6711 <secondary><option>-oo</option> option ignored</secondary>
6712 </indexterm>
6713 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6714 whatever that means.
6715 </para>
6716 </listitem></varlistentry>
6717 <varlistentry>
6718 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6719 <listitem>
6720 <para>
6721 <indexterm role="option">
6722 <primary><option>-oP</option></primary>
6723 </indexterm>
6724 <indexterm role="concept">
6725 <primary>pid (process id)</primary>
6726 <secondary>of daemon</secondary>
6727 </indexterm>
6728 <indexterm role="concept">
6729 <primary>daemon</primary>
6730 <secondary>process id (pid)</secondary>
6731 </indexterm>
6732 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6733 value. The option specifies the file to which the process id of the daemon is
6734 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6735 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6736 because in those cases, the normal pid file is not used.
6737 </para>
6738 </listitem></varlistentry>
6739 <varlistentry revisionflag="changed">
6740 <term><option>-oPX</option></term>
6741 <listitem>
6742 <para revisionflag="changed">
6743 <indexterm role="option">
6744 <primary><option>-oPX</option></primary>
6745 </indexterm>
6746 <indexterm role="concept">
6747 <primary>pid (process id)</primary>
6748 <secondary>of daemon</secondary>
6749 </indexterm>
6750 <indexterm role="concept">
6751 <primary>daemon</primary>
6752 <secondary>process id (pid)</secondary>
6753 </indexterm>
6754 This option is not intended for general use.
6755 The daemon uses it when terminating due to a SIGTEM, possibly in
6756 combination with <option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;.
6757 It causes the pid file to be removed.
6758 </para>
6759 </listitem></varlistentry>
6760 <varlistentry>
6761 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6762 <listitem>
6763 <para>
6764 <indexterm role="option">
6765 <primary><option>-or</option></primary>
6766 </indexterm>
6767 <indexterm role="concept">
6768 <primary>timeout</primary>
6769 <secondary>for non-SMTP input</secondary>
6770 </indexterm>
6771 This option sets a timeout value for incoming non-SMTP messages. If it is not
6772 set, Exim will wait forever for the standard input. The value can also be set
6773 by the <option>receive_timeout</option> option. The format used for specifying times is
6774 described in section <xref linkend="SECTtimeformat"/>.
6775 </para>
6776 </listitem></varlistentry>
6777 <varlistentry>
6778 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6779 <listitem>
6780 <para>
6781 <indexterm role="option">
6782 <primary><option>-os</option></primary>
6783 </indexterm>
6784 <indexterm role="concept">
6785 <primary>timeout</primary>
6786 <secondary>for SMTP input</secondary>
6787 </indexterm>
6788 <indexterm role="concept">
6789 <primary>SMTP</primary>
6790 <secondary>input timeout</secondary>
6791 </indexterm>
6792 This option sets a timeout value for incoming SMTP messages. The timeout
6793 applies to each SMTP command and block of data. The value can also be set by
6794 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6795 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6796 </para>
6797 </listitem></varlistentry>
6798 <varlistentry>
6799 <term><option>-ov</option></term>
6800 <listitem>
6801 <para>
6802 <indexterm role="option">
6803 <primary><option>-ov</option></primary>
6804 </indexterm>
6805 This option has exactly the same effect as <option>-v</option>.
6806 </para>
6807 </listitem></varlistentry>
6808 <varlistentry>
6809 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6810 <listitem>
6811 <para>
6812 <indexterm role="option">
6813 <primary><option>-oX</option></primary>
6814 </indexterm>
6815 <indexterm role="concept">
6816 <primary>TCP/IP</primary>
6817 <secondary>setting listening ports</secondary>
6818 </indexterm>
6819 <indexterm role="concept">
6820 <primary>TCP/IP</primary>
6821 <secondary>setting listening interfaces</secondary>
6822 </indexterm>
6823 <indexterm role="concept">
6824 <primary>port</primary>
6825 <secondary>receiving TCP/IP</secondary>
6826 </indexterm>
6827 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6828 is also given. It controls which ports and interfaces the daemon uses. Details
6829 of the syntax, and how it interacts with configuration file options, are given
6830 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6831 file is written unless <option>-oP</option> is also present to specify a pid filename.
6832 </para>
6833 </listitem></varlistentry>
6834 <varlistentry>
6835 <term><option>-pd</option></term>
6836 <listitem>
6837 <para>
6838 <indexterm role="option">
6839 <primary><option>-pd</option></primary>
6840 </indexterm>
6841 <indexterm role="concept">
6842 <primary>Perl</primary>
6843 <secondary>starting the interpreter</secondary>
6844 </indexterm>
6845 This option applies when an embedded Perl interpreter is linked with Exim (see
6846 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6847 option, forcing the starting of the interpreter to be delayed until it is
6848 needed.
6849 </para>
6850 </listitem></varlistentry>
6851 <varlistentry>
6852 <term><option>-ps</option></term>
6853 <listitem>
6854 <para>
6855 <indexterm role="option">
6856 <primary><option>-ps</option></primary>
6857 </indexterm>
6858 <indexterm role="concept">
6859 <primary>Perl</primary>
6860 <secondary>starting the interpreter</secondary>
6861 </indexterm>
6862 This option applies when an embedded Perl interpreter is linked with Exim (see
6863 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6864 option, forcing the starting of the interpreter to occur as soon as Exim is
6865 started.
6866 </para>
6867 </listitem></varlistentry>
6868 <varlistentry>
6869 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6870 <listitem>
6871 <para>
6872 <indexterm role="option">
6873 <primary><option>-p</option></primary>
6874 </indexterm>
6875 For compatibility with Sendmail, this option is equivalent to
6876 </para>
6877 <literallayout>
6878 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6879 </literallayout>
6880 <para>
6881 It sets the incoming protocol and host name (for trusted callers). The
6882 host name and its colon can be omitted when only the protocol is to be set.
6883 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6884 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6885 or <literal>s</literal> using this option (but that does not seem a real limitation).
6886 Repeated use of this option is not supported.
6887 </para>
6888 </listitem></varlistentry>
6889 <varlistentry>
6890 <term><option>-q</option></term>
6891 <listitem>
6892 <para>
6893 <indexterm role="option">
6894 <primary><option>-q</option></primary>
6895 </indexterm>
6896 <indexterm role="concept">
6897 <primary>queue runner</primary>
6898 <secondary>starting manually</secondary>
6899 </indexterm>
6900 This option is normally restricted to admin users. However, there is a
6901 configuration option called <option>prod_requires_admin</option> which can be set false to
6902 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6903 and <option>-S</option> options).
6904 </para>
6905 <para>
6906 <indexterm role="concept">
6907 <primary>queue runner</primary>
6908 <secondary>description of operation</secondary>
6909 </indexterm>
6910 If other commandline options do not specify an action,
6911 the <option>-q</option> option starts one queue runner process. This scans the queue of
6912 waiting messages, and runs a delivery process for each one in turn. It waits
6913 for each delivery process to finish before starting the next one. A delivery
6914 process may not actually do any deliveries if the retry times for the addresses
6915 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6916 </para>
6917 <para>
6918 If
6919 <indexterm role="concept">
6920 <primary>SMTP</primary>
6921 <secondary>passed connection</secondary>
6922 </indexterm>
6923 <indexterm role="concept">
6924 <primary>SMTP</primary>
6925 <secondary>multiple deliveries</secondary>
6926 </indexterm>
6927 <indexterm role="concept">
6928 <primary>multiple SMTP deliveries</primary>
6929 </indexterm>
6930 the delivery process spawns other processes to deliver other messages down
6931 passed SMTP connections, the queue runner waits for these to finish before
6932 proceeding.
6933 </para>
6934 <para>
6935 When all the queued messages have been considered, the original queue runner
6936 process terminates. In other words, a single pass is made over the waiting
6937 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6938 this to be repeated periodically.
6939 </para>
6940 <para>
6941 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6942 random, but it is likely to be different each time, which is all that matters.
6943 If one particular message screws up a remote MTA, other messages to the same
6944 MTA have a chance of getting through if they get tried first.
6945 </para>
6946 <para>
6947 It is possible to cause the messages to be processed in lexical message id
6948 order, which is essentially the order in which they arrived, by setting the
6949 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6950 </para>
6951 </listitem></varlistentry>
6952 <varlistentry>
6953 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6954 <listitem>
6955 <para>
6956 The <option>-q</option> option may be followed by one or more flag letters that change its
6957 behaviour. They are all optional, but if more than one is present, they must
6958 appear in the correct order. Each flag is described in a separate item below.
6959 </para>
6960 </listitem></varlistentry>
6961 <varlistentry>
6962 <term><option>-qq...</option></term>
6963 <listitem>
6964 <para>
6965 <indexterm role="option">
6966 <primary><option>-qq</option></primary>
6967 </indexterm>
6968 <indexterm role="concept">
6969 <primary>queue</primary>
6970 <secondary>double scanning</secondary>
6971 </indexterm>
6972 <indexterm role="concept">
6973 <primary>queue</primary>
6974 <secondary>routing</secondary>
6975 </indexterm>
6976 <indexterm role="concept">
6977 <primary>routing</primary>
6978 <secondary>whole queue before delivery</secondary>
6979 </indexterm>
6980 <indexterm role="concept">
6981 <primary>first pass routing</primary>
6982 </indexterm>
6983 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6984 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6985 every domain. Addresses are routed, local deliveries happen, but no remote
6986 transports are run.
6987 </para>
6988 <para revisionflag="changed">
6989 Performance will be best if the <option>queue_run_in_order</option> option is false.
6990 </para>
6991 <para>
6992 <indexterm role="concept">
6993 <primary>hints database</primary>
6994 <secondary>remembering routing</secondary>
6995 </indexterm>
6996 The hints database that remembers which messages are waiting for specific hosts
6997 is updated, as if delivery to those hosts had been deferred. After this is
6998 complete, a second, normal queue scan happens, with routing and delivery taking
6999 place as normal. Messages that are routed to the same host should mostly be
7000 delivered down a single SMTP
7001 <indexterm role="concept">
7002 <primary>SMTP</primary>
7003 <secondary>passed connection</secondary>
7004 </indexterm>
7005 <indexterm role="concept">
7006 <primary>SMTP</primary>
7007 <secondary>multiple deliveries</secondary>
7008 </indexterm>
7009 <indexterm role="concept">
7010 <primary>multiple SMTP deliveries</primary>
7011 </indexterm>
7012 connection because of the hints that were set up during the first queue scan.
7013 This option may be useful for hosts that are connected to the Internet
7014 intermittently.
7015 </para>
7016 </listitem></varlistentry>
7017 <varlistentry>
7018 <term><option>-q[q]i...</option></term>
7019 <listitem>
7020 <para>
7021 <indexterm role="option">
7022 <primary><option>-qi</option></primary>
7023 </indexterm>
7024 <indexterm role="concept">
7025 <primary>queue</primary>
7026 <secondary>initial delivery</secondary>
7027 </indexterm>
7028 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
7029 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
7030 delivery</quote>.) This can be helpful if you are putting messages in the queue using
7031 <option>-odq</option> and want a queue runner just to process the new messages.
7032 </para>
7033 </listitem></varlistentry>
7034 <varlistentry>
7035 <term><option>-q[q][i]f...</option></term>
7036 <listitem>
7037 <para>
7038 <indexterm role="option">
7039 <primary><option>-qf</option></primary>
7040 </indexterm>
7041 <indexterm role="concept">
7042 <primary>queue</primary>
7043 <secondary>forcing delivery</secondary>
7044 </indexterm>
7045 <indexterm role="concept">
7046 <primary>delivery</primary>
7047 <secondary>forcing in queue run</secondary>
7048 </indexterm>
7049 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
7050 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
7051 their retry times are tried.
7052 </para>
7053 </listitem></varlistentry>
7054 <varlistentry>
7055 <term><option>-q[q][i]ff...</option></term>
7056 <listitem>
7057 <para>
7058 <indexterm role="option">
7059 <primary><option>-qff</option></primary>
7060 </indexterm>
7061 <indexterm role="concept">
7062 <primary>frozen messages</primary>
7063 <secondary>forcing delivery</secondary>
7064 </indexterm>
7065 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
7066 frozen or not.
7067 </para>
7068 </listitem></varlistentry>
7069 <varlistentry>
7070 <term><option>-q[q][i][f[f]]l</option></term>
7071 <listitem>
7072 <para>
7073 <indexterm role="option">
7074 <primary><option>-ql</option></primary>
7075 </indexterm>
7076 <indexterm role="concept">
7077 <primary>queue</primary>
7078 <secondary>local deliveries only</secondary>
7079 </indexterm>
7080 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
7081 be done. If a message requires any remote deliveries, it remains in the queue
7082 for later delivery.
7083 </para>
7084 </listitem></varlistentry>
7085 <varlistentry>
7086 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
7087 <listitem>
7088 <para>
7089 <indexterm role="option">
7090 <primary><option>-qG</option></primary>
7091 </indexterm>
7092 <indexterm role="concept">
7093 <primary>queue</primary>
7094 <secondary>named</secondary>
7095 </indexterm>
7096 <indexterm role="concept">
7097 <primary>named queues</primary>
7098 <secondary>deliver from</secondary>
7099 </indexterm>
7100 <indexterm role="concept">
7101 <primary>queue</primary>
7102 <secondary>delivering specific messages</secondary>
7103 </indexterm>
7104 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
7105 queue with the given name rather than the default queue.
7106 The name should not contain a <emphasis>/</emphasis> character.
7107 For a periodic queue run (see below)
7108 append to the name a slash and a time value.
7109 </para>
7110 <para>
7111 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
7112 will specify a queue to operate on.
7113 For example:
7114 </para>
7115 <literallayout class="monospaced">
7116 exim -bp -qGquarantine
7117 mailq -qGquarantine
7118 exim -qGoffpeak -Rf @special.domain.example
7119 </literallayout>
7120 </listitem></varlistentry>
7121 <varlistentry>
7122 <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>
7123 <listitem>
7124 <para>
7125 When scanning the queue, Exim can be made to skip over messages whose ids are
7126 lexically less than a given value by following the <option>-q</option> option with a
7127 starting message id. For example:
7128 </para>
7129 <literallayout class="monospaced">
7130 exim -q 0t5C6f-0000c8-00
7131 </literallayout>
7132 <para>
7133 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
7134 second message id is given, messages whose ids are lexically greater than it
7135 are also skipped. If the same id is given twice, for example,
7136 </para>
7137 <literallayout class="monospaced">
7138 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
7139 </literallayout>
7140 <para>
7141 just one delivery process is started, for that message. This differs from
7142 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7143 that it counts as a delivery from a queue run. Note that the selection
7144 mechanism does not affect the order in which the messages are scanned. There
7145 are also other ways of selecting specific sets of messages for delivery in a
7146 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7147 </para>
7148 </listitem></varlistentry>
7149 <varlistentry>
7150 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7151 <listitem>
7152 <para>
7153 <indexterm role="concept">
7154 <primary>queue runner</primary>
7155 <secondary>starting periodically</secondary>
7156 </indexterm>
7157 <indexterm role="concept">
7158 <primary>periodic queue running</primary>
7159 </indexterm>
7160 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7161 starting a queue runner process at intervals specified by the given time value
7162 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7163 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7164 single daemon process handles both functions. A common way of starting up a
7165 combined daemon at system boot time is to use a command such as
7166 </para>
7167 <literallayout class="monospaced">
7168 /usr/exim/bin/exim -bd -q30m
7169 </literallayout>
7170 <para>
7171 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7172 process every 30 minutes.
7173 </para>
7174 <para>
7175 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7176 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7177 </para>
7178 </listitem></varlistentry>
7179 <varlistentry>
7180 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7181 <listitem>
7182 <para>
7183 <indexterm role="option">
7184 <primary><option>-qR</option></primary>
7185 </indexterm>
7186 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7187 compatibility.
7188 </para>
7189 </listitem></varlistentry>
7190 <varlistentry>
7191 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7192 <listitem>
7193 <para>
7194 <indexterm role="option">
7195 <primary><option>-qS</option></primary>
7196 </indexterm>
7197 This option is synonymous with <option>-S</option>.
7198 </para>
7199 </listitem></varlistentry>
7200 <varlistentry>
7201 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7202 <listitem>
7203 <para>
7204 <indexterm role="option">
7205 <primary><option>-R</option></primary>
7206 </indexterm>
7207 <indexterm role="concept">
7208 <primary>queue runner</primary>
7209 <secondary>for specific recipients</secondary>
7210 </indexterm>
7211 <indexterm role="concept">
7212 <primary>delivery</primary>
7213 <secondary>to given domain</secondary>
7214 </indexterm>
7215 <indexterm role="concept">
7216 <primary>domain</primary>
7217 <secondary>delivery to</secondary>
7218 </indexterm>
7219 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7220 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7221 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7222 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7223 </para>
7224 <para>
7225 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7226 perform a single queue run, except that, when scanning the messages on the
7227 queue, Exim processes only those that have at least one undelivered recipient
7228 address containing the given string, which is checked in a case-independent
7229 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7230 regular expression; otherwise it is a literal string.
7231 </para>
7232 <para>
7233 If you want to do periodic queue runs for messages with specific recipients,
7234 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7235 </para>
7236 <literallayout class="monospaced">
7237 exim -q25m -R @special.domain.example
7238 </literallayout>
7239 <para>
7240 This example does a queue run for messages with recipients in the given domain
7241 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7242 applied to each queue run.
7243 </para>
7244 <para>
7245 Once a message is selected for delivery by this mechanism, all its addresses
7246 are processed. For the first selected message, Exim overrides any retry
7247 information and forces a delivery attempt for each undelivered address. This
7248 means that if delivery of any address in the first message is successful, any
7249 existing retry information is deleted, and so delivery attempts for that
7250 address in subsequently selected messages (which are processed without forcing)
7251 will run. However, if delivery of any address does not succeed, the retry
7252 information is updated, and in subsequently selected messages, the failing
7253 address will be skipped.
7254 </para>
7255 <para>
7256 <indexterm role="concept">
7257 <primary>frozen messages</primary>
7258 <secondary>forcing delivery</secondary>
7259 </indexterm>
7260 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7261 all selected messages, not just the first; frozen messages are included when
7262 <emphasis>ff</emphasis> is present.
7263 </para>
7264 <para>
7265 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7266 to a given domain after a host has been down for some time. When the SMTP
7267 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7268 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7269 an arbitrary command instead.
7270 </para>
7271 </listitem></varlistentry>
7272 <varlistentry>
7273 <term><option>-r</option></term>
7274 <listitem>
7275 <para>
7276 <indexterm role="option">
7277 <primary><option>-r</option></primary>
7278 </indexterm>
7279 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7280 </para>
7281 </listitem></varlistentry>
7282 <varlistentry>
7283 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7284 <listitem>
7285 <para>
7286 <indexterm role="option">
7287 <primary><option>-S</option></primary>
7288 </indexterm>
7289 <indexterm role="concept">
7290 <primary>delivery</primary>
7291 <secondary>from given sender</secondary>
7292 </indexterm>
7293 <indexterm role="concept">
7294 <primary>queue runner</primary>
7295 <secondary>for specific senders</secondary>
7296 </indexterm>
7297 This option acts like <option>-R</option> except that it checks the string against each
7298 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7299 conditions must be met for a message to be selected. If either of the options
7300 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7301 </para>
7302 </listitem></varlistentry>
7303 <varlistentry>
7304 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7305 <listitem>
7306 <para>
7307 <indexterm role="option">
7308 <primary><option>-Tqt</option></primary>
7309 </indexterm>
7310 This is an option that is exclusively for use by the Exim testing suite. It is not
7311 recognized when Exim is run normally. It allows for the setting up of explicit
7312 <quote>queue times</quote> so that various warning/retry features can be tested.
7313 </para>
7314 </listitem></varlistentry>
7315 <varlistentry>
7316 <term><option>-t</option></term>
7317 <listitem>
7318 <para>
7319 <indexterm role="option">
7320 <primary><option>-t</option></primary>
7321 </indexterm>
7322 <indexterm role="concept">
7323 <primary>recipient</primary>
7324 <secondary>extracting from header lines</secondary>
7325 </indexterm>
7326 <indexterm role="concept">
7327 <primary><emphasis>Bcc:</emphasis> header line</primary>
7328 </indexterm>
7329 <indexterm role="concept">
7330 <primary><emphasis>Cc:</emphasis> header line</primary>
7331 </indexterm>
7332 <indexterm role="concept">
7333 <primary><emphasis>To:</emphasis> header line</primary>
7334 </indexterm>
7335 When Exim is receiving a locally-generated, non-SMTP message on its standard
7336 input, the <option>-t</option> option causes the recipients of the message to be obtained
7337 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7338 from the command arguments. The addresses are extracted before any rewriting
7339 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7340 </para>
7341 <para>
7342 <indexterm role="concept">
7343 <primary>Sendmail compatibility</primary>
7344 <secondary><option>-t</option> option</secondary>
7345 </indexterm>
7346 If the command has any arguments, they specify addresses to which the message
7347 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7348 the recipients list obtained from the headers. This is compatible with Smail 3
7349 and in accordance with the documented behaviour of several versions of
7350 Sendmail, as described in man pages on a number of operating systems (e.g.
7351 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7352 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7353 Sendmail book documents it that way. Exim can be made to add argument addresses
7354 instead of subtracting them by setting the option
7355 <option>extract_addresses_remove_arguments</option> false.
7356 </para>
7357 <para>
7358 <indexterm role="concept">
7359 <primary><option>Resent-</option> header lines</primary>
7360 <secondary>with <option>-t</option></secondary>
7361 </indexterm>
7362 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7363 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7364 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7365 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7366 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7367 </para>
7368 <para>
7369 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7370 message is resent several times). The RFC also specifies that they should be
7371 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7372 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7373 nor indeed exactly what constitutes a <quote>set</quote>.
7374 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7375 are often added at the end of the header, and if a message is resent more than
7376 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7377 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7378 </para>
7379 </listitem></varlistentry>
7380 <varlistentry>
7381 <term><option>-ti</option></term>
7382 <listitem>
7383 <para>
7384 <indexterm role="option">
7385 <primary><option>-ti</option></primary>
7386 </indexterm>
7387 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7388 compatibility with Sendmail.
7389 </para>
7390 </listitem></varlistentry>
7391 <varlistentry>
7392 <term><option>-tls-on-connect</option></term>
7393 <listitem>
7394 <para>
7395 <indexterm role="option">
7396 <primary><option>-tls-on-connect</option></primary>
7397 </indexterm>
7398 <indexterm role="concept">
7399 <primary>TLS</primary>
7400 <secondary>use without STARTTLS</secondary>
7401 </indexterm>
7402 <indexterm role="concept">
7403 <primary>TLS</primary>
7404 <secondary>automatic start</secondary>
7405 </indexterm>
7406 This option is available when Exim is compiled with TLS support. It forces all
7407 incoming SMTP connections to behave as if the incoming port is listed in the
7408 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7409 <xref linkend="CHAPTLS"/> for further details.
7410 </para>
7411 </listitem></varlistentry>
7412 <varlistentry>
7413 <term><option>-U</option></term>
7414 <listitem>
7415 <para>
7416 <indexterm role="option">
7417 <primary><option>-U</option></primary>
7418 </indexterm>
7419 <indexterm role="concept">
7420 <primary>Sendmail compatibility</primary>
7421 <secondary><option>-U</option> option ignored</secondary>
7422 </indexterm>
7423 Sendmail uses this option for <quote>initial message submission</quote>, and its
7424 documentation states that in future releases, it may complain about
7425 syntactically invalid messages rather than fixing them when this flag is not
7426 set. Exim ignores this option.
7427 </para>
7428 </listitem></varlistentry>
7429 <varlistentry>
7430 <term><option>-v</option></term>
7431 <listitem>
7432 <para>
7433 <indexterm role="option">
7434 <primary><option>-v</option></primary>
7435 </indexterm>
7436 This option causes Exim to write information to the standard error stream,
7437 describing what it is doing. In particular, it shows the log lines for
7438 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7439 dialogue is shown. Some of the log lines shown may not actually be written to
7440 the log if the setting of <option>log_selector</option> discards them. Any relevant
7441 selectors are shown with each log line. If none are shown, the logging is
7442 unconditional.
7443 </para>
7444 </listitem></varlistentry>
7445 <varlistentry>
7446 <term><option>-x</option></term>
7447 <listitem>
7448 <para>
7449 <indexterm role="option">
7450 <primary><option>-x</option></primary>
7451 </indexterm>
7452 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7453 National Language Support extended characters in the body of the mail item</quote>).
7454 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7455 this option.
7456 </para>
7457 </listitem></varlistentry>
7458 <varlistentry>
7459 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7460 <listitem>
7461 <para>
7462 <indexterm role="option">
7463 <primary><option>-X</option></primary>
7464 </indexterm>
7465 This option is interpreted by Sendmail to cause debug information to be sent
7466 to the named file.  It is ignored by Exim.
7467 </para>
7468 </listitem></varlistentry>
7469 <varlistentry>
7470 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7471 <listitem>
7472 <para>
7473 <indexterm role="option">
7474 <primary><option>-z</option></primary>
7475 </indexterm>
7476 This option writes its argument to Exim&#x2019;s logfile.
7477 Use is restricted to administrators; the intent is for operational notes.
7478 Quotes should be used to maintain a multi-word item as a single argument,
7479 under most shells.
7480 </para>
7481 </listitem></varlistentry>
7482 </variablelist>
7483 <para>
7484 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7485 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7486 </para>
7487 <!-- === End of command line options === -->
7488 </section>
7489 </chapter>
7490
7491 <chapter id="CHAPconf">
7492 <title>The Exim runtime configuration file</title>
7493 <titleabbrev>The runtime configuration file</titleabbrev>
7494 <para>
7495 <indexterm role="concept">
7496 <primary>runtime configuration</primary>
7497 </indexterm>
7498 <indexterm role="concept">
7499 <primary>configuration file</primary>
7500 <secondary>general description</secondary>
7501 </indexterm>
7502 <indexterm role="concept">
7503 <primary>CONFIGURE_FILE</primary>
7504 </indexterm>
7505 <indexterm role="concept">
7506 <primary>configuration file</primary>
7507 <secondary>errors in</secondary>
7508 </indexterm>
7509 <indexterm role="concept">
7510 <primary>error</primary>
7511 <secondary>in configuration file</secondary>
7512 </indexterm>
7513 <indexterm role="concept">
7514 <primary>return code</primary>
7515 <secondary>for bad configuration</secondary>
7516 </indexterm>
7517 Exim uses a single runtime configuration file that is read whenever an Exim
7518 binary is executed. Note that in normal operation, this happens frequently,
7519 because Exim is designed to operate in a distributed manner, without central
7520 control.
7521 </para>
7522 <para>
7523 If a syntax error is detected while reading the configuration file, Exim
7524 writes a message on the standard error, and exits with a non-zero return code.
7525 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7526 errors can be detected at this time. The values of any expanded options are
7527 not checked until the expansion happens, even when the expansion does not
7528 actually alter the string.
7529 </para>
7530 <para>
7531 The name of the configuration file is compiled into the binary for security
7532 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7533 most configurations, this specifies a single file. However, it is permitted to
7534 give a colon-separated list of filenames, in which case Exim uses the first
7535 existing file in the list.
7536 </para>
7537 <para>
7538 <indexterm role="concept">
7539 <primary>EXIM_USER</primary>
7540 </indexterm>
7541 <indexterm role="concept">
7542 <primary>EXIM_GROUP</primary>
7543 </indexterm>
7544 <indexterm role="concept">
7545 <primary>CONFIGURE_OWNER</primary>
7546 </indexterm>
7547 <indexterm role="concept">
7548 <primary>CONFIGURE_GROUP</primary>
7549 </indexterm>
7550 <indexterm role="concept">
7551 <primary>configuration file</primary>
7552 <secondary>ownership</secondary>
7553 </indexterm>
7554 <indexterm role="concept">
7555 <primary>ownership</primary>
7556 <secondary>configuration file</secondary>
7557 </indexterm>
7558 The runtime configuration file must be owned by root or by the user that is
7559 specified at compile time by the CONFIGURE_OWNER option (if set). The
7560 configuration file must not be world-writeable, or group-writeable unless its
7561 group is the root group or the one specified at compile time by the
7562 CONFIGURE_GROUP option.
7563 </para>
7564 <para>
7565 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7566 to root, anybody who is able to edit the runtime configuration file has an
7567 easy way to run commands as root. If you specify a user or group in the
7568 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7569 who are members of that group will trivially be able to obtain root privileges.
7570 </para>
7571 <para>
7572 Up to Exim version 4.72, the runtime configuration file was also permitted to
7573 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7574 since it offered a simple privilege escalation for any attacker who managed to
7575 compromise the Exim user account.
7576 </para>
7577 <para>
7578 A default configuration file, which will work correctly in simple situations,
7579 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7580 defines just one filename, the installation process copies the default
7581 configuration to a new file of that name if it did not previously exist. If
7582 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7583 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7584 configuration.
7585 </para>
7586 <section id="SECID40">
7587 <title>Using a different configuration file</title>
7588 <para>
7589 <indexterm role="concept">
7590 <primary>configuration file</primary>
7591 <secondary>alternate</secondary>
7592 </indexterm>
7593 A one-off alternate configuration can be specified by the <option>-C</option> command line
7594 option, which may specify a single file or a list of files. However, when
7595 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7596 unless the argument for <option>-C</option> is identical to the built-in value from
7597 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7598 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7599 is useful mainly for checking the syntax of configuration files before
7600 installing them. No owner or group checks are done on a configuration file
7601 specified by <option>-C</option>, if root privilege has been dropped.
7602 </para>
7603 <para>
7604 Even the Exim user is not trusted to specify an arbitrary configuration file
7605 with the <option>-C</option> option to be used with root privileges, unless that file is
7606 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7607 testing a configuration using <option>-C</option> right through message reception and
7608 delivery, even if the caller is root. The reception works, but by that time,
7609 Exim is running as the Exim user, so when it re-execs to regain privilege for
7610 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7611 can test reception and delivery using two separate commands (one to put a
7612 message in the queue, using <option>-odq</option>, and another to do the delivery, using
7613 <option>-M</option>).
7614 </para>
7615 <para>
7616 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7617 prefix string with which any file named in a <option>-C</option> command line option must
7618 start. In addition, the filename must not contain the sequence <quote><literal>/../</literal></quote>.
7619 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any
7620 filename can be used with <option>-C</option>.
7621 </para>
7622 <para>
7623 One-off changes to a configuration can be specified by the <option>-D</option> command line
7624 option, which defines and overrides values for macros used inside the
7625 configuration file. However, like <option>-C</option>, the use of this option by a
7626 non-privileged user causes Exim to discard its root privilege.
7627 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7628 completely disabled, and its use causes an immediate error exit.
7629 </para>
7630 <para>
7631 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7632 to declare certain macro names trusted, such that root privilege will not
7633 necessarily be discarded.
7634 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7635 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7636 values are acceptable, then Exim will not give up root privilege if the caller
7637 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7638 transition mechanism and is expected to be removed in the future.  Acceptable
7639 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7640 </para>
7641 <para>
7642 Some sites may wish to use the same Exim binary on different machines that
7643 share a file system, but to use different configuration files on each machine.
7644 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7645 looks for a file whose name is the configuration filename followed by a dot
7646 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7647 file does not exist, the standard name is tried. This processing occurs for
7648 each filename in the list given by CONFIGURE_FILE or <option>-C</option>.
7649 </para>
7650 <para>
7651 In some esoteric situations different versions of Exim may be run under
7652 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7653 help with this. See the comments in <filename>src/EDITME</filename> for details.
7654 </para>
7655 </section>
7656 <section id="SECTconffilfor">
7657 <title>Configuration file format</title>
7658 <para>
7659 <indexterm role="concept">
7660 <primary>configuration file</primary>
7661 <secondary>format of</secondary>
7662 </indexterm>
7663 <indexterm role="concept">
7664 <primary>format</primary>
7665 <secondary>configuration file</secondary>
7666 </indexterm>
7667 Exim&#x2019;s configuration file is divided into a number of different parts. General
7668 option settings must always appear at the start of the file. The other parts
7669 are all optional, and may appear in any order. Each part other than the first
7670 is introduced by the word <quote>begin</quote> followed by at least one literal
7671 space, and the name of the part. The optional parts are:
7672 </para>
7673 <itemizedlist>
7674 <listitem>
7675 <para>
7676 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7677 <xref linkend="CHAPACL"/>).
7678 </para>
7679 </listitem>
7680 <listitem>
7681 <para>
7682 <indexterm role="concept">
7683 <primary>AUTH</primary>
7684 <secondary>configuration</secondary>
7685 </indexterm>
7686 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7687 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7688 </para>
7689 </listitem>
7690 <listitem>
7691 <para>
7692 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7693 addresses and determine how the message is to be delivered (see chapters
7694 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7695 </para>
7696 </listitem>
7697 <listitem>
7698 <para>
7699 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7700 define mechanisms for copying messages to destinations (see chapters
7701 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7702 </para>
7703 </listitem>
7704 <listitem>
7705 <para>
7706 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7707 If there is no retry section, or if it is empty (that is, no retry rules are
7708 defined), Exim will not retry deliveries. In this situation, temporary errors
7709 are treated the same as permanent errors. Retry rules are discussed in chapter
7710 <xref linkend="CHAPretry"/>.
7711 </para>
7712 </listitem>
7713 <listitem>
7714 <para>
7715 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7716 when new addresses are generated during delivery. Rewriting is discussed in
7717 chapter <xref linkend="CHAPrewrite"/>.
7718 </para>
7719 </listitem>
7720 <listitem>
7721 <para>
7722 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7723 want to use this feature, you must set
7724 </para>
7725 <literallayout class="monospaced">
7726 LOCAL_SCAN_HAS_OPTIONS=yes
7727 </literallayout>
7728 <para>
7729 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7730 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7731 </para>
7732 </listitem>
7733 </itemizedlist>
7734 <para>
7735 <indexterm role="concept">
7736 <primary>configuration file</primary>
7737 <secondary>leading white space in</secondary>
7738 </indexterm>
7739 <indexterm role="concept">
7740 <primary>configuration file</primary>
7741 <secondary>trailing white space in</secondary>
7742 </indexterm>
7743 <indexterm role="concept">
7744 <primary>white space</primary>
7745 <secondary>in configuration file</secondary>
7746 </indexterm>
7747 Leading and trailing white space in configuration lines is always ignored.
7748 </para>
7749 <para>
7750 Blank lines in the file, and lines starting with a # character (ignoring
7751 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7752 # character other than at the beginning of a line is not treated specially,
7753 and does not introduce a comment.
7754 </para>
7755 <para>
7756 Any non-comment line can be continued by ending it with a backslash. Note that
7757 the general rule for white space means that trailing white space after the
7758 backslash and leading white space at the start of continuation
7759 lines is ignored. Comment lines beginning with # (but not empty lines) may
7760 appear in the middle of a sequence of continuation lines.
7761 </para>
7762 <para>
7763 A convenient way to create a configuration file is to start from the
7764 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7765 change settings as required.
7766 </para>
7767 <para>
7768 The ACLs, retry rules, and rewriting rules have their own syntax which is
7769 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7770 respectively. The other parts of the configuration file have some syntactic
7771 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7772 onwards. Before that, the inclusion, macro, and conditional facilities are
7773 described.
7774 </para>
7775 </section>
7776 <section id="SECID41">
7777 <title>File inclusions in the configuration file</title>
7778 <para>
7779 <indexterm role="concept">
7780 <primary>inclusions in configuration file</primary>
7781 </indexterm>
7782 <indexterm role="concept">
7783 <primary>configuration file</primary>
7784 <secondary>including other files</secondary>
7785 </indexterm>
7786 <indexterm role="concept">
7787 <primary><literal>.include</literal> in configuration file</primary>
7788 </indexterm>
7789 <indexterm role="concept">
7790 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7791 </indexterm>
7792 You can include other files inside Exim&#x2019;s runtime configuration file by
7793 using this syntax:
7794 </para>
7795 <literallayout>
7796 <literal>.include</literal> &lt;<emphasis>filename</emphasis>&gt;
7797 <literal>.include_if_exists</literal> &lt;<emphasis>filename</emphasis>&gt;
7798 </literallayout>
7799 <para>
7800 on a line by itself. Double quotes round the filename are optional. If you use
7801 the first form, a configuration error occurs if the file does not exist; the
7802 second form does nothing for non-existent files.
7803 The first form allows a relative name. It is resolved relative to
7804 the directory of the including file. For the second form an absolute filename
7805 is required.
7806 </para>
7807 <para>
7808 Includes may be nested to any depth, but remember that Exim reads its
7809 configuration file often, so it is a good idea to keep them to a minimum.
7810 If you change the contents of an included file, you must HUP the daemon,
7811 because an included file is read only when the configuration itself is read.
7812 </para>
7813 <para>
7814 The processing of inclusions happens early, at a physical line level, so, like
7815 comment lines, an inclusion can be used in the middle of an option setting,
7816 for example:
7817 </para>
7818 <literallayout class="monospaced">
7819 hosts_lookup = a.b.c \
7820                .include /some/file
7821 </literallayout>
7822 <para>
7823 Include processing happens after macro processing (see below). Its effect is to
7824 process the lines of the included file as if they occurred inline where the
7825 inclusion appears.
7826 </para>
7827 </section>
7828 <section id="SECTmacrodefs">
7829 <title>Macros in the configuration file</title>
7830 <para>
7831 <indexterm role="concept">
7832 <primary>macro</primary>
7833 <secondary>description of</secondary>
7834 </indexterm>
7835 <indexterm role="concept">
7836 <primary>configuration file</primary>
7837 <secondary>macros</secondary>
7838 </indexterm>
7839 If a line in the main part of the configuration (that is, before the first
7840 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7841 definition, and must be of the form
7842 </para>
7843 <literallayout>
7844 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7845 </literallayout>
7846 <para>
7847 The name must consist of letters, digits, and underscores, and need not all be
7848 in upper case, though that is recommended. The rest of the line, including any
7849 continuations, is the replacement text, and has leading and trailing white
7850 space removed. Quotes are not removed. The replacement text can never end with
7851 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7852 </para>
7853 <para>
7854 Macros may also be defined between router, transport, authenticator, or ACL
7855 definitions. They may not, however, be defined within an individual driver or
7856 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7857 </para>
7858 </section>
7859 <section id="SECID42">
7860 <title>Macro substitution</title>
7861 <para>
7862 Once a macro is defined, all subsequent lines in the file (and any included
7863 files) are scanned for the macro name; if there are several macros, the line is
7864 scanned for each, in turn, in the order in which the macros are defined. The
7865 replacement text is not re-scanned for the current macro, though it is scanned
7866 for subsequently defined macros. For this reason, a macro name may not contain
7867 the name of a previously defined macro as a substring. You could, for example,
7868 define
7869 </para>
7870 <literallayout>
7871 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7872 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7873 </literallayout>
7874 <para>
7875 but putting the definitions in the opposite order would provoke a configuration
7876 error. Macro expansion is applied to individual physical lines from the file,
7877 before checking for line continuation or file inclusion (see above). If a line
7878 consists solely of a macro name, and the expansion of the macro is empty, the
7879 line is ignored. A macro at the start of a line may turn the line into a
7880 comment line or a <literal>.include</literal> line.
7881 </para>
7882 </section>
7883 <section id="SECID43">
7884 <title>Redefining macros</title>
7885 <para>
7886 Once defined, the value of a macro can be redefined later in the configuration
7887 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7888 <emphasis>=</emphasis>. For example:
7889 </para>
7890 <literallayout class="monospaced">
7891 MAC =  initial value
7892 ...
7893 MAC == updated value
7894 </literallayout>
7895 <para>
7896 Redefinition does not alter the order in which the macros are applied to the
7897 subsequent lines of the configuration file. It is still the same order in which
7898 the macros were originally defined. All that changes is the macro&#x2019;s value.
7899 Redefinition makes it possible to accumulate values. For example:
7900 </para>
7901 <literallayout class="monospaced">
7902 MAC =  initial value
7903 ...
7904 MAC == MAC and something added
7905 </literallayout>
7906 <para>
7907 This can be helpful in situations where the configuration file is built
7908 from a number of other files.
7909 </para>
7910 </section>
7911 <section id="SECID44">
7912 <title>Overriding macro values</title>
7913 <para>
7914 The values set for macros in the configuration file can be overridden by the
7915 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7916 used, unless called by root or the Exim user. A definition on the command line
7917 using the <option>-D</option> option causes all definitions and redefinitions within the
7918 file to be ignored.
7919 </para>
7920 </section>
7921 <section id="SECID45">
7922 <title>Example of macro usage</title>
7923 <para>
7924 As an example of macro usage, consider a configuration where aliases are looked
7925 up in a MySQL database. It helps to keep the file less cluttered if long
7926 strings such as SQL statements are defined separately as macros, for example:
7927 </para>
7928 <literallayout class="monospaced">
7929 ALIAS_QUERY = select mailbox from user where \
7930               login='${quote_mysql:$local_part}';
7931 </literallayout>
7932 <para>
7933 This can then be used in a <command>redirect</command> router setting like this:
7934 </para>
7935 <literallayout class="monospaced">
7936 data = ${lookup mysql{ALIAS_QUERY}}
7937 </literallayout>
7938 <para>
7939 In earlier versions of Exim macros were sometimes used for domain, host, or
7940 address lists. In Exim 4 these are handled better by named lists &ndash; see
7941 section <xref linkend="SECTnamedlists"/>.
7942 </para>
7943 </section>
7944 <section id="SECTbuiltinmacros">
7945 <title>Builtin macros</title>
7946 <para>
7947 Exim defines some macros depending on facilities available, which may
7948 differ due to build-time definitions and from one release to another.
7949 All of these macros start with an underscore.
7950 They can be used to conditionally include parts of a configuration
7951 (see below).
7952 </para>
7953 <para>
7954 The following classes of macros are defined:
7955 </para>
7956 <literallayout>
7957 <literal> _HAVE_*                    </literal>  build-time defines
7958 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7959 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7960 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7961 <literal> _LOG_*                     </literal>  log_selector values
7962 <literal> _OPT_MAIN_*                </literal>  main config options
7963 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7964 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7965 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7966 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7967 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7968 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7969 </literallayout>
7970 <para>
7971 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7972 </para>
7973 </section>
7974 <section id="SECID46">
7975 <title>Conditional skips in the configuration file</title>
7976 <para>
7977 <indexterm role="concept">
7978 <primary>configuration file</primary>
7979 <secondary>conditional skips</secondary>
7980 </indexterm>
7981 <indexterm role="concept">
7982 <primary><literal>.ifdef</literal></primary>
7983 </indexterm>
7984 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7985 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7986 portions of the configuration file. The processing happens whenever the file is
7987 read (that is, when an Exim binary starts to run).
7988 </para>
7989 <para>
7990 The implementation is very simple. Instances of the first four directives must
7991 be followed by text that includes the names of one or macros. The condition
7992 that is tested is whether or not any macro substitution has taken place in the
7993 line. Thus:
7994 </para>
7995 <literallayout class="monospaced">
7996 .ifdef AAA
7997 message_size_limit = 50M
7998 .else
7999 message_size_limit = 100M
8000 .endif
8001 </literallayout>
8002 <para>
8003 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
8004 (or <literal>A</literal> or <literal>AA</literal>), and 100M
8005 otherwise. If there is more than one macro named on the line, the condition
8006 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
8007 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
8008 </para>
8009 <para>
8010 Although you can use a macro expansion to generate one of these directives,
8011 it is not very useful, because the condition <quote>there was a macro substitution
8012 in this line</quote> will always be true.
8013 </para>
8014 <para>
8015 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
8016 to clarify complicated nestings.
8017 </para>
8018 </section>
8019 <section id="SECTcos">
8020 <title>Common option syntax</title>
8021 <para>
8022 <indexterm role="concept">
8023 <primary>common option syntax</primary>
8024 </indexterm>
8025 <indexterm role="concept">
8026 <primary>syntax of common options</primary>
8027 </indexterm>
8028 <indexterm role="concept">
8029 <primary>configuration file</primary>
8030 <secondary>common option syntax</secondary>
8031 </indexterm>
8032 For the main set of options, driver options, and <function>local_scan()</function> options,
8033 each setting is on a line by itself, and starts with a name consisting of
8034 lower-case letters and underscores. Many options require a data value, and in
8035 these cases the name must be followed by an equals sign (with optional white
8036 space) and then the value. For example:
8037 </para>
8038 <literallayout class="monospaced">
8039 qualify_domain = mydomain.example.com
8040 </literallayout>
8041 <para>
8042 <indexterm role="concept">
8043 <primary>hiding configuration option values</primary>
8044 </indexterm>
8045 <indexterm role="concept">
8046 <primary>configuration options</primary>
8047 <secondary>hiding value of</secondary>
8048 </indexterm>
8049 <indexterm role="concept">
8050 <primary>options</primary>
8051 <secondary>hiding value of</secondary>
8052 </indexterm>
8053 Some option settings may contain sensitive data, for example, passwords for
8054 accessing databases. To stop non-admin users from using the <option>-bP</option> command
8055 line option to read these values, you can precede the option settings with the
8056 word <quote>hide</quote>. For example:
8057 </para>
8058 <literallayout class="monospaced">
8059 hide mysql_servers = localhost/users/admin/secret-password
8060 </literallayout>
8061 <para>
8062 For non-admin users, such options are displayed like this:
8063 </para>
8064 <literallayout class="monospaced">
8065 mysql_servers = &lt;value not displayable&gt;
8066 </literallayout>
8067 <para>
8068 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
8069 all instances of the same driver.
8070 </para>
8071 <para>
8072 The following sections describe the syntax used for the different data types
8073 that are found in option settings.
8074 </para>
8075 </section>
8076 <section id="SECID47">
8077 <title>Boolean options</title>
8078 <para>
8079 <indexterm role="concept">
8080 <primary>format</primary>
8081 <secondary>boolean</secondary>
8082 </indexterm>
8083 <indexterm role="concept">
8084 <primary>boolean configuration values</primary>
8085 </indexterm>
8086 <indexterm role="option">
8087 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
8088 </indexterm>
8089 <indexterm role="option">
8090 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
8091 </indexterm>
8092 Options whose type is given as boolean are on/off switches. There are two
8093 different ways of specifying such options: with and without a data value. If
8094 the option name is specified on its own without data, the switch is turned on;
8095 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
8096 boolean options may be followed by an equals sign and one of the words
8097 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
8098 the following two settings have exactly the same effect:
8099 </para>
8100 <literallayout class="monospaced">
8101 queue_only
8102 queue_only = true
8103 </literallayout>
8104 <para>
8105 The following two lines also have the same (opposite) effect:
8106 </para>
8107 <literallayout class="monospaced">
8108 no_queue_only
8109 queue_only = false
8110 </literallayout>
8111 <para>
8112 You can use whichever syntax you prefer.
8113 </para>
8114 </section>
8115 <section id="SECID48">
8116 <title>Integer values</title>
8117 <para>
8118 <indexterm role="concept">
8119 <primary>integer configuration values</primary>
8120 </indexterm>
8121 <indexterm role="concept">
8122 <primary>format</primary>
8123 <secondary>integer</secondary>
8124 </indexterm>
8125 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
8126 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
8127 number is assumed. Otherwise, it is treated as an octal number unless it starts
8128 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
8129 hexadecimal number.
8130 </para>
8131 <para>
8132 If an integer value is followed by the letter K, it is multiplied by 1024; if
8133 it is followed by the letter M, it is multiplied by 1024x1024;
8134 if by the letter G, 1024x1024x1024.
8135 When the values
8136 of integer option settings are output, values which are an exact multiple of
8137 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
8138 and M. The printing style is independent of the actual input format that was
8139 used.
8140 </para>
8141 </section>
8142 <section id="SECID49">
8143 <title>Octal integer values</title>
8144 <para>
8145 <indexterm role="concept">
8146 <primary>integer format</primary>
8147 </indexterm>
8148 <indexterm role="concept">
8149 <primary>format</primary>
8150 <secondary>octal integer</secondary>
8151 </indexterm>
8152 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8153 interpreted as an octal number, whether or not it starts with the digit zero.
8154 Such options are always output in octal.
8155 </para>
8156 </section>
8157 <section id="SECID50">
8158 <title>Fixed point numbers</title>
8159 <para>
8160 <indexterm role="concept">
8161 <primary>fixed point configuration values</primary>
8162 </indexterm>
8163 <indexterm role="concept">
8164 <primary>format</primary>
8165 <secondary>fixed point</secondary>
8166 </indexterm>
8167 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8168 integer, optionally followed by a decimal point and up to three further digits.
8169 </para>
8170 </section>
8171 <section id="SECTtimeformat">
8172 <title>Time intervals</title>
8173 <para>
8174 <indexterm role="concept">
8175 <primary>time interval</primary>
8176 <secondary>specifying in configuration</secondary>
8177 </indexterm>
8178 <indexterm role="concept">
8179 <primary>format</primary>
8180 <secondary>time interval</secondary>
8181 </indexterm>
8182 A time interval is specified as a sequence of numbers, each followed by one of
8183 the following letters, with no intervening white space:
8184 </para>
8185 <informaltable frame="none">
8186 <tgroup cols="2" colsep="0" rowsep="0">
8187 <colspec colwidth="30pt" align="left"/>
8188 <colspec colwidth="254pt" align="left"/>
8189 <tbody>
8190 <row>
8191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8192 <entry>seconds</entry>
8193 </row>
8194 <row>
8195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8196 <entry>minutes</entry>
8197 </row>
8198 <row>
8199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8200 <entry>hours</entry>
8201 </row>
8202 <row>
8203 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8204 <entry>days</entry>
8205 </row>
8206 <row>
8207 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8208 <entry>weeks</entry>
8209 </row>
8210 </tbody>
8211 </tgroup>
8212 </informaltable>
8213 <para>
8214 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8215 intervals are output in the same format. Exim does not restrict the values; it
8216 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8217 </para>
8218 </section>
8219 <section id="SECTstrings">
8220 <title>String values</title>
8221 <para>
8222 <indexterm role="concept">
8223 <primary>string</primary>
8224 <secondary>format of configuration values</secondary>
8225 </indexterm>
8226 <indexterm role="concept">
8227 <primary>format</primary>
8228 <secondary>string</secondary>
8229 </indexterm>
8230 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8231 or without double-quotes. If it does not start with a double-quote, the value
8232 consists of the remainder of the line plus any continuation lines, starting at
8233 the first character after any leading white space, with trailing white space
8234 removed, and with no interpretation of the characters in the string. Because
8235 Exim removes comment lines (those beginning with #) at an early stage, they can
8236 appear in the middle of a multi-line string. The following two settings are
8237 therefore equivalent:
8238 </para>
8239 <literallayout class="monospaced">
8240 trusted_users = uucp:mail
8241 trusted_users = uucp:\
8242                 # This comment line is ignored
8243                 mail
8244 </literallayout>
8245 <para>
8246 <indexterm role="concept">
8247 <primary>string</primary>
8248 <secondary>quoted</secondary>
8249 </indexterm>
8250 <indexterm role="concept">
8251 <primary>escape characters in quoted strings</primary>
8252 </indexterm>
8253 If a string does start with a double-quote, it must end with a closing
8254 double-quote, and any backslash characters other than those used for line
8255 continuation are interpreted as escape characters, as follows:
8256 </para>
8257 <informaltable frame="none">
8258 <tgroup cols="2" colsep="0" rowsep="0">
8259 <colspec colwidth="100pt" align="left"/>
8260 <colspec colwidth="254pt" align="left"/>
8261 <tbody>
8262 <row>
8263 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8264 <entry>single backslash</entry>
8265 </row>
8266 <row>
8267 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8268 <entry>newline</entry>
8269 </row>
8270 <row>
8271 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8272 <entry>carriage return</entry>
8273 </row>
8274 <row>
8275 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8276 <entry>tab</entry>
8277 </row>
8278 <row>
8279 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8280 <entry>up to 3 octal digits specify one character</entry>
8281 </row>
8282 <row>
8283 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8284 <entry>up to 2 hexadecimal digits specify one character</entry>
8285 </row>
8286 </tbody>
8287 </tgroup>
8288 </informaltable>
8289 <para>
8290 If a backslash is followed by some other character, including a double-quote
8291 character, that character replaces the pair.
8292 </para>
8293 <para>
8294 Quoting is necessary only if you want to make use of the backslash escapes to
8295 insert special characters, or if you need to specify a value with leading or
8296 trailing spaces. These cases are rare, so quoting is almost never needed in
8297 current versions of Exim. In versions of Exim before 3.14, quoting was required
8298 in order to continue lines, so you may come across older configuration files
8299 and examples that apparently quote unnecessarily.
8300 </para>
8301 </section>
8302 <section id="SECID51">
8303 <title>Expanded strings</title>
8304 <para>
8305 <indexterm role="concept">
8306 <primary>expansion</primary>
8307 <secondary>definition of</secondary>
8308 </indexterm>
8309 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8310 by which means various parts of the string may be changed according to the
8311 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8312 is as just described; in particular, the handling of backslashes in quoted
8313 strings is done as part of the input process, before expansion takes place.
8314 However, backslash is also an escape character for the expander, so any
8315 backslashes that are required for that reason must be doubled if they are
8316 within a quoted configuration string.
8317 </para>
8318 </section>
8319 <section id="SECID52">
8320 <title>User and group names</title>
8321 <para>
8322 <indexterm role="concept">
8323 <primary>user name</primary>
8324 <secondary>format of</secondary>
8325 </indexterm>
8326 <indexterm role="concept">
8327 <primary>format</primary>
8328 <secondary>user name</secondary>
8329 </indexterm>
8330 <indexterm role="concept">
8331 <primary>groups</primary>
8332 <secondary>name format</secondary>
8333 </indexterm>
8334 <indexterm role="concept">
8335 <primary>format</primary>
8336 <secondary>group name</secondary>
8337 </indexterm>
8338 User and group names are specified as strings, using the syntax described
8339 above, but the strings are interpreted specially. A user or group name must
8340 either consist entirely of digits, or be a name that can be looked up using the
8341 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8342 </para>
8343 </section>
8344 <section id="SECTlistconstruct">
8345 <title>List construction</title>
8346 <para>
8347 <indexterm role="concept">
8348 <primary>list</primary>
8349 <secondary>syntax of in configuration</secondary>
8350 </indexterm>
8351 <indexterm role="concept">
8352 <primary>format</primary>
8353 <secondary>list item in configuration</secondary>
8354 </indexterm>
8355 <indexterm role="concept">
8356 <primary>string</primary>
8357 <secondary>list, definition of</secondary>
8358 </indexterm>
8359 The data for some configuration options is a list of items, with colon as the
8360 default separator. Many of these options are shown with type <quote>string list</quote> in
8361 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8362 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8363 are all the same; however, those other than <quote>string list</quote> are subject to
8364 particular kinds of interpretation, as described in chapter
8365 <xref linkend="CHAPdomhosaddlists"/>.
8366 </para>
8367 <para>
8368 In all these cases, the entire list is treated as a single string as far as the
8369 input syntax is concerned. The <option>trusted_users</option> setting in section
8370 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8371 in a list, it must be entered as two colons. Leading and trailing white space
8372 on each item in a list is ignored. This makes it possible to include items that
8373 start with a colon, and in particular, certain forms of IPv6 address. For
8374 example, the list
8375 </para>
8376 <literallayout class="monospaced">
8377 local_interfaces = 127.0.0.1 : ::::1
8378 </literallayout>
8379 <para>
8380 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8381 </para>
8382 <para>
8383 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8384 list items, it is not ignored when parsing the list. The space after the first
8385 colon in the example above is necessary. If it were not there, the list would
8386 be interpreted as the two items 127.0.0.1:: and 1.
8387 </para>
8388 </section>
8389 <section id="SECTlistsepchange">
8390 <title>Changing list separators</title>
8391 <para>
8392 <indexterm role="concept">
8393 <primary>list separator</primary>
8394 <secondary>changing</secondary>
8395 </indexterm>
8396 <indexterm role="concept">
8397 <primary>IPv6</primary>
8398 <secondary>addresses in lists</secondary>
8399 </indexterm>
8400 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8401 introduced to allow the separator character to be changed. If a list begins
8402 with a left angle bracket, followed by any punctuation character, that
8403 character is used instead of colon as the list separator. For example, the list
8404 above can be rewritten to use a semicolon separator like this:
8405 </para>
8406 <literallayout class="monospaced">
8407 local_interfaces = &lt;; 127.0.0.1 ; ::1
8408 </literallayout>
8409 <para>
8410 This facility applies to all lists, with the exception of the list in
8411 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8412 confined to circumstances where they really are needed.
8413 </para>
8414 <para>
8415 <indexterm role="concept">
8416 <primary>list separator</primary>
8417 <secondary>newline as</secondary>
8418 </indexterm>
8419 <indexterm role="concept">
8420 <primary>newline</primary>
8421 <secondary>as list separator</secondary>
8422 </indexterm>
8423 It is also possible to use newline and other control characters (those with
8424 code values less than 32, plus DEL) as separators in lists. Such separators
8425 must be provided literally at the time the list is processed. For options that
8426 are string-expanded, you can write the separator using a normal escape
8427 sequence. This will be processed by the expander before the string is
8428 interpreted as a list. For example, if a newline-separated list of domains is
8429 generated by a lookup, you can process it directly by a line such as this:
8430 </para>
8431 <literallayout class="monospaced">
8432 domains = &lt;\n ${lookup mysql{.....}}
8433 </literallayout>
8434 <para>
8435 This avoids having to change the list separator in such data. You are unlikely
8436 to want to use a control character as a separator in an option that is not
8437 expanded, because the value is literal text. However, it can be done by giving
8438 the value in quotes. For example:
8439 </para>
8440 <literallayout class="monospaced">
8441 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8442 </literallayout>
8443 <para>
8444 Unlike printing character separators, which can be included in list items by
8445 doubling, it is not possible to include a control character as data when it is
8446 set as the separator. Two such characters in succession are interpreted as
8447 enclosing an empty list item.
8448 </para>
8449 </section>
8450 <section id="SECTempitelis">
8451 <title>Empty items in lists</title>
8452 <para>
8453 <indexterm role="concept">
8454 <primary>list</primary>
8455 <secondary>empty item in</secondary>
8456 </indexterm>
8457 An empty item at the end of a list is always ignored. In other words, trailing
8458 separator characters are ignored. Thus, the list in
8459 </para>
8460 <literallayout class="monospaced">
8461 senders = user@domain :
8462 </literallayout>
8463 <para>
8464 contains only a single item. If you want to include an empty string as one item
8465 in a list, it must not be the last item. For example, this list contains three
8466 items, the second of which is empty:
8467 </para>
8468 <literallayout class="monospaced">
8469 senders = user1@domain : : user2@domain
8470 </literallayout>
8471 <para>
8472 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8473 are interpreted as representing a single colon data character (and the list
8474 would then contain just one item). If you want to specify a list that contains
8475 just one, empty item, you can do it as in this example:
8476 </para>
8477 <literallayout class="monospaced">
8478 senders = :
8479 </literallayout>
8480 <para>
8481 In this case, the first item is empty, and the second is discarded because it
8482 is at the end of the list.
8483 </para>
8484 </section>
8485 <section id="SECTfordricon">
8486 <title>Format of driver configurations</title>
8487 <para>
8488 <indexterm role="concept">
8489 <primary>drivers</primary>
8490 <secondary>configuration format</secondary>
8491 </indexterm>
8492 There are separate parts in the configuration for defining routers, transports,
8493 and authenticators. In each part, you are defining a number of driver
8494 instances, each with its own set of options. Each driver instance is defined by
8495 a sequence of lines like this:
8496 </para>
8497 <literallayout>
8498 &lt;<emphasis>instance name</emphasis>&gt;:
8499   &lt;<emphasis>option</emphasis>&gt;
8500   ...
8501   &lt;<emphasis>option</emphasis>&gt;
8502 </literallayout>
8503 <para>
8504 In the following example, the instance name is <command>localuser</command>, and it is
8505 followed by three options settings:
8506 </para>
8507 <literallayout class="monospaced">
8508 localuser:
8509   driver = accept
8510   check_local_user
8511   transport = local_delivery
8512 </literallayout>
8513 <para>
8514 For each driver instance, you specify which Exim code module it uses &ndash; by the
8515 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8516 settings. For example, in the case of transports, if you want a transport to
8517 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8518 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8519 described in detail in its own separate chapter later in this manual.
8520 </para>
8521 <para>
8522 You can have several routers, transports, or authenticators that are based on
8523 the same underlying driver (each must have a different instance name).
8524 </para>
8525 <para>
8526 The order in which routers are defined is important, because addresses are
8527 passed to individual routers one by one, in order. The order in which
8528 transports are defined does not matter at all. The order in which
8529 authenticators are defined is used only when Exim, as a client, is searching
8530 them to find one that matches an authentication mechanism offered by the
8531 server.
8532 </para>
8533 <para>
8534 <indexterm role="concept">
8535 <primary>generic options</primary>
8536 </indexterm>
8537 <indexterm role="concept">
8538 <primary>options</primary>
8539 <secondary>generic &ndash; definition of</secondary>
8540 </indexterm>
8541 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8542 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8543 same type (that is, all routers, all transports or all authenticators). The
8544 <option>driver</option> option is a generic option that must appear in every definition.
8545 <indexterm role="concept">
8546 <primary>private options</primary>
8547 </indexterm>
8548 The private options are special for each driver, and none need appear, because
8549 they all have default values.
8550 </para>
8551 <para>
8552 The options may appear in any order, except that the <option>driver</option> option must
8553 precede any private options, since these depend on the particular driver. For
8554 this reason, it is recommended that <option>driver</option> always be the first option.
8555 </para>
8556 <para>
8557 Driver instance names, which are used for reference in log entries and
8558 elsewhere, can be any sequence of letters, digits, and underscores (starting
8559 with a letter) and must be unique among drivers of the same type. A router and
8560 a transport (for example) can each have the same name, but no two router
8561 instances can have the same name. The name of a driver instance should not be
8562 confused with the name of the underlying driver module. For example, the
8563 configuration lines:
8564 </para>
8565 <literallayout class="monospaced">
8566 remote_smtp:
8567   driver = smtp
8568 </literallayout>
8569 <para>
8570 create an instance of the <command>smtp</command> transport driver whose name is
8571 <command>remote_smtp</command>. The same driver code can be used more than once, with
8572 different instance names and different option settings each time. A second
8573 instance of the <command>smtp</command> transport, with different options, might be defined
8574 thus:
8575 </para>
8576 <literallayout class="monospaced">
8577 special_smtp:
8578   driver = smtp
8579   port = 1234
8580   command_timeout = 10s
8581 </literallayout>
8582 <para>
8583 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8584 these transport instances from routers, and these names would appear in log
8585 lines.
8586 </para>
8587 <para>
8588 Comment lines may be present in the middle of driver specifications. The full
8589 list of option settings for any particular driver instance, including all the
8590 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8591 option.
8592 </para>
8593 </section>
8594 </chapter>
8595
8596 <chapter id="CHAPdefconfil">
8597 <title>The default configuration file</title>
8598 <para>
8599 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8600 <primary>configuration file</primary>
8601 <secondary>default <quote>walk through</quote></secondary>
8602 </indexterm>
8603 <indexterm role="concept">
8604 <primary>default</primary>
8605 <secondary>configuration file <quote>walk through</quote></secondary>
8606 </indexterm>
8607 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8608 is sufficient for a host with simple mail requirements. As an introduction to
8609 the way Exim is configured, this chapter <quote>walks through</quote> the default
8610 configuration, giving brief explanations of the settings. Detailed descriptions
8611 of the options are given in subsequent chapters. The default configuration file
8612 itself contains extensive comments about ways you might want to modify the
8613 initial settings. However, note that there are many options that are not
8614 mentioned at all in the default configuration.
8615 </para>
8616 <section id="SECTdefconfmacros">
8617 <title>Macros</title>
8618 <para>
8619 All macros should be defined before any options.
8620 </para>
8621 <para>
8622 One macro is specified, but commented out, in the default configuration:
8623 </para>
8624 <literallayout class="monospaced">
8625 # ROUTER_SMARTHOST=MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
8626 </literallayout>
8627 <para>
8628 If all off-site mail is expected to be delivered to a "smarthost", then set the
8629 hostname here and uncomment the macro.  This will affect which router is used
8630 later on.  If this is left commented out, then Exim will perform direct-to-MX
8631 deliveries using a <command>dnslookup</command> router.
8632 </para>
8633 <para>
8634 In addition to macros defined here, Exim includes a number of built-in macros
8635 to enable configuration to be guarded by a binary built with support for a
8636 given feature.  See section <xref linkend="SECTbuiltinmacros"/> for more details.
8637 </para>
8638 </section>
8639 <section id="SECTdefconfmain">
8640 <title>Main configuration settings</title>
8641 <para>
8642 The main (global) configuration option settings section must always come first
8643 in the file, after the macros.
8644 The first thing you&#x2019;ll see in the file, after some initial comments, is the line
8645 </para>
8646 <literallayout class="monospaced">
8647 # primary_hostname =
8648 </literallayout>
8649 <para>
8650 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8651 to know the official, fully qualified name of your host, and this is where you
8652 can specify it. However, in most cases you do not need to set this option. When
8653 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8654 </para>
8655 <para>
8656 The first three non-comment configuration lines are as follows:
8657 </para>
8658 <literallayout class="monospaced">
8659 domainlist local_domains    = @
8660 domainlist relay_to_domains =
8661 hostlist   relay_from_hosts = 127.0.0.1
8662 </literallayout>
8663 <para>
8664 These are not, in fact, option settings. They are definitions of two named
8665 domain lists and one named host list. Exim allows you to give names to lists of
8666 domains, hosts, and email addresses, in order to make it easier to manage the
8667 configuration file (see section <xref linkend="SECTnamedlists"/>).
8668 </para>
8669 <para>
8670 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8671 later in the configuration to identify domains that are to be delivered
8672 on the local host.
8673 </para>
8674 <para>
8675 <indexterm role="concept">
8676 <primary>@ in a domain list</primary>
8677 </indexterm>
8678 There is just one item in this list, the string <quote>@</quote>. This is a special form
8679 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8680 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8681 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8682 the same configuration file can be used on different hosts.
8683 </para>
8684 <para>
8685 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8686 list itself is empty. Later in the configuration we will come to the part that
8687 controls mail relaying through the local host; it allows relaying to any
8688 domains in this list. By default, therefore, no relaying on the basis of a mail
8689 domain is permitted.
8690 </para>
8691 <para>
8692 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8693 used later in the configuration to permit relaying from any host or IP address
8694 that matches the list. The default contains just the IP address of the IPv4
8695 loopback interface, which means that processes on the local host are able to
8696 submit mail for relaying by sending it over TCP/IP to that interface. No other
8697 hosts are permitted to submit messages for relaying.
8698 </para>
8699 <para>
8700 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8701 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8702 and hosts that will be used in the controls that are specified later.
8703 </para>
8704 <para>
8705 The next two configuration lines are genuine option settings:
8706 </para>
8707 <literallayout class="monospaced">
8708 acl_smtp_rcpt = acl_check_rcpt
8709 acl_smtp_data = acl_check_data
8710 </literallayout>
8711 <para>
8712 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8713 during an incoming SMTP session for every recipient of a message (every RCPT
8714 command), and after the contents of the message have been received,
8715 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8716 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8717 section of the configuration. The RCPT ACL controls which recipients are
8718 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8719 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8720 contents of a message to be checked.
8721 </para>
8722 <para>
8723 Two commented-out option settings are next:
8724 </para>
8725 <literallayout class="monospaced">
8726 # av_scanner = clamd:/tmp/clamd
8727 # spamd_address = 127.0.0.1 783
8728 </literallayout>
8729 <para>
8730 These are example settings that can be used when Exim is compiled with the
8731 content-scanning extension. The first specifies the interface to the virus
8732 scanner, and the second specifies the interface to SpamAssassin. Further
8733 details are given in chapter <xref linkend="CHAPexiscan"/>.
8734 </para>
8735 <para>
8736 Three more commented-out option settings follow:
8737 </para>
8738 <literallayout class="monospaced">
8739 # tls_advertise_hosts = *
8740 # tls_certificate = /etc/ssl/exim.crt
8741 # tls_privatekey = /etc/ssl/exim.pem
8742 </literallayout>
8743 <para>
8744 These are example settings that can be used when Exim is compiled with
8745 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8746 first one specifies the list of clients that are allowed to use TLS when
8747 connecting to this server; in this case, the wildcard means all clients. The
8748 other options specify where Exim should find its TLS certificate and private
8749 key, which together prove the server&#x2019;s identity to any clients that connect.
8750 More details are given in chapter <xref linkend="CHAPTLS"/>.
8751 </para>
8752 <para>
8753 Another two commented-out option settings follow:
8754 </para>
8755 <literallayout class="monospaced">
8756 # daemon_smtp_ports = 25 : 465 : 587
8757 # tls_on_connect_ports = 465
8758 </literallayout>
8759 <para>
8760 <indexterm role="concept">
8761 <primary>port</primary>
8762 <secondary>465 and 587</secondary>
8763 </indexterm>
8764 <indexterm role="concept">
8765 <primary>port</primary>
8766 <secondary>for message submission</secondary>
8767 </indexterm>
8768 <indexterm role="concept">
8769 <primary>message</primary>
8770 <secondary>submission, ports for</secondary>
8771 </indexterm>
8772 <indexterm role="concept">
8773 <primary>submissions protocol</primary>
8774 </indexterm>
8775 <indexterm role="concept">
8776 <primary>smtps protocol</primary>
8777 </indexterm>
8778 <indexterm role="concept">
8779 <primary>ssmtp protocol</primary>
8780 </indexterm>
8781 <indexterm role="concept">
8782 <primary>SMTP</primary>
8783 <secondary>submissions protocol</secondary>
8784 </indexterm>
8785 <indexterm role="concept">
8786 <primary>SMTP</primary>
8787 <secondary>ssmtp protocol</secondary>
8788 </indexterm>
8789 <indexterm role="concept">
8790 <primary>SMTP</primary>
8791 <secondary>smtps protocol</secondary>
8792 </indexterm>
8793 These options provide better support for roaming users who wish to use this
8794 server for message submission. They are not much use unless you have turned on
8795 TLS (as described in the previous paragraph) and authentication (about which
8796 more in section <xref linkend="SECTdefconfauth"/>).
8797 Mail submission from mail clients (MUAs) should be separate from inbound mail
8798 to your domain (MX delivery) for various good reasons (eg, ability to impose
8799 much saner TLS protocol and ciphersuite requirements without unintended
8800 consequences).
8801 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
8802 which uses STARTTLS, so this is the <quote>submission</quote> port.
8803 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
8804 which should be used in preference to 587.
8805 You should also consider deploying SRV records to help clients find
8806 these ports.
8807 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
8808 </para>
8809 <para>
8810 Two more commented-out options settings follow:
8811 </para>
8812 <literallayout class="monospaced">
8813 # qualify_domain =
8814 # qualify_recipient =
8815 </literallayout>
8816 <para>
8817 The first of these specifies a domain that Exim uses when it constructs a
8818 complete email address from a local login name. This is often needed when Exim
8819 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8820 the value of <option>primary_hostname</option> is used. If you set both of these options,
8821 you can have different qualification domains for sender and recipient
8822 addresses. If you set only the first one, its value is used in both cases.
8823 </para>
8824 <para>
8825 <indexterm role="concept">
8826 <primary>domain literal</primary>
8827 <secondary>recognizing format</secondary>
8828 </indexterm>
8829 The following line must be uncommented if you want Exim to recognize
8830 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8831 (an IP address within square brackets) instead of a named domain.
8832 </para>
8833 <literallayout class="monospaced">
8834 # allow_domain_literals
8835 </literallayout>
8836 <para>
8837 The RFCs still require this form, but many people think that in the modern
8838 Internet it makes little sense to permit mail to be sent to specific hosts by
8839 quoting their IP addresses. This ancient format has been used by people who
8840 try to abuse hosts by using them for unwanted relaying. However, some
8841 people believe there are circumstances (for example, messages addressed to
8842 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8843 </para>
8844 <para>
8845 The next configuration line is a kind of trigger guard:
8846 </para>
8847 <literallayout class="monospaced">
8848 never_users = root
8849 </literallayout>
8850 <para>
8851 It specifies that no delivery must ever be run as the root user. The normal
8852 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8853 setting is a guard against slips in the configuration.
8854 The list of users specified by <option>never_users</option> is not, however, the complete
8855 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8856 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8857 contents of <option>never_users</option> are added to this list. By default
8858 FIXED_NEVER_USERS also specifies root.
8859 </para>
8860 <para>
8861 When a remote host connects to Exim in order to send mail, the only information
8862 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8863 line,
8864 </para>
8865 <literallayout class="monospaced">
8866 host_lookup = *
8867 </literallayout>
8868 <para>
8869 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8870 in order to get a host name. This improves the quality of the logging
8871 information, but if you feel it is too expensive, you can remove it entirely,
8872 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8873 Note that it is not always possible to find a host name from an IP address,
8874 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8875 unreachable.
8876 </para>
8877 <para>
8878 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8879 1413 (hence their names):
8880 </para>
8881 <literallayout class="monospaced">
8882 rfc1413_hosts = *
8883 rfc1413_query_timeout = 0s
8884 </literallayout>
8885 <para>
8886 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8887 Few hosts offer RFC1413 service these days; calls have to be
8888 terminated by a timeout and this needlessly delays the startup
8889 of an incoming SMTP connection.
8890 If you have hosts for which you trust RFC1413 and need this
8891 information, you can change this.
8892 </para>
8893 <para>
8894 This line enables an efficiency SMTP option.  It is negotiated by clients
8895 and not expected to cause problems but can be disabled if needed.
8896 </para>
8897 <literallayout class="monospaced">
8898 prdr_enable = true
8899 </literallayout>
8900 <para>
8901 When Exim receives messages over SMTP connections, it expects all addresses to
8902 be fully qualified with a domain, as required by the SMTP definition. However,
8903 if you are running a server to which simple clients submit messages, you may
8904 find that they send unqualified addresses. The two commented-out options:
8905 </para>
8906 <literallayout class="monospaced">
8907 # sender_unqualified_hosts =
8908 # recipient_unqualified_hosts =
8909 </literallayout>
8910 <para>
8911 show how you can specify hosts that are permitted to send unqualified sender
8912 and recipient addresses, respectively.
8913 </para>
8914 <para>
8915 The <option>log_selector</option> option is used to increase the detail of logging
8916 over the default:
8917 </para>
8918 <literallayout class="monospaced">
8919 log_selector = +smtp_protocol_error +smtp_syntax_error \
8920                +tls_certificate_verified
8921 </literallayout>
8922 <para>
8923 The <option>percent_hack_domains</option> option is also commented out:
8924 </para>
8925 <literallayout class="monospaced">
8926 # percent_hack_domains =
8927 </literallayout>
8928 <para>
8929 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8930 This is an almost obsolete form of explicit email routing. If you do not know
8931 anything about it, you can safely ignore this topic.
8932 </para>
8933 <para>
8934 The next two settings in the main part of the default configuration are
8935 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8936 message is frozen, Exim no longer continues to try to deliver it. Freezing
8937 occurs when a bounce message encounters a permanent failure because the sender
8938 address of the original message that caused the bounce is invalid, so the
8939 bounce cannot be delivered. This is probably the most common case, but there
8940 are also other conditions that cause freezing, and frozen messages are not
8941 always bounce messages.
8942 </para>
8943 <literallayout class="monospaced">
8944 ignore_bounce_errors_after = 2d
8945 timeout_frozen_after = 7d
8946 </literallayout>
8947 <para>
8948 The first of these options specifies that failing bounce messages are to be
8949 discarded after 2 days in the queue. The second specifies that any frozen
8950 message (whether a bounce message or not) is to be timed out (and discarded)
8951 after a week. In this configuration, the first setting ensures that no failing
8952 bounce message ever lasts a week.
8953 </para>
8954 <para>
8955 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8956 large queues, you may consider using this option. It splits the spool
8957 directory into subdirectories to avoid file system degradation from
8958 many files in a single directory, resulting in better performance.
8959 Manual manipulation of queued messages becomes more complex (though fortunately
8960 not often needed).
8961 </para>
8962 <literallayout class="monospaced">
8963 # split_spool_directory = true
8964 </literallayout>
8965 <para>
8966 In an ideal world everybody follows the standards. For non-ASCII
8967 messages RFC 2047 is a standard, allowing a maximum line length of 76
8968 characters. Exim adheres that standard and won&#x2019;t process messages which
8969 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8970 In particular, the Exim maintainers have had multiple reports of
8971 problems from Russian administrators of issues until they disable this
8972 check, because of some popular, yet buggy, mail composition software.
8973 </para>
8974 <literallayout class="monospaced">
8975 # check_rfc2047_length = false
8976 </literallayout>
8977 <para>
8978 If you need to be strictly RFC compliant you may wish to disable the
8979 8BITMIME advertisement. Use this, if you exchange mails with systems
8980 that are not 8-bit clean.
8981 </para>
8982 <literallayout class="monospaced">
8983 # accept_8bitmime = false
8984 </literallayout>
8985 <para>
8986 Libraries you use may depend on specific environment settings.  This
8987 imposes a security risk (e.g. PATH). There are two lists:
8988 <option>keep_environment</option> for the variables to import as they are, and
8989 <option>add_environment</option> for variables we want to set to a fixed value.
8990 Note that TZ is handled separately, by the $%timezone%$ runtime
8991 option and by the TIMEZONE_DEFAULT buildtime option.
8992 </para>
8993 <literallayout class="monospaced">
8994 # keep_environment = ^LDAP
8995 # add_environment = PATH=/usr/bin::/bin
8996 </literallayout>
8997 </section>
8998 <section id="SECID54">
8999 <title>ACL configuration</title>
9000 <para>
9001 <indexterm role="concept">
9002 <primary>default</primary>
9003 <secondary>ACLs</secondary>
9004 </indexterm>
9005 <indexterm role="concept">
9006 <primary>access control lists (ACLs)</primary>
9007 <secondary>default configuration</secondary>
9008 </indexterm>
9009 In the default configuration, the ACL section follows the main configuration.
9010 It starts with the line
9011 </para>
9012 <literallayout class="monospaced">
9013 begin acl
9014 </literallayout>
9015 <para>
9016 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
9017 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
9018 and <option>acl_smtp_data</option> above.
9019 </para>
9020 <para>
9021 <indexterm role="concept">
9022 <primary>RCPT</primary>
9023 <secondary>ACL for</secondary>
9024 </indexterm>
9025 The first ACL is used for every RCPT command in an incoming SMTP message. Each
9026 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
9027 are considered in order, until the recipient address is either accepted or
9028 rejected. The RCPT command is then accepted or rejected, according to the
9029 result of the ACL processing.
9030 </para>
9031 <literallayout class="monospaced">
9032 acl_check_rcpt:
9033 </literallayout>
9034 <para>
9035 This line, consisting of a name terminated by a colon, marks the start of the
9036 ACL, and names it.
9037 </para>
9038 <literallayout class="monospaced">
9039 accept  hosts = :
9040 </literallayout>
9041 <para>
9042 This ACL statement accepts the recipient if the sending host matches the list.
9043 But what does that strange list mean? It doesn&#x2019;t actually contain any host
9044 names or IP addresses. The presence of the colon puts an empty item in the
9045 list; Exim matches this only if the incoming message did not come from a remote
9046 host, because in that case, the remote hostname is empty. The colon is
9047 important. Without it, the list itself is empty, and can never match anything.
9048 </para>
9049 <para>
9050 What this statement is doing is to accept unconditionally all recipients in
9051 messages that are submitted by SMTP from local processes using the standard
9052 input and output (that is, not using TCP/IP). A number of MUAs operate in this
9053 manner.
9054 </para>
9055 <literallayout class="monospaced">
9056 deny    domains       = +local_domains
9057         local_parts   = ^[.] : ^.*[@%!/|]
9058         message       = Restricted characters in address
9059
9060 deny    domains       = !+local_domains
9061         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
9062         message       = Restricted characters in address
9063 </literallayout>
9064 <para>
9065 These statements are concerned with local parts that contain any of the
9066 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
9067 Although these characters are entirely legal in local parts (in the case of
9068 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
9069 in Internet mail addresses.
9070 </para>
9071 <para>
9072 The first three have in the past been associated with explicitly routed
9073 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
9074 option). Addresses containing these characters are regularly tried by spammers
9075 in an attempt to bypass relaying restrictions, and also by open relay testing
9076 programs. Unless you really need them it is safest to reject these characters
9077 at this early stage. This configuration is heavy-handed in rejecting these
9078 characters for all messages it accepts from remote hosts. This is a deliberate
9079 policy of being as safe as possible.
9080 </para>
9081 <para>
9082 The first rule above is stricter, and is applied to messages that are addressed
9083 to one of the local domains handled by this host. This is implemented by the
9084 first condition, which restricts it to domains that are listed in the
9085 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9086 reference to a named list. In this configuration, there is just one domain in
9087 <emphasis>local_domains</emphasis>, but in general there may be many.
9088 </para>
9089 <para>
9090 The second condition on the first statement uses two regular expressions to
9091 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
9092 or <quote>|</quote>. If you have local accounts that include these characters, you will
9093 have to modify this rule.
9094 </para>
9095 <para>
9096 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
9097 allows them because they have been encountered in practice. (Consider the
9098 common convention of local parts constructed as
9099 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
9100 the author of Exim, who has no second initial.) However, a local part starting
9101 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
9102 filename (for example, for a mailing list). This is also true for local parts
9103 that contain slashes. A pipe symbol can also be troublesome if the local part
9104 is incorporated unthinkingly into a shell command line.
9105 </para>
9106 <para>
9107 The second rule above applies to all other domains, and is less strict. This
9108 allows your own users to send outgoing messages to sites that use slashes
9109 and vertical bars in their local parts. It blocks local parts that begin
9110 with a dot, slash, or vertical bar, but allows these characters within the
9111 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
9112 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
9113 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
9114 </para>
9115 <literallayout class="monospaced">
9116 accept  local_parts   = postmaster
9117         domains       = +local_domains
9118 </literallayout>
9119 <para>
9120 This statement, which has two conditions, accepts an incoming address if the
9121 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
9122 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9123 reference to a named list. In this configuration, there is just one domain in
9124 <emphasis>local_domains</emphasis>, but in general there may be many.
9125 </para>
9126 <para>
9127 The presence of this statement means that mail to postmaster is never blocked
9128 by any of the subsequent tests. This can be helpful while sorting out problems
9129 in cases where the subsequent tests are incorrectly denying access.
9130 </para>
9131 <literallayout class="monospaced">
9132 require verify        = sender
9133 </literallayout>
9134 <para>
9135 This statement requires the sender address to be verified before any subsequent
9136 ACL statement can be used. If verification fails, the incoming recipient
9137 address is refused. Verification consists of trying to route the address, to
9138 see if a bounce message could be delivered to it. In the case of remote
9139 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
9140 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
9141 discusses the details of address verification.
9142 </para>
9143 <literallayout class="monospaced">
9144 accept  hosts         = +relay_from_hosts
9145         control       = submission
9146 </literallayout>
9147 <para>
9148 This statement accepts the address if the message is coming from one of the
9149 hosts that are defined as being allowed to relay through this host. Recipient
9150 verification is omitted here, because in many cases the clients are dumb MUAs
9151 that do not cope well with SMTP error responses. For the same reason, the
9152 second line specifies <quote>submission mode</quote> for messages that are accepted. This
9153 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
9154 messages that are deficient in some way, for example, because they lack a
9155 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
9156 probably add recipient verification here, and disable submission mode.
9157 </para>
9158 <literallayout class="monospaced">
9159 accept  authenticated = *
9160         control       = submission
9161 </literallayout>
9162 <para>
9163 This statement accepts the address if the client host has authenticated itself.
9164 Submission mode is again specified, on the grounds that such messages are most
9165 likely to come from MUAs. The default configuration does not define any
9166 authenticators, though it does include some nearly complete commented-out
9167 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9168 fact authenticate until you complete the authenticator definitions.
9169 </para>
9170 <literallayout class="monospaced">
9171 require message = relay not permitted
9172         domains = +local_domains : +relay_to_domains
9173 </literallayout>
9174 <para>
9175 This statement rejects the address if its domain is neither a local domain nor
9176 one of the domains for which this host is a relay.
9177 </para>
9178 <literallayout class="monospaced">
9179 require verify = recipient
9180 </literallayout>
9181 <para>
9182 This statement requires the recipient address to be verified; if verification
9183 fails, the address is rejected.
9184 </para>
9185 <literallayout class="monospaced">
9186 # deny    dnslists    = black.list.example
9187 #         message     = rejected because $sender_host_address \
9188 #                       is in a black list at $dnslist_domain\n\
9189 #                       $dnslist_text
9190 #
9191 # warn    dnslists    = black.list.example
9192 #         add_header  = X-Warning: $sender_host_address is in \
9193 #                       a black list at $dnslist_domain
9194 #         log_message = found in $dnslist_domain
9195 </literallayout>
9196 <para>
9197 These commented-out lines are examples of how you could configure Exim to check
9198 sending hosts against a DNS black list. The first statement rejects messages
9199 from blacklisted hosts, whereas the second just inserts a warning header
9200 line.
9201 </para>
9202 <literallayout class="monospaced">
9203 # require verify = csa
9204 </literallayout>
9205 <para>
9206 This commented-out line is an example of how you could turn on client SMTP
9207 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9208 records.
9209 </para>
9210 <literallayout class="monospaced">
9211 accept
9212 </literallayout>
9213 <para>
9214 The final statement in the first ACL unconditionally accepts any recipient
9215 address that has successfully passed all the previous tests.
9216 </para>
9217 <literallayout class="monospaced">
9218 acl_check_data:
9219 </literallayout>
9220 <para>
9221 This line marks the start of the second ACL, and names it. Most of the contents
9222 of this ACL are commented out:
9223 </para>
9224 <literallayout class="monospaced">
9225 # deny    malware   = *
9226 #         message   = This message contains a virus \
9227 #                     ($malware_name).
9228 </literallayout>
9229 <para>
9230 These lines are examples of how to arrange for messages to be scanned for
9231 viruses when Exim has been compiled with the content-scanning extension, and a
9232 suitable virus scanner is installed. If the message is found to contain a
9233 virus, it is rejected with the given custom error message.
9234 </para>
9235 <literallayout class="monospaced">
9236 # warn    spam      = nobody
9237 #         message   = X-Spam_score: $spam_score\n\
9238 #                     X-Spam_score_int: $spam_score_int\n\
9239 #                     X-Spam_bar: $spam_bar\n\
9240 #                     X-Spam_report: $spam_report
9241 </literallayout>
9242 <para>
9243 These lines are an example of how to arrange for messages to be scanned by
9244 SpamAssassin when Exim has been compiled with the content-scanning extension,
9245 and SpamAssassin has been installed. The SpamAssassin check is run with
9246 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9247 series of extra header line. In this case, the message is not rejected,
9248 whatever the spam score.
9249 </para>
9250 <literallayout class="monospaced">
9251 accept
9252 </literallayout>
9253 <para>
9254 This final line in the DATA ACL accepts the message unconditionally.
9255 </para>
9256 </section>
9257 <section id="SECID55">
9258 <title>Router configuration</title>
9259 <para>
9260 <indexterm role="concept">
9261 <primary>default</primary>
9262 <secondary>routers</secondary>
9263 </indexterm>
9264 <indexterm role="concept">
9265 <primary>routers</primary>
9266 <secondary>default</secondary>
9267 </indexterm>
9268 The router configuration comes next in the default configuration, introduced
9269 by the line
9270 </para>
9271 <literallayout class="monospaced">
9272 begin routers
9273 </literallayout>
9274 <para>
9275 Routers are the modules in Exim that make decisions about where to send
9276 messages. An address is passed to each router, in turn, until it is either
9277 accepted, or failed. This means that the order in which you define the routers
9278 matters. Each router is fully described in its own chapter later in this
9279 manual. Here we give only brief overviews.
9280 </para>
9281 <literallayout class="monospaced">
9282 # domain_literal:
9283 #   driver = ipliteral
9284 #   domains = !+local_domains
9285 #   transport = remote_smtp
9286 </literallayout>
9287 <para>
9288 <indexterm role="concept">
9289 <primary>domain literal</primary>
9290 <secondary>default router</secondary>
9291 </indexterm>
9292 This router is commented out because the majority of sites do not want to
9293 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9294 you uncomment this router, you also need to uncomment the setting of
9295 <option>allow_domain_literals</option> in the main part of the configuration.
9296 </para>
9297 <para>
9298 Which router is used next depends upon whether or not the ROUTER_SMARTHOST
9299 macro has been defined, per
9300 </para>
9301 <literallayout class="monospaced">
9302 .ifdef ROUTER_SMARTHOST
9303 smarthost:
9304 #...
9305 .else
9306 dnslookup:
9307 #...
9308 .endif
9309 </literallayout>
9310 <para>
9311 If ROUTER_SMARTHOST has been defined, either at the top of the file or on the
9312 command-line, then we route all non-local mail to that smarthost; otherwise, we&#x2019;ll
9313 perform DNS lookups for direct-to-MX lookup.  Any mail which is to a local domain will
9314 skip these routers because of the <option>domains</option> option.
9315 </para>
9316 <literallayout class="monospaced">
9317 smarthost:
9318   driver = manualroute
9319   domains = ! +local_domains
9320   transport = smarthost_smtp
9321   route_data = ROUTER_SMARTHOST
9322   ignore_target_hosts = &lt;; 0.0.0.0 ; 127.0.0.0/8 ; ::1
9323   no_more
9324 </literallayout>
9325 <para>
9326 This router only handles mail which is not to any local domains; this is
9327 specified by the line
9328 </para>
9329 <literallayout class="monospaced">
9330 domains = ! +local_domains
9331 </literallayout>
9332 <para>
9333 The <option>domains</option> option lists the domains to which this router applies, but the
9334 exclamation mark is a negation sign, so the router is used only for domains
9335 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9336 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9337 indicates that it is referring to a named list. Addresses in other domains are
9338 passed on to the following routers.
9339 </para>
9340 <para>
9341 The name of the router driver is <command>manualroute</command> because we are manually
9342 specifying how mail should be routed onwards, instead of using DNS MX.
9343 While the name of this router instance is arbitrary, the <option>driver</option> option must
9344 be one of the driver modules that is in the Exim binary.
9345 </para>
9346 <para>
9347 With no pre-conditions other than <option>domains</option>, all mail for non-local domains
9348 will be handled by this router, and the <option>no_more</option> setting will ensure that no
9349 other routers will be used for messages matching the pre-conditions.  See
9350 <xref linkend="SECTrouprecon"/> for more on how the pre-conditions apply.  For messages which
9351 are handled by this router, we provide a hostname to deliver to in <option>route_data</option>
9352 and the macro supplies the value; the address is then queued for the
9353 <command>smarthost_smtp</command> transport.
9354 </para>
9355 <literallayout class="monospaced">
9356 dnslookup:
9357   driver = dnslookup
9358   domains = ! +local_domains
9359   transport = remote_smtp
9360   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9361   no_more
9362 </literallayout>
9363 <para>
9364 The <option>domains</option> option behaves as per smarthost, above.
9365 </para>
9366 <para>
9367 The name of the router driver is <command>dnslookup</command>,
9368 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9369 the name of this router instance is the same as the name of the driver. The
9370 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9371 one of the driver modules that is in the Exim binary.
9372 </para>
9373 <para>
9374 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9375 DNS in order to obtain a list of hosts to which the address is routed. If the
9376 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9377 specified by the <option>transport</option> option. If the router does not find the domain
9378 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9379 the address fails and is bounced.
9380 </para>
9381 <para>
9382 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9383 be entirely ignored. This option is present because a number of cases have been
9384 encountered where MX records in the DNS point to host names
9385 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9386 Completely ignoring these IP addresses causes Exim to fail to route the
9387 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9388 continue to try to deliver the message periodically until the address timed
9389 out.
9390 </para>
9391 <literallayout class="monospaced">
9392 system_aliases:
9393   driver = redirect
9394   allow_fail
9395   allow_defer
9396   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9397 # user = exim
9398   file_transport = address_file
9399   pipe_transport = address_pipe
9400 </literallayout>
9401 <para>
9402 Control reaches this and subsequent routers only for addresses in the local
9403 domains. This router checks to see whether the local part is defined as an
9404 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9405 data that it looks up from that file. If no data is found for the local part,
9406 the value of the <option>data</option> option is empty, causing the address to be passed to
9407 the next router.
9408 </para>
9409 <para>
9410 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9411 often used. That is why it is referenced by from the default configuration
9412 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9413 <filename>Local/Makefile</filename> before building Exim.
9414 </para>
9415 <literallayout class="monospaced">
9416 userforward:
9417   driver = redirect
9418   check_local_user
9419 # local_part_suffix = +* : -*
9420 # local_part_suffix_optional
9421   file = $home/.forward
9422 # allow_filter
9423   no_verify
9424   no_expn
9425   check_ancestor
9426   file_transport = address_file
9427   pipe_transport = address_pipe
9428   reply_transport = address_reply
9429 </literallayout>
9430 <para>
9431 This is the most complicated router in the default configuration. It is another
9432 redirection router, but this time it is looking for forwarding data set up by
9433 individual users. The <option>check_local_user</option> setting specifies a check that the
9434 local part of the address is the login name of a local user. If it is not, the
9435 router is skipped. The two commented options that follow <option>check_local_user</option>,
9436 namely:
9437 </para>
9438 <literallayout class="monospaced">
9439 # local_part_suffix = +* : -*
9440 # local_part_suffix_optional
9441 </literallayout>
9442 <para>
9443 <indexterm role="variable">
9444 <primary><varname>$local_part_suffix</varname></primary>
9445 </indexterm>
9446 show how you can specify the recognition of local part suffixes. If the first
9447 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9448 by any sequence of characters, is removed from the local part and placed in the
9449 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9450 presence of a suffix in the local part is optional. When a suffix is present,
9451 the check for a local login uses the local part with the suffix removed.
9452 </para>
9453 <para>
9454 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9455 home directory is consulted. If it does not exist, or is empty, the router
9456 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9457 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9458 </para>
9459 <para>
9460 <indexterm role="concept">
9461 <primary>Sieve filter</primary>
9462 <secondary>enabling in default router</secondary>
9463 </indexterm>
9464 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9465 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9466 is commented out by default), the contents of the file are interpreted as a set
9467 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9468 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9469 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9470 </para>
9471 <para>
9472 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9473 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9474 There are two reasons for doing this:
9475 </para>
9476 <orderedlist numeration="arabic">
9477 <listitem>
9478 <para>
9479 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9480 checking an address for validity; it makes sense not to waste resources doing
9481 unnecessary work.
9482 </para>
9483 </listitem>
9484 <listitem>
9485 <para>
9486 More importantly, when Exim is verifying addresses or handling an EXPN
9487 command during an SMTP session, it is running as the Exim user, not as root.
9488 The group is the Exim group, and no additional groups are set up.
9489 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9490 this time.
9491 </para>
9492 </listitem>
9493 </orderedlist>
9494 <para>
9495 The setting of <option>check_ancestor</option> prevents the router from generating a new
9496 address that is the same as any previous address that was redirected. (This
9497 works round a problem concerning a bad interaction between aliasing and
9498 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9499 </para>
9500 <para>
9501 The final three option settings specify the transports that are to be used when
9502 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9503 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9504 </para>
9505 <literallayout class="monospaced">
9506 a.nother@elsewhere.example, /home/spqr/archive
9507 </literallayout>
9508 <para>
9509 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9510 transport.
9511 </para>
9512 <literallayout class="monospaced">
9513 localuser:
9514   driver = accept
9515   check_local_user
9516 # local_part_suffix = +* : -*
9517 # local_part_suffix_optional
9518   transport = local_delivery
9519 </literallayout>
9520 <para>
9521 The final router sets up delivery into local mailboxes, provided that the local
9522 part is the name of a local login, by accepting the address and assigning it to
9523 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9524 routers, so the address is bounced. The commented suffix settings fulfil the
9525 same purpose as they do for the <command>userforward</command> router.
9526 </para>
9527 </section>
9528 <section id="SECID56">
9529 <title>Transport configuration</title>
9530 <para>
9531 <indexterm role="concept">
9532 <primary>default</primary>
9533 <secondary>transports</secondary>
9534 </indexterm>
9535 <indexterm role="concept">
9536 <primary>transports</primary>
9537 <secondary>default</secondary>
9538 </indexterm>
9539 Transports define mechanisms for actually delivering messages. They operate
9540 only when referenced from routers, so the order in which they are defined does
9541 not matter. The transports section of the configuration starts with
9542 </para>
9543 <literallayout class="monospaced">
9544 begin transports
9545 </literallayout>
9546 <para>
9547 Two remote transports and four local transports are defined.
9548 </para>
9549 <literallayout class="monospaced">
9550 remote_smtp:
9551   driver = smtp
9552   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9553 .ifdef _HAVE_PRDR
9554   hosts_try_prdr = *
9555 .endif
9556 </literallayout>
9557 <para>
9558 This transport is used for delivering messages over SMTP connections.
9559 The list of remote hosts comes from the router.
9560 The <option>message_size_limit</option> usage is a hack to avoid sending on messages
9561 with over-long lines.
9562 </para>
9563 <para>
9564 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.  It is
9565 negotiated between client and server and not expected to cause problems
9566 but can be disabled if needed.  The built-in macro _HAVE_PRDR guards the
9567 use of the <option>hosts_try_prdr</option> configuration option.
9568 </para>
9569 <para>
9570 The other remote transport is used when delivering to a specific smarthost
9571 with whom there must be some kind of existing relationship, instead of the
9572 usual federated system.
9573 </para>
9574 <literallayout class="monospaced">
9575 smarthost_smtp:
9576   driver = smtp
9577   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9578   multi_domain
9579   #
9580 .ifdef _HAVE_TLS
9581   # Comment out any of these which you have to, then file a Support
9582   # request with your smarthost provider to get things fixed:
9583   hosts_require_tls = *
9584   tls_verify_hosts = *
9585   # As long as tls_verify_hosts is enabled, this won't matter, but if you
9586   # have to comment it out then this will at least log whether you succeed
9587   # or not:
9588   tls_try_verify_hosts = *
9589   #
9590   # The SNI name should match the name which we'll expect to verify;
9591   # many mail systems don't use SNI and this doesn't matter, but if it does,
9592   # we need to send a name which the remote site will recognize.
9593   # This _should_ be the name which the smarthost operators specified as
9594   # the hostname for sending your mail to.
9595   tls_sni = ROUTER_SMARTHOST
9596   #
9597 .ifdef _HAVE_OPENSSL
9598   tls_require_ciphers = HIGH:!aNULL:@STRENGTH
9599 .endif
9600 .ifdef _HAVE_GNUTLS
9601   tls_require_ciphers = SECURE192:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1
9602 .endif
9603 .endif
9604 .ifdef _HAVE_PRDR
9605   hosts_try_prdr = *
9606 .endif
9607 </literallayout>
9608 <para>
9609 After the same <option>message_size_limit</option> hack, we then specify that this Transport
9610 can handle messages to multiple domains in one run.  The assumption here is
9611 that you&#x2019;re routing all non-local mail to the same place and that place is
9612 happy to take all messages from you as quickly as possible.
9613 All other options depend upon built-in macros; if Exim was built without TLS support
9614 then no other options are defined.
9615 If TLS is available, then we configure "stronger than default" TLS ciphersuites
9616 and versions using the <option>tls_require_ciphers</option> option, where the value to be
9617 used depends upon the library providing TLS.
9618 Beyond that, the options adopt the stance that you should have TLS support available
9619 from your smarthost on today&#x2019;s Internet, so we turn on requiring TLS for the
9620 mail to be delivered, and requiring that the certificate be valid, and match
9621 the expected hostname.  The <option>tls_sni</option> option can be used by service providers
9622 to select an appropriate certificate to present to you and here we re-use the
9623 ROUTER_SMARTHOST macro, because that is unaffected by CNAMEs present in DNS.
9624 You want to specify the hostname which you&#x2019;ll expect to validate for, and that
9625 should not be subject to insecure tampering via DNS results.
9626 </para>
9627 <para>
9628 For the <option>hosts_try_prdr</option> option see the previous transport.
9629 </para>
9630 <para>
9631 All other options are defaulted.
9632 </para>
9633 <literallayout class="monospaced">
9634 local_delivery:
9635   driver = appendfile
9636   file = /var/mail/$local_part_data
9637   delivery_date_add
9638   envelope_to_add
9639   return_path_add
9640 # group = mail
9641 # mode = 0660
9642 </literallayout>
9643 <para>
9644 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9645 traditional BSD mailbox format.
9646 </para>
9647 <para revisionflag="changed">
9648 We prefer to avoid using <varname>$local_part</varname> directly to define the mailbox filename,
9649 as it is provided by a potential bad actor.
9650 Instead we use <varname>$local_part_data</varname>,
9651 the result of looking up <varname>$local_part</varname> in the user database
9652 (done by using <option>check_local_user</option> in the the router).
9653 </para>
9654 <para>
9655 By default <command>appendfile</command> runs under the uid and gid of the
9656 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9657 directory. Some systems use the alternative approach of running mail deliveries
9658 under a particular group instead of using the sticky bit. The commented options
9659 show how this can be done.
9660 </para>
9661 <para>
9662 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9663 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9664 similarly-named options above.
9665 </para>
9666 <literallayout class="monospaced">
9667 address_pipe:
9668   driver = pipe
9669   return_output
9670 </literallayout>
9671 <para>
9672 This transport is used for handling deliveries to pipes that are generated by
9673 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9674 option specifies that any output on stdout or stderr generated by the pipe is to
9675 be returned to the sender.
9676 </para>
9677 <literallayout class="monospaced">
9678 address_file:
9679   driver = appendfile
9680   delivery_date_add
9681   envelope_to_add
9682   return_path_add
9683 </literallayout>
9684 <para>
9685 This transport is used for handling deliveries to files that are generated by
9686 redirection. The name of the file is not specified in this instance of
9687 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9688 </para>
9689 <literallayout class="monospaced">
9690 address_reply:
9691   driver = autoreply
9692 </literallayout>
9693 <para>
9694 This transport is used for handling automatic replies generated by users&#x2019;
9695 filter files.
9696 </para>
9697 </section>
9698 <section id="SECID57">
9699 <title>Default retry rule</title>
9700 <para>
9701 <indexterm role="concept">
9702 <primary>retry</primary>
9703 <secondary>default rule</secondary>
9704 </indexterm>
9705 <indexterm role="concept">
9706 <primary>default</primary>
9707 <secondary>retry rule</secondary>
9708 </indexterm>
9709 The retry section of the configuration file contains rules which affect the way
9710 Exim retries deliveries that cannot be completed at the first attempt. It is
9711 introduced by the line
9712 </para>
9713 <literallayout class="monospaced">
9714 begin retry
9715 </literallayout>
9716 <para>
9717 In the default configuration, there is just one rule, which applies to all
9718 errors:
9719 </para>
9720 <literallayout class="monospaced">
9721 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9722 </literallayout>
9723 <para>
9724 This causes any temporarily failing address to be retried every 15 minutes for
9725 2 hours, then at intervals starting at one hour and increasing by a factor of
9726 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9727 is not delivered after 4 days of temporary failure, it is bounced. The time is
9728 measured from first failure, not from the time the message was received.
9729 </para>
9730 <para>
9731 If the retry section is removed from the configuration, or is empty (that is,
9732 if no retry rules are defined), Exim will not retry deliveries. This turns
9733 temporary errors into permanent errors.
9734 </para>
9735 </section>
9736 <section id="SECID58">
9737 <title>Rewriting configuration</title>
9738 <para>
9739 The rewriting section of the configuration, introduced by
9740 </para>
9741 <literallayout class="monospaced">
9742 begin rewrite
9743 </literallayout>
9744 <para>
9745 contains rules for rewriting addresses in messages as they arrive. There are no
9746 rewriting rules in the default configuration file.
9747 </para>
9748 </section>
9749 <section id="SECTdefconfauth">
9750 <title>Authenticators configuration</title>
9751 <para>
9752 <indexterm role="concept">
9753 <primary>AUTH</primary>
9754 <secondary>configuration</secondary>
9755 </indexterm>
9756 The authenticators section of the configuration, introduced by
9757 </para>
9758 <literallayout class="monospaced">
9759 begin authenticators
9760 </literallayout>
9761 <para>
9762 defines mechanisms for the use of the SMTP AUTH command. The default
9763 configuration file contains two commented-out example authenticators
9764 which support plaintext username/password authentication using the
9765 standard PLAIN mechanism and the traditional but non-standard LOGIN
9766 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9767 to support most MUA software.
9768 </para>
9769 <para>
9770 The example PLAIN authenticator looks like this:
9771 </para>
9772 <literallayout class="monospaced">
9773 #PLAIN:
9774 #  driver                  = plaintext
9775 #  server_set_id           = $auth2
9776 #  server_prompts          = :
9777 #  server_condition        = Authentication is not yet configured
9778 #  server_advertise_condition = ${if def:tls_in_cipher }
9779 </literallayout>
9780 <para>
9781 And the example LOGIN authenticator looks like this:
9782 </para>
9783 <literallayout class="monospaced">
9784 #LOGIN:
9785 #  driver                  = plaintext
9786 #  server_set_id           = $auth1
9787 #  server_prompts          = &lt;| Username: | Password:
9788 #  server_condition        = Authentication is not yet configured
9789 #  server_advertise_condition = ${if def:tls_in_cipher }
9790 </literallayout>
9791 <para>
9792 The <option>server_set_id</option> option makes Exim remember the authenticated username
9793 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9794 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9795 that it implements the details of the specific authentication mechanism,
9796 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9797 when Exim offers authentication to clients; in the examples, this is only
9798 when TLS or SSL has been started, so to enable the authenticators you also
9799 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9800 </para>
9801 <para>
9802 The <option>server_condition</option> setting defines how to verify that the username and
9803 password are correct. In the examples it just produces an error message.
9804 To make the authenticators work, you can use a string expansion
9805 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9806 </para>
9807 <para>
9808 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9809 usercode and password are in different positions.
9810 Chapter <xref linkend="CHAPplaintext"/> covers both.
9811 </para>
9812 <para>
9813 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9814 </para>
9815 </section>
9816 </chapter>
9817
9818 <chapter id="CHAPregexp">
9819 <title>Regular expressions</title>
9820 <para>
9821 <indexterm role="concept">
9822 <primary>regular expressions</primary>
9823 <secondary>library</secondary>
9824 </indexterm>
9825 <indexterm role="concept">
9826 <primary>PCRE</primary>
9827 </indexterm>
9828 Exim supports the use of regular expressions in many of its options. It
9829 uses the PCRE regular expression library; this provides regular expression
9830 matching that is compatible with Perl 5. The syntax and semantics of
9831 regular expressions is discussed in
9832 online Perl manpages, in
9833 many Perl reference books, and also in
9834 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9835 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9836 </para>
9837 <para>
9838 The documentation for the syntax and semantics of the regular expressions that
9839 are supported by PCRE is included in the PCRE distribution, and no further
9840 description is included here. The PCRE functions are called from Exim using
9841 the default option settings (that is, with no PCRE options set), except that
9842 the PCRE_CASELESS option is set when the matching is required to be
9843 case-insensitive.
9844 </para>
9845 <para>
9846 In most cases, when a regular expression is required in an Exim configuration,
9847 it has to start with a circumflex, in order to distinguish it from plain text
9848 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9849 second item in the colon-separated list is a regular expression.
9850 </para>
9851 <literallayout class="monospaced">
9852 domains = a.b.c : ^\\d{3} : *.y.z : ...
9853 </literallayout>
9854 <para>
9855 The doubling of the backslash is required because of string expansion that
9856 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9857 of this issue, and a way of avoiding the need for doubling backslashes. The
9858 regular expression that is eventually used in this example contains just one
9859 backslash. The circumflex is included in the regular expression, and has the
9860 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9861 matched.
9862 </para>
9863 <para>
9864 There are, however, two cases where a circumflex is not required for the
9865 recognition of a regular expression: these are the <option>match</option> condition in a
9866 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9867 these cases, the relevant string is always treated as a regular expression; if
9868 it does not start with a circumflex, the expression is not anchored, and can
9869 match anywhere in the subject string.
9870 </para>
9871 <para>
9872 In all cases, if you want a regular expression to match at the end of a string,
9873 you must code the $ metacharacter to indicate this. For example:
9874 </para>
9875 <literallayout class="monospaced">
9876 domains = ^\\d{3}\\.example
9877 </literallayout>
9878 <para>
9879 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9880 You need to use:
9881 </para>
9882 <literallayout class="monospaced">
9883 domains = ^\\d{3}\\.example\$
9884 </literallayout>
9885 <para>
9886 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9887 $ is needed because string expansion also interprets dollar characters.
9888 </para>
9889 </chapter>
9890
9891 <chapter id="CHAPfdlookup">
9892 <title>File and database lookups</title>
9893 <para>
9894 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9895 <primary>file</primary>
9896 <secondary>lookups</secondary>
9897 </indexterm>
9898 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9899 <primary>database</primary>
9900 <secondary>lookups</secondary>
9901 </indexterm>
9902 <indexterm role="concept">
9903 <primary>lookup</primary>
9904 <secondary>description of</secondary>
9905 </indexterm>
9906 Exim can be configured to look up data in files or databases as it processes
9907 messages. Two different kinds of syntax are used:
9908 </para>
9909 <orderedlist numeration="arabic">
9910 <listitem>
9911 <para>
9912 A string that is to be expanded may contain explicit lookup requests. These
9913 cause parts of the string to be replaced by data that is obtained from the
9914 lookup. Lookups of this type are conditional expansion items. Different results
9915 can be defined for the cases of lookup success and failure. See chapter
9916 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9917 The key for the lookup is specified as part of the string expansion.
9918 </para>
9919 </listitem>
9920 <listitem>
9921 <para>
9922 Lists of domains, hosts, and email addresses can contain lookup requests as a
9923 way of avoiding excessively long linear lists. In this case, the data that is
9924 returned by the lookup is often (but not always) discarded; whether the lookup
9925 succeeds or fails is what really counts. These kinds of list are described in
9926 chapter <xref linkend="CHAPdomhosaddlists"/>.
9927 The key for the lookup is given by the context in which the list is expanded.
9928 </para>
9929 </listitem>
9930 </orderedlist>
9931 <para>
9932 String expansions, lists, and lookups interact with each other in such a way
9933 that there is no order in which to describe any one of them that does not
9934 involve references to the others. Each of these three chapters makes more sense
9935 if you have read the other two first. If you are reading this for the first
9936 time, be aware that some of it will make a lot more sense after you have read
9937 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9938 </para>
9939 <section id="SECID60">
9940 <title>Examples of different lookup syntax</title>
9941 <para>
9942 It is easy to confuse the two different kinds of lookup, especially as the
9943 lists that may contain the second kind are always expanded before being
9944 processed as lists. Therefore, they may also contain lookups of the first kind.
9945 Be careful to distinguish between the following two examples:
9946 </para>
9947 <literallayout class="monospaced">
9948 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9949 domains = lsearch;/some/file
9950 </literallayout>
9951 <para>
9952 The first uses a string expansion, the result of which must be a domain list.
9953 No strings have been specified for a successful or a failing lookup; the
9954 defaults in this case are the looked-up data and an empty string, respectively.
9955 The expansion takes place before the string is processed as a list, and the
9956 file that is searched could contain lines like this:
9957 </para>
9958 <literallayout class="monospaced">
9959 192.168.3.4: domain1:domain2:...
9960 192.168.1.9: domain3:domain4:...
9961 </literallayout>
9962 <para>
9963 When the lookup succeeds, the result of the expansion is a list of domains (and
9964 possibly other types of item that are allowed in domain lists).
9965 <indexterm role="concept">
9966 <primary>tainted data</primary>
9967 <secondary>de-tainting</secondary>
9968 </indexterm>
9969 The result of the expansion is not tainted.
9970 </para>
9971 <para>
9972 In the second example, the lookup is a single item in a domain list. It causes
9973 Exim to use a lookup to see if the domain that is being processed can be found
9974 in the file. The file could contains lines like this:
9975 </para>
9976 <literallayout class="monospaced">
9977 domain1:
9978 domain2:
9979 </literallayout>
9980 <para>
9981 Any data that follows the keys is not relevant when checking that the domain
9982 matches the list item.
9983 </para>
9984 <para>
9985 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9986 Consider a file containing lines like this:
9987 </para>
9988 <literallayout class="monospaced">
9989 192.168.5.6: lsearch;/another/file
9990 </literallayout>
9991 <para>
9992 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9993 first <option>domains</option> setting above generates the second setting, which therefore
9994 causes a second lookup to occur.
9995 </para>
9996 <para revisionflag="changed">
9997 The lookup type may optionally be followed by a comma
9998 and a comma-separated list of options.
9999 Each option is a <quote>name=value</quote> pair.
10000 Whether an option is meaningful depands on the lookup type.
10001 </para>
10002 <para>
10003 The rest of this chapter describes the different lookup types that are
10004 available. Any of them can be used in any part of the configuration where a
10005 lookup is permitted.
10006 </para>
10007 </section>
10008 <section id="SECID61">
10009 <title>Lookup types</title>
10010 <para>
10011 <indexterm role="concept">
10012 <primary>lookup</primary>
10013 <secondary>types of</secondary>
10014 </indexterm>
10015 <indexterm role="concept">
10016 <primary>single-key lookup</primary>
10017 <secondary>definition of</secondary>
10018 </indexterm>
10019 Two different types of data lookup are implemented:
10020 </para>
10021 <itemizedlist>
10022 <listitem>
10023 <para>
10024 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
10025 and a single key to search for. The key must be a non-empty string for the
10026 lookup to succeed. The lookup type determines how the file is searched.
10027 </para>
10028 <para revisionflag="changed">
10029 <indexterm role="concept">
10030 <primary>tainted data</primary>
10031 <secondary>single-key lookups</secondary>
10032 </indexterm>
10033 The file string may not be tainted
10034 </para>
10035 <para revisionflag="changed">
10036 <indexterm role="concept">
10037 <primary>tainted data</primary>
10038 <secondary>de-tainting</secondary>
10039 </indexterm>
10040 All single-key lookups support the option <quote>ret=key</quote>.
10041 If this is given and the lookup
10042 (either underlying implementation or cached value)
10043 returns data, the result is replaced with a non-tainted
10044 version of the lookup key.
10045 </para>
10046 </listitem>
10047 <listitem>
10048 <para>
10049 <indexterm role="concept">
10050 <primary>query-style lookup</primary>
10051 <secondary>definition of</secondary>
10052 </indexterm>
10053 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
10054 key value is assumed by Exim for query-style lookups. You can use whichever
10055 Exim variables you need to construct the database query.
10056 </para>
10057 </listitem>
10058 </itemizedlist>
10059 <para>
10060 The code for each lookup type is in a separate source file that is included in
10061 the binary of Exim only if the corresponding compile-time option is set. The
10062 default settings in <filename>src/EDITME</filename> are:
10063 </para>
10064 <literallayout class="monospaced">
10065 LOOKUP_DBM=yes
10066 LOOKUP_LSEARCH=yes
10067 </literallayout>
10068 <para>
10069 which means that only linear searching and DBM lookups are included by default.
10070 For some types of lookup (e.g. SQL databases), you need to install appropriate
10071 libraries and header files before building Exim.
10072 </para>
10073 </section>
10074 <section id="SECTsinglekeylookups">
10075 <title>Single-key lookup types</title>
10076 <para>
10077 <indexterm role="concept">
10078 <primary>lookup</primary>
10079 <secondary>single-key types</secondary>
10080 </indexterm>
10081 <indexterm role="concept">
10082 <primary>single-key lookup</primary>
10083 <secondary>list of types</secondary>
10084 </indexterm>
10085 The following single-key lookup types are implemented:
10086 </para>
10087 <itemizedlist>
10088 <listitem>
10089 <para>
10090 <indexterm role="concept">
10091 <primary>cdb</primary>
10092 <secondary>description of</secondary>
10093 </indexterm>
10094 <indexterm role="concept">
10095 <primary>lookup</primary>
10096 <secondary>cdb</secondary>
10097 </indexterm>
10098 <indexterm role="concept">
10099 <primary>binary zero</primary>
10100 <secondary>in lookup key</secondary>
10101 </indexterm>
10102 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
10103 string without a terminating binary zero. The cdb format is designed for
10104 indexed files that are read frequently and never updated, except by total
10105 re-creation. As such, it is particularly suitable for large files containing
10106 aliases or other indexed data referenced by an MTA. Information about cdb and
10107 tools for building the files can be found in several places:
10108 </para>
10109 <literallayout>
10110 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>
10111 <emphasis role="bold"><ulink url="https://www.corpit.ru/mjt/tinycdb.html">https://www.corpit.ru/mjt/tinycdb.html</ulink></emphasis>
10112 <emphasis role="bold"><ulink url="https://packages.debian.org/stable/utils/freecdb">https://packages.debian.org/stable/utils/freecdb</ulink></emphasis>
10113 <emphasis role="bold"><ulink url="https://github.com/philpennock/cdbtools">https://github.com/philpennock/cdbtools</ulink></emphasis> (in Go)
10114 </literallayout>
10115 <para>
10116 A cdb distribution is not needed in order to build Exim with cdb support,
10117 because the code for reading cdb files is included directly in Exim itself.
10118 However, no means of building or testing cdb files is provided with Exim, so
10119 you need to obtain a cdb distribution in order to do this.
10120 </para>
10121 </listitem>
10122 <listitem>
10123 <para>
10124 <indexterm role="concept">
10125 <primary>DBM</primary>
10126 <secondary>lookup type</secondary>
10127 </indexterm>
10128 <indexterm role="concept">
10129 <primary>lookup</primary>
10130 <secondary>dbm</secondary>
10131 </indexterm>
10132 <indexterm role="concept">
10133 <primary>binary zero</primary>
10134 <secondary>in lookup key</secondary>
10135 </indexterm>
10136 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
10137 DBM file by looking up the record with the given key. A terminating binary
10138 zero is included in the key that is passed to the DBM library. See section
10139 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
10140 </para>
10141 <para>
10142 <indexterm role="concept">
10143 <primary>Berkeley DB library</primary>
10144 <secondary>file format</secondary>
10145 </indexterm>
10146 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
10147 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
10148 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
10149 the DB_UNKNOWN option. This enables it to handle any of the types of database
10150 that the library supports, and can be useful for accessing DBM files created by
10151 other applications. (For earlier DB versions, DB_HASH is always used.)
10152 </para>
10153 </listitem>
10154 <listitem>
10155 <para>
10156 <indexterm role="concept">
10157 <primary>lookup</primary>
10158 <secondary>dbmjz</secondary>
10159 </indexterm>
10160 <indexterm role="concept">
10161 <primary>lookup</primary>
10162 <secondary>dbm &ndash; embedded NULs</secondary>
10163 </indexterm>
10164 <indexterm role="concept">
10165 <primary>sasldb2</primary>
10166 </indexterm>
10167 <indexterm role="concept">
10168 <primary>dbmjz lookup type</primary>
10169 </indexterm>
10170 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
10171 interpreted as an Exim list; the elements of the list are joined together with
10172 ASCII NUL characters to form the lookup key.  An example usage would be to
10173 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
10174 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
10175 <command>cram_md5</command> authenticator.
10176 </para>
10177 </listitem>
10178 <listitem>
10179 <para>
10180 <indexterm role="concept">
10181 <primary>lookup</primary>
10182 <secondary>dbmnz</secondary>
10183 </indexterm>
10184 <indexterm role="concept">
10185 <primary>lookup</primary>
10186 <secondary>dbm &ndash; terminating zero</secondary>
10187 </indexterm>
10188 <indexterm role="concept">
10189 <primary>binary zero</primary>
10190 <secondary>in lookup key</secondary>
10191 </indexterm>
10192 <indexterm role="concept">
10193 <primary>Courier</primary>
10194 </indexterm>
10195 <indexterm role="concept">
10196 <primary><filename>/etc/userdbshadow.dat</filename></primary>
10197 </indexterm>
10198 <indexterm role="concept">
10199 <primary>dbmnz lookup type</primary>
10200 </indexterm>
10201 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
10202 is not included in the key that is passed to the DBM library. You may need this
10203 if you want to look up data in files that are created by or shared with some
10204 other application that does not use terminating zeros. For example, you need to
10205 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
10206 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
10207 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
10208 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
10209 </para>
10210 </listitem>
10211 <listitem>
10212 <para>
10213 <indexterm role="concept">
10214 <primary>lookup</primary>
10215 <secondary>dsearch</secondary>
10216 </indexterm>
10217 <indexterm role="concept">
10218 <primary>dsearch lookup type</primary>
10219 </indexterm>
10220 <command>dsearch</command>: The given file must be an
10221 </para>
10222 <para revisionflag="changed">
10223 absolute
10224 </para>
10225 <para>
10226 directory path; this is searched for an entry
10227 whose name is the key by calling the <function>lstat()</function> function.
10228 The key may not
10229 contain any forward slash characters.
10230 If <function>lstat()</function> succeeds then so does the lookup.
10231 </para>
10232 <para revisionflag="changed">
10233 <indexterm role="concept">
10234 <primary>tainted data</primary>
10235 <secondary>dsearch result</secondary>
10236 </indexterm>
10237 The result is regarded as untainted.
10238 </para>
10239 <para revisionflag="changed">
10240 Options for the lookup can be given by appending them after the word "dsearch",
10241 separated by a comma.  Options, if present, are a comma-separated list having
10242 each element starting with a tag name and an equals.
10243 </para>
10244 <para revisionflag="changed">
10245 Two options are supported, for the return value and for filtering match
10246 candidates.
10247 The "ret" option requests an alternate result value of
10248 the entire path for the entry. Example:
10249 </para>
10250 <literallayout class="monospaced" revisionflag="changed">
10251 ${lookup {passwd} dsearch,ret=full {/etc}}
10252 </literallayout>
10253 <para revisionflag="changed">
10254 The default result is just the requested entry.
10255 The "filter" option requests that only directory entries of a given type
10256 are matched. The match value is one of "file", "dir" or "subdir" (the latter
10257 not matching "." or ".."). Example:
10258 </para>
10259 <literallayout class="monospaced" revisionflag="changed">
10260 ${lookup {passwd} dsearch,filter=file {/etc}}
10261 </literallayout>
10262 <para revisionflag="changed">
10263 The default matching is for any entry type, including directories
10264 and symlinks.
10265 </para>
10266 <para>
10267 An example of how this
10268 lookup can be used to support virtual domains is given in section
10269 <xref linkend="SECTvirtualdomains"/>.
10270 </para>
10271 </listitem>
10272 <listitem>
10273 <para>
10274 <indexterm role="concept">
10275 <primary>lookup</primary>
10276 <secondary>iplsearch</secondary>
10277 </indexterm>
10278 <indexterm role="concept">
10279 <primary>iplsearch lookup type</primary>
10280 </indexterm>
10281 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
10282 terminated by a colon or white space or the end of the line. The keys in the
10283 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
10284 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
10285 being interpreted as a key terminator. For example:
10286 </para>
10287 <literallayout class="monospaced">
10288 1.2.3.4:           data for 1.2.3.4
10289 192.168.0.0/16:    data for 192.168.0.0/16
10290 "abcd::cdab":      data for abcd::cdab
10291 "abcd:abcd::/32"   data for abcd:abcd::/32
10292 </literallayout>
10293 <para>
10294 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
10295 file is searched linearly, using the CIDR masks where present, until a matching
10296 key is found. The first key that matches is used; there is no attempt to find a
10297 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
10298 <command>iplsearch</command> is the same as for <command>lsearch</command>.
10299 </para>
10300 <para>
10301 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
10302 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10303 lookup types support only literal keys.
10304 </para>
10305 <para>
10306 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
10307 the implicit key is the host&#x2019;s IP address rather than its name (see section
10308 <xref linkend="SECThoslispatsikey"/>).
10309 </para>
10310 <para>
10311 <emphasis role="bold">Warning 3</emphasis>: Do not use an IPv4-mapped IPv6 address for a key; use the
10312 IPv4, in dotted-quad form. (Exim converts IPv4-mapped IPv6 addresses to this
10313 notation before executing the lookup.)
10314 </para>
10315 </listitem>
10316 <listitem>
10317 <para>
10318 <indexterm role="concept">
10319 <primary>lookup</primary>
10320 <secondary>json</secondary>
10321 </indexterm>
10322 <indexterm role="concept">
10323 <primary>json</primary>
10324 <secondary>lookup type</secondary>
10325 </indexterm>
10326 <indexterm role="concept">
10327 <primary>JSON</primary>
10328 <secondary>expansions</secondary>
10329 </indexterm>
10330 <command>json</command>: The given file is a text file with a JSON structure.
10331 An element of the structure is extracted, defined by the search key.
10332 The key is a list of subelement selectors
10333 (colon-separated by default but changeable in the usual way)
10334 which are applied in turn to select smaller and smaller portions
10335 of the JSON structure.
10336 If a selector is numeric, it must apply to a JSON array; the (zero-based)
10337 nunbered array element is selected.
10338 Otherwise it must apply to a JSON object; the named element is selected.
10339 The final resulting element can be a simple JSON type or a JSON object
10340 or array; for the latter two a string-representation of the JSON
10341 is returned.
10342 For elements of type string, the returned value is de-quoted.
10343 </para>
10344 </listitem>
10345 <listitem>
10346 <para>
10347 <indexterm role="concept">
10348 <primary>linear search</primary>
10349 </indexterm>
10350 <indexterm role="concept">
10351 <primary>lookup</primary>
10352 <secondary>lsearch</secondary>
10353 </indexterm>
10354 <indexterm role="concept">
10355 <primary>lsearch lookup type</primary>
10356 </indexterm>
10357 <indexterm role="concept">
10358 <primary>case sensitivity</primary>
10359 <secondary>in lsearch lookup</secondary>
10360 </indexterm>
10361 <command>lsearch</command>: The given file is a text file that is searched linearly for a
10362 line beginning with the search key, terminated by a colon or white space or the
10363 end of the line. The search is case-insensitive; that is, upper and lower case
10364 letters are treated as the same. The first occurrence of the key that is found
10365 in the file is used.
10366 </para>
10367 <para>
10368 White space between the key and the colon is permitted. The remainder of the
10369 line, with leading and trailing white space removed, is the data. This can be
10370 continued onto subsequent lines by starting them with any amount of white
10371 space, but only a single space character is included in the data at such a
10372 junction. If the data begins with a colon, the key must be terminated by a
10373 colon, for example:
10374 </para>
10375 <literallayout class="monospaced">
10376 baduser:  :fail:
10377 </literallayout>
10378 <para>
10379 Empty lines and lines beginning with # are ignored, even if they occur in the
10380 middle of an item. This is the traditional textual format of alias files. Note
10381 that the keys in an <command>lsearch</command> file are literal strings. There is no
10382 wildcarding of any kind.
10383 </para>
10384 <para>
10385 <indexterm role="concept">
10386 <primary>lookup</primary>
10387 <secondary>lsearch &ndash; colons in keys</secondary>
10388 </indexterm>
10389 <indexterm role="concept">
10390 <primary>white space</primary>
10391 <secondary>in lsearch key</secondary>
10392 </indexterm>
10393 In most <command>lsearch</command> files, keys are not required to contain colons or #
10394 characters, or white space. However, if you need this feature, it is available.
10395 If a key begins with a doublequote character, it is terminated only by a
10396 matching quote (or end of line), and the normal escaping rules apply to its
10397 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
10398 quoted keys (exactly as for unquoted keys). There is no special handling of
10399 quotes for the data part of an <command>lsearch</command> line.
10400 </para>
10401 </listitem>
10402 <listitem>
10403 <para>
10404 <indexterm role="concept">
10405 <primary>NIS lookup type</primary>
10406 </indexterm>
10407 <indexterm role="concept">
10408 <primary>lookup</primary>
10409 <secondary>NIS</secondary>
10410 </indexterm>
10411 <indexterm role="concept">
10412 <primary>binary zero</primary>
10413 <secondary>in lookup key</secondary>
10414 </indexterm>
10415 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
10416 the given key, without a terminating binary zero. There is a variant called
10417 <command>nis0</command> which does include the terminating binary zero in the key. This is
10418 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10419 aliases; the full map names must be used.
10420 </para>
10421 </listitem>
10422 <listitem>
10423 <para>
10424 <indexterm role="concept">
10425 <primary>wildlsearch lookup type</primary>
10426 </indexterm>
10427 <indexterm role="concept">
10428 <primary>lookup</primary>
10429 <secondary>wildlsearch</secondary>
10430 </indexterm>
10431 <indexterm role="concept">
10432 <primary>nwildlsearch lookup type</primary>
10433 </indexterm>
10434 <indexterm role="concept">
10435 <primary>lookup</primary>
10436 <secondary>nwildlsearch</secondary>
10437 </indexterm>
10438 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10439 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10440 the file may be wildcarded. The difference between these two lookup types is
10441 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10442 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10443 </para>
10444 <para>
10445 <indexterm role="concept">
10446 <primary>case sensitivity</primary>
10447 <secondary>in (n)wildlsearch lookup</secondary>
10448 </indexterm>
10449 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10450 file that are regular expressions can be made case-sensitive by the use of
10451 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10452 </para>
10453 <orderedlist numeration="arabic">
10454 <listitem>
10455 <para>
10456 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10457 </para>
10458 <literallayout class="monospaced">
10459     *.a.b.c       data for anything.a.b.c
10460     *fish         data for anythingfish
10461 </literallayout>
10462 </listitem>
10463 <listitem>
10464 <para>
10465 The string may begin with a circumflex to indicate a regular expression. For
10466 example, for <command>wildlsearch</command>:
10467 </para>
10468 <literallayout class="monospaced">
10469     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10470 </literallayout>
10471 <para>
10472 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10473 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10474 string-expanded, the equivalent entry is:
10475 </para>
10476 <literallayout class="monospaced">
10477     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10478 </literallayout>
10479 <para>
10480 The case-insensitive flag is set at the start of compiling the regular
10481 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10482 For example, to make the entire pattern case-sensitive:
10483 </para>
10484 <literallayout class="monospaced">
10485     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10486 </literallayout>
10487 <para>
10488 If the regular expression contains white space or colon characters, you must
10489 either quote it (see <command>lsearch</command> above), or represent these characters in other
10490 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10491 colon. This may be easier than quoting, because if you quote, you have to
10492 escape all the backslashes inside the quotes.
10493 </para>
10494 <para>
10495 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10496 match for later use, because the results of all lookups are cached. If a lookup
10497 is repeated, the result is taken from the cache, and no actual pattern matching
10498 takes place. The values of all the numeric variables are unset after a
10499 <command>(n)wildlsearch</command> match.
10500 </para>
10501 </listitem>
10502 <listitem>
10503 <para>
10504 Although I cannot see it being of much use, the general matching function that
10505 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10506 lookup name terminated by a semicolon, and followed by lookup data. For
10507 example:
10508 </para>
10509 <literallayout class="monospaced">
10510     cdb;/some/file  data for keys that match the file
10511 </literallayout>
10512 <para>
10513 The data that is obtained from the nested lookup is discarded.
10514 </para>
10515 </listitem>
10516 </orderedlist>
10517 <para>
10518 Keys that do not match any of these patterns are interpreted literally. The
10519 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10520 be followed by optional colons.
10521 </para>
10522 <para>
10523 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10524 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10525 lookup types support only literal keys.
10526 </para>
10527 </listitem>
10528 <listitem>
10529 <para>
10530 <indexterm role="concept">
10531 <primary>spf lookup type</primary>
10532 </indexterm>
10533 <indexterm role="concept">
10534 <primary>lookup</primary>
10535 <secondary>spf</secondary>
10536 </indexterm>
10537 <command>spf</command>: If Exim is built with SPF support, manual lookups can be done
10538 (as opposed to the standard ACL condition method).
10539 For details see section <xref linkend="SECSPF"/>.
10540 </para>
10541 </listitem>
10542 </itemizedlist>
10543 </section>
10544 <section id="SECTquerystylelookups">
10545 <title>Query-style lookup types</title>
10546 <para>
10547 <indexterm role="concept">
10548 <primary>lookup</primary>
10549 <secondary>query-style types</secondary>
10550 </indexterm>
10551 <indexterm role="concept">
10552 <primary>query-style lookup</primary>
10553 <secondary>list of types</secondary>
10554 </indexterm>
10555 The supported query-style lookup types are listed below. Further details about
10556 many of them are given in later sections.
10557 </para>
10558 <itemizedlist>
10559 <listitem>
10560 <para>
10561 <indexterm role="concept">
10562 <primary>DNS</primary>
10563 <secondary>as a lookup type</secondary>
10564 </indexterm>
10565 <indexterm role="concept">
10566 <primary>lookup</primary>
10567 <secondary>DNS</secondary>
10568 </indexterm>
10569 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10570 are given in the supplied query. The resulting data is the contents of the
10571 records. See section <xref linkend="SECTdnsdb"/>.
10572 </para>
10573 </listitem>
10574 <listitem>
10575 <para>
10576 <indexterm role="concept">
10577 <primary>InterBase lookup type</primary>
10578 </indexterm>
10579 <indexterm role="concept">
10580 <primary>lookup</primary>
10581 <secondary>InterBase</secondary>
10582 </indexterm>
10583 <command>ibase</command>: This does a lookup in an InterBase database.
10584 </para>
10585 </listitem>
10586 <listitem>
10587 <para>
10588 <indexterm role="concept">
10589 <primary>LDAP</primary>
10590 <secondary>lookup type</secondary>
10591 </indexterm>
10592 <indexterm role="concept">
10593 <primary>lookup</primary>
10594 <secondary>LDAP</secondary>
10595 </indexterm>
10596 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10597 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10598 that permits values from multiple entries to be returned. A third variant
10599 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10600 any attribute values. See section <xref linkend="SECTldap"/>.
10601 </para>
10602 </listitem>
10603 <listitem>
10604 <para>
10605 <indexterm role="concept">
10606 <primary>MySQL</primary>
10607 <secondary>lookup type</secondary>
10608 </indexterm>
10609 <indexterm role="concept">
10610 <primary>lookup</primary>
10611 <secondary>MySQL</secondary>
10612 </indexterm>
10613 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10614 MySQL database. See section <xref linkend="SECTsql"/>.
10615 </para>
10616 </listitem>
10617 <listitem>
10618 <para>
10619 <indexterm role="concept">
10620 <primary>NIS+ lookup type</primary>
10621 </indexterm>
10622 <indexterm role="concept">
10623 <primary>lookup</primary>
10624 <secondary>NIS+</secondary>
10625 </indexterm>
10626 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10627 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10628 </para>
10629 </listitem>
10630 <listitem>
10631 <para>
10632 <indexterm role="concept">
10633 <primary>Oracle</primary>
10634 <secondary>lookup type</secondary>
10635 </indexterm>
10636 <indexterm role="concept">
10637 <primary>lookup</primary>
10638 <secondary>Oracle</secondary>
10639 </indexterm>
10640 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10641 Oracle database. See section <xref linkend="SECTsql"/>.
10642 </para>
10643 </listitem>
10644 <listitem>
10645 <para>
10646 <indexterm role="concept">
10647 <primary>lookup</primary>
10648 <secondary>passwd</secondary>
10649 </indexterm>
10650 <indexterm role="concept">
10651 <primary>passwd lookup type</primary>
10652 </indexterm>
10653 <indexterm role="concept">
10654 <primary><filename>/etc/passwd</filename></primary>
10655 </indexterm>
10656 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10657 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10658 success, the result string is the same as you would get from an <command>lsearch</command>
10659 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10660 password value. For example:
10661 </para>
10662 <literallayout class="monospaced">
10663 *:42:42:King Rat:/home/kr:/bin/bash
10664 </literallayout>
10665 </listitem>
10666 <listitem>
10667 <para>
10668 <indexterm role="concept">
10669 <primary>PostgreSQL lookup type</primary>
10670 </indexterm>
10671 <indexterm role="concept">
10672 <primary>lookup</primary>
10673 <secondary>PostgreSQL</secondary>
10674 </indexterm>
10675 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10676 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10677 </para>
10678 </listitem>
10679 <listitem>
10680 <para>
10681 <indexterm role="concept">
10682 <primary>Redis lookup type</primary>
10683 </indexterm>
10684 <indexterm role="concept">
10685 <primary>lookup</primary>
10686 <secondary>Redis</secondary>
10687 </indexterm>
10688 <command>redis</command>: The format of the query is either a simple get or simple set,
10689 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10690 </para>
10691 </listitem>
10692 <listitem>
10693 <para>
10694 <indexterm role="concept">
10695 <primary>sqlite lookup type</primary>
10696 </indexterm>
10697 <indexterm role="concept">
10698 <primary>lookup</primary>
10699 <secondary>sqlite</secondary>
10700 </indexterm>
10701 <command>sqlite</command>: The format of the query is
10702 new
10703 an optional filename
10704 </para>
10705 <para>
10706 followed by an SQL statement
10707 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10708 </para>
10709 </listitem>
10710 <listitem>
10711 <para>
10712 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10713 not likely to be useful in normal operation.
10714 </para>
10715 </listitem>
10716 <listitem>
10717 <para>
10718 <indexterm role="concept">
10719 <primary>whoson lookup type</primary>
10720 </indexterm>
10721 <indexterm role="concept">
10722 <primary>lookup</primary>
10723 <secondary>whoson</secondary>
10724 </indexterm>
10725 <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
10726 allows a server to check whether a particular (dynamically allocated) IP
10727 address is currently allocated to a known (trusted) user and, optionally, to
10728 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10729 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10730 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10731 <quote>POP before SMTP</quote> checking using ACL statements such as
10732 </para>
10733 <literallayout class="monospaced">
10734 require condition = \
10735   ${lookup whoson {$sender_host_address}{yes}{no}}
10736 </literallayout>
10737 <para>
10738 The query consists of a single IP address. The value returned is the name of
10739 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10740 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10741 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10742 </para>
10743 </listitem>
10744 </itemizedlist>
10745 </section>
10746 <section id="SECID63">
10747 <title>Temporary errors in lookups</title>
10748 <para>
10749 <indexterm role="concept">
10750 <primary>lookup</primary>
10751 <secondary>temporary error in</secondary>
10752 </indexterm>
10753 Lookup functions can return temporary error codes if the lookup cannot be
10754 completed. For example, an SQL or LDAP database might be unavailable. For this
10755 reason, it is not advisable to use a lookup that might do this for critical
10756 options such as a list of local domains.
10757 </para>
10758 <para>
10759 When a lookup cannot be completed in a router or transport, delivery
10760 of the message (to the relevant address) is deferred, as for any other
10761 temporary error. In other circumstances Exim may assume the lookup has failed,
10762 or may give up altogether.
10763 </para>
10764 </section>
10765 <section id="SECTdefaultvaluelookups">
10766 <title>Default values in single-key lookups</title>
10767 <para>
10768 <indexterm role="concept">
10769 <primary>wildcard lookups</primary>
10770 </indexterm>
10771 <indexterm role="concept">
10772 <primary>lookup</primary>
10773 <secondary>default values</secondary>
10774 </indexterm>
10775 <indexterm role="concept">
10776 <primary>lookup</primary>
10777 <secondary>wildcard</secondary>
10778 </indexterm>
10779 <indexterm role="concept">
10780 <primary>lookup</primary>
10781 <secondary>* added to type</secondary>
10782 </indexterm>
10783 <indexterm role="concept">
10784 <primary>default</primary>
10785 <secondary>in single-key lookups</secondary>
10786 </indexterm>
10787 In this context, a <quote>default value</quote> is a value specified by the administrator
10788 that is to be used if a lookup fails.
10789 </para>
10790 <para>
10791 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10792 lookups, the facilities of the query language must be used. An attempt to
10793 specify a default for a query-style lookup provokes an error.
10794 </para>
10795 <para>
10796 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10797 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10798 provide a default value. See also the section on partial matching below.
10799 </para>
10800 <para>
10801 <indexterm role="concept">
10802 <primary>*@ with single-key lookup</primary>
10803 </indexterm>
10804 <indexterm role="concept">
10805 <primary>lookup</primary>
10806 <secondary>*@ added to type</secondary>
10807 </indexterm>
10808 <indexterm role="concept">
10809 <primary>alias file</primary>
10810 <secondary>per-domain default</secondary>
10811 </indexterm>
10812 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10813 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10814 character, a second lookup is done with everything before the last @ replaced
10815 by *. This makes it possible to provide per-domain defaults in alias files
10816 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10817 take place because there is no @ in the key), <quote>*</quote> is looked up.
10818 For example, a <command>redirect</command> router might contain:
10819 </para>
10820 <literallayout class="monospaced">
10821 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10822 </literallayout>
10823 <para>
10824 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10825 looks up these keys, in this order:
10826 </para>
10827 <literallayout class="monospaced">
10828 jane@eyre.example
10829 *@eyre.example
10830 *
10831 </literallayout>
10832 <para>
10833 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10834 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10835 complete scan is done for each key, and only if it is not found at all does
10836 Exim move on to try the next key.
10837 </para>
10838 </section>
10839 <section id="SECTpartiallookup">
10840 <title>Partial matching in single-key lookups</title>
10841 <para>
10842 <indexterm role="concept">
10843 <primary>partial matching</primary>
10844 </indexterm>
10845 <indexterm role="concept">
10846 <primary>wildcard lookups</primary>
10847 </indexterm>
10848 <indexterm role="concept">
10849 <primary>lookup</primary>
10850 <secondary>partial matching</secondary>
10851 </indexterm>
10852 <indexterm role="concept">
10853 <primary>lookup</primary>
10854 <secondary>wildcard</secondary>
10855 </indexterm>
10856 <indexterm role="concept">
10857 <primary>asterisk</primary>
10858 <secondary>in search type</secondary>
10859 </indexterm>
10860 The normal operation of a single-key lookup is to search the file for an exact
10861 match with the given key. However, in a number of situations where domains are
10862 being looked up, it is useful to be able to do partial matching. In this case,
10863 information in the file that has a key starting with <quote>*.</quote> is matched by any
10864 domain that ends with the components that follow the full stop. For example, if
10865 a key in a DBM file is
10866 </para>
10867 <literallayout class="monospaced">
10868 *.dates.fict.example
10869 </literallayout>
10870 <para>
10871 then when partial matching is enabled this is matched by (amongst others)
10872 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10873 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10874 file.
10875 </para>
10876 <para>
10877 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10878 also not available for any lookup items in address lists (see section
10879 <xref linkend="SECTaddresslist"/>).
10880 </para>
10881 <para>
10882 Partial matching is implemented by doing a series of separate lookups using
10883 keys constructed by modifying the original subject key. This means that it can
10884 be used with any of the single-key lookup types, provided that
10885 partial matching keys
10886 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10887 Keys in the file that do not begin with the prefix are matched only by
10888 unmodified subject keys when partial matching is in use.
10889 </para>
10890 <para>
10891 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10892 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10893 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10894 is added at the start of the subject key, and it is looked up again. If that
10895 fails, further lookups are tried with dot-separated components removed from the
10896 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10897 remains.
10898 </para>
10899 <para>
10900 A minimum number of two non-* components are required. This can be adjusted
10901 by including a number before the hyphen in the search type. For example,
10902 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10903 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10904 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10905 up when the minimum number of non-* components is two:
10906 </para>
10907 <literallayout class="monospaced">
10908 2250.dates.fict.example
10909 *.2250.dates.fict.example
10910 *.dates.fict.example
10911 *.fict.example
10912 </literallayout>
10913 <para>
10914 As soon as one key in the sequence is successfully looked up, the lookup
10915 finishes.
10916 </para>
10917 <para>
10918 <indexterm role="concept">
10919 <primary>lookup</primary>
10920 <secondary>partial matching &ndash; changing prefix</secondary>
10921 </indexterm>
10922 <indexterm role="concept">
10923 <primary>prefix</primary>
10924 <secondary>for partial matching</secondary>
10925 </indexterm>
10926 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10927 changed. The motivation for this feature is to allow Exim to operate with file
10928 formats that are used by other MTAs. A different prefix can be supplied in
10929 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10930 </para>
10931 <literallayout class="monospaced">
10932 domains = partial(.)lsearch;/some/file
10933 </literallayout>
10934 <para>
10935 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10936 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10937 components is unchanged). The prefix may consist of any punctuation characters
10938 other than a closing parenthesis. It may be empty, for example:
10939 </para>
10940 <literallayout class="monospaced">
10941 domains = partial1()cdb;/some/file
10942 </literallayout>
10943 <para>
10944 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10945 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10946 </para>
10947 <para>
10948 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10949 just one non-wild component has failed, and the original key is shortened right
10950 down to the null string) depends on the prefix:
10951 </para>
10952 <itemizedlist>
10953 <listitem>
10954 <para>
10955 If the prefix has zero length, the whole lookup fails.
10956 </para>
10957 </listitem>
10958 <listitem>
10959 <para>
10960 If the prefix has length 1, a lookup for just the prefix is done. For
10961 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10962 </para>
10963 </listitem>
10964 <listitem>
10965 <para>
10966 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10967 remainder is looked up. With the default prefix, therefore, the final lookup is
10968 for <quote>*</quote> on its own.
10969 </para>
10970 </listitem>
10971 <listitem>
10972 <para>
10973 Otherwise, the whole prefix is looked up.
10974 </para>
10975 </listitem>
10976 </itemizedlist>
10977 <para>
10978 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10979 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10980 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10981 specified, adding <quote>*</quote> to the search type has no effect with the default
10982 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10983 lookups. However, there might be a use for lookup types such as
10984 <quote>partial0(.)lsearch*</quote>.
10985 </para>
10986 <para>
10987 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10988 in domain lists and the like. Partial matching works only in terms of
10989 dot-separated components; a key such as <literal>*fict.example</literal>
10990 in a database file is useless, because the asterisk in a partial matching
10991 subject key is always followed by a dot.
10992 </para>
10993 </section>
10994 <section id="SECID64">
10995 <title>Lookup caching</title>
10996 <para>
10997 <indexterm role="concept">
10998 <primary>lookup</primary>
10999 <secondary>caching</secondary>
11000 </indexterm>
11001 <indexterm role="concept">
11002 <primary>caching</primary>
11003 <secondary>lookup data</secondary>
11004 </indexterm>
11005 Exim caches all lookup results in order to avoid needless repetition of
11006 lookups. However, because (apart from the daemon) Exim operates as a collection
11007 of independent, short-lived processes, this caching applies only within a
11008 single Exim process. There is no inter-process lookup caching facility.
11009 </para>
11010 <para>
11011 For single-key lookups, Exim keeps the relevant files open in case there is
11012 another lookup that needs them. In some types of configuration this can lead to
11013 many files being kept open for messages with many recipients. To avoid hitting
11014 the operating system limit on the number of simultaneously open files, Exim
11015 closes the least recently used file when it needs to open more files than its
11016 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
11017 </para>
11018 <para>
11019 The single-key lookup files are closed and the lookup caches are flushed at
11020 strategic points during delivery &ndash; for example, after all routing is
11021 complete.
11022 </para>
11023 </section>
11024 <section id="SECID65">
11025 <title>Quoting lookup data</title>
11026 <para>
11027 <indexterm role="concept">
11028 <primary>lookup</primary>
11029 <secondary>quoting</secondary>
11030 </indexterm>
11031 <indexterm role="concept">
11032 <primary>quoting</primary>
11033 <secondary>in lookups</secondary>
11034 </indexterm>
11035 When data from an incoming message is included in a query-style lookup, there
11036 is the possibility of special characters in the data messing up the syntax of
11037 the query. For example, a NIS+ query that contains
11038 </para>
11039 <literallayout class="monospaced">
11040 [name=$local_part]
11041 </literallayout>
11042 <para>
11043 will be broken if the local part happens to contain a closing square bracket.
11044 For NIS+, data can be enclosed in double quotes like this:
11045 </para>
11046 <literallayout class="monospaced">
11047 [name="$local_part"]
11048 </literallayout>
11049 <para>
11050 but this still leaves the problem of a double quote in the data. The rule for
11051 NIS+ is that double quotes must be doubled. Other lookup types have different
11052 rules, and to cope with the differing requirements, an expansion operator
11053 of the following form is provided:
11054 </para>
11055 <literallayout class="monospaced">
11056 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
11057 </literallayout>
11058 <para>
11059 For example, the safest way to write the NIS+ query is
11060 </para>
11061 <literallayout class="monospaced">
11062 [name="${quote_nisplus:$local_part}"]
11063 </literallayout>
11064 <para>
11065 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
11066 operator can be used for all lookup types, but has no effect for single-key
11067 lookups, since no quoting is ever needed in their key strings.
11068 </para>
11069 </section>
11070 <section id="SECTdnsdb">
11071 <title>More about dnsdb</title>
11072 <para>
11073 <indexterm role="concept">
11074 <primary>dnsdb lookup</primary>
11075 </indexterm>
11076 <indexterm role="concept">
11077 <primary>lookup</primary>
11078 <secondary>dnsdb</secondary>
11079 </indexterm>
11080 <indexterm role="concept">
11081 <primary>DNS</primary>
11082 <secondary>as a lookup type</secondary>
11083 </indexterm>
11084 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
11085 of a record type and a domain name, separated by an equals sign. For example,
11086 an expansion string could contain:
11087 </para>
11088 <literallayout class="monospaced">
11089 ${lookup dnsdb{mx=a.b.example}{$value}fail}
11090 </literallayout>
11091 <para>
11092 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
11093 is used on its own as the result. If the lookup does not succeed, the
11094 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
11095 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
11096 </para>
11097 <para>
11098 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
11099 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
11100 If no type is given, TXT is assumed.
11101 </para>
11102 <para>
11103 For any record type, if multiple records are found, the data is returned as a
11104 concatenation, with newline as the default separator. The order, of course,
11105 depends on the DNS resolver. You can specify a different separator character
11106 between multiple records by putting a right angle-bracket followed immediately
11107 by the new separator at the start of the query. For example:
11108 </para>
11109 <literallayout class="monospaced">
11110 ${lookup dnsdb{&gt;: a=host1.example}}
11111 </literallayout>
11112 <para>
11113 It is permitted to specify a space as the separator character. Further
11114 white space is ignored.
11115 For lookup types that return multiple fields per record,
11116 an alternate field separator can be specified using a comma after the main
11117 separator character, followed immediately by the field separator.
11118 </para>
11119 <para>
11120 <indexterm role="concept">
11121 <primary>PTR record</primary>
11122 <secondary>in <command>dnsdb</command> lookup</secondary>
11123 </indexterm>
11124 When the type is PTR,
11125 the data can be an IP address, written as normal; inversion and the addition of
11126 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
11127 </para>
11128 <literallayout class="monospaced">
11129 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
11130 </literallayout>
11131 <para>
11132 If the data for a PTR record is not a syntactically valid IP address, it is not
11133 altered and nothing is added.
11134 </para>
11135 <para>
11136 <indexterm role="concept">
11137 <primary>MX record</primary>
11138 <secondary>in <command>dnsdb</command> lookup</secondary>
11139 </indexterm>
11140 <indexterm role="concept">
11141 <primary>SRV record</primary>
11142 <secondary>in <command>dnsdb</command> lookup</secondary>
11143 </indexterm>
11144 For an MX lookup, both the preference value and the host name are returned for
11145 each record, separated by a space. For an SRV lookup, the priority, weight,
11146 port, and host name are returned for each record, separated by spaces.
11147 The field separator can be modified as above.
11148 </para>
11149 <para>
11150 <indexterm role="concept">
11151 <primary>TXT record</primary>
11152 <secondary>in <command>dnsdb</command> lookup</secondary>
11153 </indexterm>
11154 <indexterm role="concept">
11155 <primary>SPF record</primary>
11156 <secondary>in <command>dnsdb</command> lookup</secondary>
11157 </indexterm>
11158 For TXT records with multiple items of data, only the first item is returned,
11159 unless a field separator is specified.
11160 To concatenate items without a separator, use a semicolon instead.
11161 For SPF records the
11162 default behaviour is to concatenate multiple items without using a separator.
11163 </para>
11164 <literallayout class="monospaced">
11165 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
11166 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
11167 ${lookup dnsdb{spf=example.org}}
11168 </literallayout>
11169 <para>
11170 It is permitted to specify a space as the separator character. Further
11171 white space is ignored.
11172 </para>
11173 <para>
11174 <indexterm role="concept">
11175 <primary>SOA record</primary>
11176 <secondary>in <command>dnsdb</command> lookup</secondary>
11177 </indexterm>
11178 For an SOA lookup, while no result is obtained the lookup is redone with
11179 successively more leading components dropped from the given domain.
11180 Only the primary-nameserver field is returned unless a field separator is
11181 specified.
11182 </para>
11183 <literallayout class="monospaced">
11184 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
11185 </literallayout>
11186 </section>
11187 <section id="SECTdnsdb_mod">
11188 <title>Dnsdb lookup modifiers</title>
11189 <para>
11190 <indexterm role="concept">
11191 <primary>dnsdb modifiers</primary>
11192 </indexterm>
11193 <indexterm role="concept">
11194 <primary>modifiers</primary>
11195 <secondary>dnsdb</secondary>
11196 </indexterm>
11197 <indexterm role="concept">
11198 <primary>options</primary>
11199 <secondary>dnsdb</secondary>
11200 </indexterm>
11201 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
11202 each followed by a comma,
11203 that may appear before the record type.
11204 </para>
11205 <para>
11206 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
11207 temporary DNS error for any of them, the behaviour is controlled by
11208 a defer-option modifier.
11209 The possible keywords are
11210 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
11211 With <quote>strict</quote> behaviour, any temporary DNS error causes the
11212 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
11213 ignored, and the behaviour is as if the DNS lookup failed to find anything.
11214 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
11215 error causes the whole lookup to defer only if none of the other lookups
11216 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
11217 </para>
11218 <literallayout class="monospaced">
11219 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
11220 ${lookup dnsdb{a=one.host.com:two.host.com}}
11221 </literallayout>
11222 <para>
11223 Thus, in the default case, as long as at least one of the DNS lookups
11224 yields some data, the lookup succeeds.
11225 </para>
11226 <para>
11227 <indexterm role="concept">
11228 <primary>DNSSEC</primary>
11229 <secondary>dns lookup</secondary>
11230 </indexterm>
11231 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
11232 The possible keywords are
11233 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
11234 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
11235 with the lookup.
11236 With <quote>strict</quote> a response from the DNS resolver that
11237 is not labelled as authenticated data
11238 is treated as equivalent to a temporary DNS error.
11239 The default is <quote>lax</quote>.
11240 </para>
11241 <para>
11242 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
11243 </para>
11244 <para>
11245 <indexterm role="concept">
11246 <primary>timeout</primary>
11247 <secondary>dns lookup</secondary>
11248 </indexterm>
11249 <indexterm role="concept">
11250 <primary>DNS</primary>
11251 <secondary>timeout</secondary>
11252 </indexterm>
11253 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
11254 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
11255 (e.g. <quote>5s</quote>).
11256 The default value is set by the main configuration option <option>dns_retrans</option>.
11257 </para>
11258 <para>
11259 Retries for the dnsdb lookup can be controlled by a retry modifier.
11260 The form if <quote>retry_VAL</quote> where VAL is an integer.
11261 The default count is set by the main configuration option <option>dns_retry</option>.
11262 </para>
11263 <para>
11264 <indexterm role="concept">
11265 <primary>caching</primary>
11266 <secondary>of dns lookup</secondary>
11267 </indexterm>
11268 <indexterm role="concept">
11269 <primary>TTL</primary>
11270 <secondary>of dns lookup</secondary>
11271 </indexterm>
11272 <indexterm role="concept">
11273 <primary>DNS</primary>
11274 <secondary>TTL</secondary>
11275 </indexterm>
11276 Dnsdb lookup results are cached within a single process (and its children).
11277 The cache entry lifetime is limited to the smallest time-to-live (TTL)
11278 value of the set of returned DNS records.
11279 </para>
11280 </section>
11281 <section id="SECID66">
11282 <title>Pseudo dnsdb record types</title>
11283 <para>
11284 <indexterm role="concept">
11285 <primary>MX record</primary>
11286 <secondary>in <command>dnsdb</command> lookup</secondary>
11287 </indexterm>
11288 By default, both the preference value and the host name are returned for
11289 each MX record, separated by a space. If you want only host names, you can use
11290 the pseudo-type MXH:
11291 </para>
11292 <literallayout class="monospaced">
11293 ${lookup dnsdb{mxh=a.b.example}}
11294 </literallayout>
11295 <para>
11296 In this case, the preference values are omitted, and just the host names are
11297 returned.
11298 </para>
11299 <para>
11300 <indexterm role="concept">
11301 <primary>name server for enclosing domain</primary>
11302 </indexterm>
11303 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
11304 records on the given domain, but if none are found, it removes the first
11305 component of the domain name, and tries again. This process continues until NS
11306 records are found or there are no more components left (or there is a DNS
11307 error). In other words, it may return the name servers for a top-level domain,
11308 but it never returns the root name servers. If there are no NS records for the
11309 top-level domain, the lookup fails. Consider these examples:
11310 </para>
11311 <literallayout class="monospaced">
11312 ${lookup dnsdb{zns=xxx.quercite.com}}
11313 ${lookup dnsdb{zns=xxx.edu}}
11314 </literallayout>
11315 <para>
11316 Assuming that in each case there are no NS records for the full domain name,
11317 the first returns the name servers for <option>quercite.com</option>, and the second returns
11318 the name servers for <option>edu</option>.
11319 </para>
11320 <para>
11321 You should be careful about how you use this lookup because, unless the
11322 top-level domain does not exist, the lookup always returns some host names. The
11323 sort of use to which this might be put is for seeing if the name servers for a
11324 given domain are on a blacklist. You can probably assume that the name servers
11325 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
11326 such a list.
11327 </para>
11328 <para>
11329 <indexterm role="concept">
11330 <primary>CSA</primary>
11331 <secondary>in <command>dnsdb</command> lookup</secondary>
11332 </indexterm>
11333 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
11334 records according to the CSA rules, which are described in section
11335 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
11336 not sufficient because of the extra parent domain search behaviour of CSA. The
11337 result of a successful lookup such as:
11338 </para>
11339 <literallayout class="monospaced">
11340 ${lookup dnsdb {csa=$sender_helo_name}}
11341 </literallayout>
11342 <para>
11343 has two space-separated fields: an authorization code and a target host name.
11344 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
11345 authorization required but absent, or <quote>?</quote> for unknown.
11346 </para>
11347 <para>
11348 <indexterm role="concept">
11349 <primary>A+</primary>
11350 <secondary>in <command>dnsdb</command> lookup</secondary>
11351 </indexterm>
11352 The pseudo-type A+ performs an AAAA
11353 and then an A lookup.  All results are returned; defer processing
11354 (see below) is handled separately for each lookup.  Example:
11355 </para>
11356 <literallayout class="monospaced">
11357 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
11358 </literallayout>
11359 </section>
11360 <section id="SECID67">
11361 <title>Multiple dnsdb lookups</title>
11362 <para>
11363 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
11364 However, you can specify a list of domains or IP addresses in a single
11365 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
11366 the default separator, but with the ability to change this. For example:
11367 </para>
11368 <literallayout class="monospaced">
11369 ${lookup dnsdb{one.domain.com:two.domain.com}}
11370 ${lookup dnsdb{a=one.host.com:two.host.com}}
11371 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
11372 </literallayout>
11373 <para>
11374 In order to retain backwards compatibility, there is one special case: if
11375 the lookup type is PTR and no change of separator is specified, Exim looks
11376 to see if the rest of the string is precisely one IPv6 address. In this
11377 case, it does not treat it as a list.
11378 </para>
11379 <para>
11380 The data from each lookup is concatenated, with newline separators by default,
11381 in the same way that multiple DNS records for a single item are handled. A
11382 different separator can be specified, as described above.
11383 </para>
11384 </section>
11385 <section id="SECTldap">
11386 <title>More about LDAP</title>
11387 <para>
11388 <indexterm role="concept">
11389 <primary>LDAP</primary>
11390 <secondary>lookup, more about</secondary>
11391 </indexterm>
11392 <indexterm role="concept">
11393 <primary>lookup</primary>
11394 <secondary>LDAP</secondary>
11395 </indexterm>
11396 <indexterm role="concept">
11397 <primary>Solaris</primary>
11398 <secondary>LDAP</secondary>
11399 </indexterm>
11400 The original LDAP implementation came from the University of Michigan; this has
11401 become <quote>Open LDAP</quote>, and there are now two different releases. Another
11402 implementation comes from Netscape, and Solaris 7 and subsequent releases
11403 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
11404 the lookup function level, their error handling is different. For this reason
11405 it is necessary to set a compile-time variable when building Exim with LDAP, to
11406 indicate which LDAP library is in use. One of the following should appear in
11407 your <filename>Local/Makefile</filename>:
11408 </para>
11409 <literallayout class="monospaced">
11410 LDAP_LIB_TYPE=UMICHIGAN
11411 LDAP_LIB_TYPE=OPENLDAP1
11412 LDAP_LIB_TYPE=OPENLDAP2
11413 LDAP_LIB_TYPE=NETSCAPE
11414 LDAP_LIB_TYPE=SOLARIS
11415 </literallayout>
11416 <para>
11417 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
11418 same interface as the University of Michigan version.
11419 </para>
11420 <para>
11421 There are three LDAP lookup types in Exim. These behave slightly differently in
11422 the way they handle the results of a query:
11423 </para>
11424 <itemizedlist>
11425 <listitem>
11426 <para>
11427 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11428 gives an error.
11429 </para>
11430 </listitem>
11431 <listitem>
11432 <para>
11433 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11434 Distinguished Name that is returned rather than any attribute values.
11435 </para>
11436 </listitem>
11437 <listitem>
11438 <para>
11439 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11440 from all of them are returned.
11441 </para>
11442 </listitem>
11443 </itemizedlist>
11444 <para>
11445 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11446 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11447 the data returned by a successful lookup is described in the next section.
11448 First we explain how LDAP queries are coded.
11449 </para>
11450 </section>
11451 <section id="SECTforldaque">
11452 <title>Format of LDAP queries</title>
11453 <para>
11454 <indexterm role="concept">
11455 <primary>LDAP</primary>
11456 <secondary>query format</secondary>
11457 </indexterm>
11458 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11459 the configuration of a <command>redirect</command> router one might have this setting:
11460 </para>
11461 <literallayout class="monospaced">
11462 data = ${lookup ldap \
11463   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11464   c=UK?mailbox?base?}}
11465 </literallayout>
11466 <para>
11467 <indexterm role="concept">
11468 <primary>LDAP</primary>
11469 <secondary>with TLS</secondary>
11470 </indexterm>
11471 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11472 secure (encrypted) LDAP connections. The second of these ensures that an
11473 encrypted TLS connection is used.
11474 </para>
11475 <para>
11476 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11477 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11478 See the <option>ldap_start_tls</option> option.
11479 </para>
11480 <para>
11481 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11482 controlled. Every part of the TLS configuration can be configured by settings in
11483 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11484 your system, some of the initialization may have required setting options in
11485 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11486 certificates. This revealed a nuance where the current UID that exim was
11487 running as could affect which config files it read. With Exim 4.83, these
11488 methods become optional, only taking effect if not specifically set in
11489 <filename>exim.conf</filename>.
11490 </para>
11491 </section>
11492 <section id="SECID68">
11493 <title>LDAP quoting</title>
11494 <para>
11495 <indexterm role="concept">
11496 <primary>LDAP</primary>
11497 <secondary>quoting</secondary>
11498 </indexterm>
11499 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11500 and the second because the LDAP query is represented as a URL. Furthermore,
11501 within an LDAP query, two different kinds of quoting are required. For this
11502 reason, there are two different LDAP-specific quoting operators.
11503 </para>
11504 <para>
11505 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11506 filter specifications. Conceptually, it first does the following conversions on
11507 the string:
11508 </para>
11509 <literallayout class="monospaced">
11510 *   =&gt;   \2A
11511 (   =&gt;   \28
11512 )   =&gt;   \29
11513 \   =&gt;   \5C
11514 </literallayout>
11515 <para>
11516 in accordance with RFC 2254. The resulting string is then quoted according
11517 to the rules for URLs, that is, all non-alphanumeric characters except
11518 </para>
11519 <literallayout class="monospaced">
11520 ! $ ' - . _ ( ) * +
11521 </literallayout>
11522 <para>
11523 are converted to their hex values, preceded by a percent sign. For example:
11524 </para>
11525 <literallayout class="monospaced">
11526 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11527 </literallayout>
11528 <para>
11529 yields
11530 </para>
11531 <literallayout class="monospaced">
11532 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11533 </literallayout>
11534 <para>
11535 Removing the URL quoting, this is (with a leading and a trailing space):
11536 </para>
11537 <literallayout class="monospaced">
11538 a\28bc\29\2A, a&lt;yz&gt;;
11539 </literallayout>
11540 <para>
11541 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11542 base DN specifications in queries. Conceptually, it first converts the string
11543 by inserting a backslash in front of any of the following characters:
11544 </para>
11545 <literallayout class="monospaced">
11546 , + " \ &lt; &gt; ;
11547 </literallayout>
11548 <para>
11549 It also inserts a backslash before any leading spaces or # characters, and
11550 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11551 is then quoted according to the rules for URLs. For example:
11552 </para>
11553 <literallayout class="monospaced">
11554 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11555 </literallayout>
11556 <para>
11557 yields
11558 </para>
11559 <literallayout class="monospaced">
11560 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11561 </literallayout>
11562 <para>
11563 Removing the URL quoting, this is (with a trailing space):
11564 </para>
11565 <literallayout class="monospaced">
11566 \ a(bc)*\, a\&lt;yz\&gt;\;\
11567 </literallayout>
11568 <para>
11569 There are some further comments about quoting in the section on LDAP
11570 authentication below.
11571 </para>
11572 </section>
11573 <section id="SECID69">
11574 <title>LDAP connections</title>
11575 <para>
11576 <indexterm role="concept">
11577 <primary>LDAP</primary>
11578 <secondary>connections</secondary>
11579 </indexterm>
11580 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11581 is in use, via a Unix domain socket. The example given above does not specify
11582 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11583 by starting it with
11584 </para>
11585 <literallayout class="monospaced">
11586 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11587 </literallayout>
11588 <para>
11589 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11590 used. When no server is specified in a query, a list of default servers is
11591 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11592 colon-separated list of servers which are tried in turn until one successfully
11593 handles a query, or there is a serious error. Successful handling either
11594 returns the requested data, or indicates that it does not exist. Serious errors
11595 are syntactical, or multiple values when only a single value is expected.
11596 Errors which cause the next server to be tried are connection failures, bind
11597 failures, and timeouts.
11598 </para>
11599 <para>
11600 For each server name in the list, a port number can be given. The standard way
11601 of specifying a host and port is to use a colon separator (RFC 1738). Because
11602 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11603 doubled. For example
11604 </para>
11605 <literallayout class="monospaced">
11606 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11607 </literallayout>
11608 <para>
11609 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11610 to the LDAP library with no server name, and the library&#x2019;s default (normally
11611 the local host) is used.
11612 </para>
11613 <para>
11614 If you are using the OpenLDAP library, you can connect to an LDAP server using
11615 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11616 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11617 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11618 not available.
11619 </para>
11620 <para>
11621 For this type of connection, instead of a host name for the server, a pathname
11622 for the socket is required, and the port number is not relevant. The pathname
11623 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11624 the query. In the former case, you can have settings such as
11625 </para>
11626 <literallayout class="monospaced">
11627 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11628 </literallayout>
11629 <para>
11630 When the pathname is given in the query, you have to escape the slashes as
11631 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11632 </para>
11633 <literallayout class="monospaced">
11634 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11635 </literallayout>
11636 <para>
11637 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11638 a pathname, it uses the Unix domain socket code, even if the query actually
11639 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11640 socket connection. This behaviour means that you can use a setting of
11641 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11642 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11643 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11644 backup host.
11645 </para>
11646 <para>
11647 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11648 specified, an error is diagnosed. However, if there are more items in
11649 <option>ldap_default_servers</option>, they are tried. In other words:
11650 </para>
11651 <itemizedlist>
11652 <listitem>
11653 <para>
11654 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11655 interface.
11656 </para>
11657 </listitem>
11658 <listitem>
11659 <para>
11660 Using <literal>ldapi</literal> with a host name causes an error.
11661 </para>
11662 </listitem>
11663 </itemizedlist>
11664 <para>
11665 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11666 <option>ldap_default_servers</option>, does whatever the library does by default.
11667 </para>
11668 </section>
11669 <section id="SECID70">
11670 <title>LDAP authentication and control information</title>
11671 <para>
11672 <indexterm role="concept">
11673 <primary>LDAP</primary>
11674 <secondary>authentication</secondary>
11675 </indexterm>
11676 The LDAP URL syntax provides no way of passing authentication and other control
11677 information to the server. To make this possible, the URL in an LDAP query may
11678 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11679 spaces. If a value contains spaces it must be enclosed in double quotes, and
11680 when double quotes are used, backslash is interpreted in the usual way inside
11681 them. The following names are recognized:
11682 </para>
11683 <literallayout>
11684 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11685 <literal>NETTIME    </literal>  set a timeout for a network operation
11686 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11687 <literal>PASS       </literal>  set the password, likewise
11688 <literal>REFERRALS  </literal>  set the referrals parameter
11689 <literal>SERVERS    </literal>  set alternate server list for this query only
11690 <literal>SIZE       </literal>  set the limit for the number of entries returned
11691 <literal>TIME       </literal>  set the maximum waiting time for a query
11692 </literallayout>
11693 <para>
11694 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11695 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11696 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11697 library from trying to follow referrals issued by the LDAP server.
11698 </para>
11699 <para>
11700 <indexterm role="concept">
11701 <primary>LDAP</primary>
11702 <secondary>timeout</secondary>
11703 </indexterm>
11704 <indexterm role="concept">
11705 <primary>timeout</primary>
11706 <secondary>LDAP lookup</secondary>
11707 </indexterm>
11708 The name CONNECT is an obsolete name for NETTIME, retained for
11709 backwards compatibility. This timeout (specified as a number of seconds) is
11710 enforced from the client end for operations that can be carried out over a
11711 network. Specifically, it applies to network connections and calls to the
11712 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11713 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11714 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11715 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11716 Netscape SDK; for OpenLDAP no action is taken.
11717 </para>
11718 <para>
11719 The TIME parameter (also a number of seconds) is passed to the server to
11720 set a server-side limit on the time taken to complete a search.
11721 </para>
11722 <para>
11723 The SERVERS parameter allows you to specify an alternate list of ldap servers
11724 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11725 default list of ldap servers, and a single lookup can specify a single ldap
11726 server to use.  But when you need to do a lookup with a list of servers that is
11727 different than the default list (maybe different order, maybe a completely
11728 different set of servers), the SERVERS parameter allows you to specify this
11729 alternate list (colon-separated).
11730 </para>
11731 <para>
11732 Here is an example of an LDAP query in an Exim lookup that uses some of these
11733 values. This is a single line, folded to fit on the page:
11734 </para>
11735 <literallayout class="monospaced">
11736 ${lookup ldap
11737   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11738   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11739   {$value}fail}
11740 </literallayout>
11741 <para>
11742 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11743 any of the auxiliary data. Exim configuration settings that include lookups
11744 which contain password information should be preceded by <quote>hide</quote> to prevent
11745 non-admin users from using the <option>-bP</option> option to see their values.
11746 </para>
11747 <para>
11748 The auxiliary data items may be given in any order. The default is no
11749 connection timeout (the system timeout is used), no user or password, no limit
11750 on the number of entries returned, and no time limit on queries.
11751 </para>
11752 <para>
11753 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11754 removes any URL quoting that it may contain before passing it LDAP. Apparently
11755 some libraries do this for themselves, but some do not. Removing the URL
11756 quoting has two advantages:
11757 </para>
11758 <itemizedlist>
11759 <listitem>
11760 <para>
11761 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11762 DNs as with DNs inside actual queries.
11763 </para>
11764 </listitem>
11765 <listitem>
11766 <para>
11767 It permits spaces inside USER= DNs.
11768 </para>
11769 </listitem>
11770 </itemizedlist>
11771 <para>
11772 For example, a setting such as
11773 </para>
11774 <literallayout class="monospaced">
11775 USER=cn=${quote_ldap_dn:$1}
11776 </literallayout>
11777 <para>
11778 should work even if <varname>$1</varname> contains spaces.
11779 </para>
11780 <para>
11781 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11782 expansion operator, rather than the LDAP quote operators. The only reason this
11783 field needs quoting is to ensure that it conforms to the Exim syntax, which
11784 does not allow unquoted spaces. For example:
11785 </para>
11786 <literallayout class="monospaced">
11787 PASS=${quote:$3}
11788 </literallayout>
11789 <para>
11790 The LDAP authentication mechanism can be used to check passwords as part of
11791 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11792 <xref linkend="CHAPexpand"/>.
11793 </para>
11794 </section>
11795 <section id="SECID71">
11796 <title>Format of data returned by LDAP</title>
11797 <para>
11798 <indexterm role="concept">
11799 <primary>LDAP</primary>
11800 <secondary>returned data formats</secondary>
11801 </indexterm>
11802 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11803 as a sequence of values, for example
11804 </para>
11805 <literallayout class="monospaced">
11806 cn=manager,o=University of Cambridge,c=UK
11807 </literallayout>
11808 <para>
11809 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11810 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11811 the result between the data from different entries. It is possible for multiple
11812 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11813 you know that whatever values are returned all came from a single entry in the
11814 directory.
11815 </para>
11816 <para>
11817 In the common case where you specify a single attribute in your LDAP query, the
11818 result is not quoted, and does not contain the attribute name. If the attribute
11819 has multiple values, they are separated by commas. Any comma that is
11820 part of an attribute&#x2019;s value is doubled.
11821 </para>
11822 <para>
11823 If you specify multiple attributes, the result contains space-separated, quoted
11824 strings, each preceded by the attribute name and an equals sign. Within the
11825 quotes, the quote character, backslash, and newline are escaped with
11826 backslashes, and commas are used to separate multiple values for the attribute.
11827 Any commas in attribute values are doubled
11828 (permitting treatment of the values as a comma-separated list).
11829 Apart from the escaping, the string within quotes takes the same form as the
11830 output when a single attribute is requested. Specifying no attributes is the
11831 same as specifying all of an entry&#x2019;s attributes.
11832 </para>
11833 <para>
11834 Here are some examples of the output format. The first line of each pair is an
11835 LDAP query, and the second is the data that is returned. The attribute called
11836 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11837 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11838 (they have SUP <option>attr</option> in their schema definitions).
11839 </para>
11840 <literallayout class="monospaced">
11841 ldap:///o=base?attr1?sub?(uid=fred)
11842 value1.1,value1,,2
11843
11844 ldap:///o=base?attr2?sub?(uid=fred)
11845 value two
11846
11847 ldap:///o=base?attr?sub?(uid=fred)
11848 value1.1,value1,,2,value two
11849
11850 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11851 attr1="value1.1,value1,,2" attr2="value two"
11852
11853 ldap:///o=base??sub?(uid=fred)
11854 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11855 </literallayout>
11856 <para>
11857 You can
11858 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11859 results of LDAP lookups.
11860 The <option>extract</option> operator in string expansions can be used to pick out
11861 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11862 The <option>listextract</option> operator should be used to pick out individual values
11863 of attributes, even when only a single value is expected.
11864 The doubling of embedded commas allows you to use the returned data as a
11865 comma separated list (using the "&lt;," syntax for changing the input list separator).
11866 </para>
11867 </section>
11868 <section id="SECTnisplus">
11869 <title>More about NIS+</title>
11870 <para>
11871 <indexterm role="concept">
11872 <primary>NIS+ lookup type</primary>
11873 </indexterm>
11874 <indexterm role="concept">
11875 <primary>lookup</primary>
11876 <secondary>NIS+</secondary>
11877 </indexterm>
11878 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11879 and field name. If this is given, the result of a successful query is the
11880 contents of the named field; otherwise the result consists of a concatenation
11881 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11882 values containing spaces are quoted. For example, the query
11883 </para>
11884 <literallayout class="monospaced">
11885 [name=mg1456],passwd.org_dir
11886 </literallayout>
11887 <para>
11888 might return the string
11889 </para>
11890 <literallayout class="monospaced">
11891 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11892 home=/home/mg1456 shell=/bin/bash shadow=""
11893 </literallayout>
11894 <para>
11895 (split over two lines here to fit on the page), whereas
11896 </para>
11897 <literallayout class="monospaced">
11898 [name=mg1456],passwd.org_dir:gcos
11899 </literallayout>
11900 <para>
11901 would just return
11902 </para>
11903 <literallayout class="monospaced">
11904 Martin Guerre
11905 </literallayout>
11906 <para>
11907 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11908 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11909 operator is to double any quote characters within the text.
11910 </para>
11911 </section>
11912 <section id="SECTsql">
11913 <title>SQL lookups</title>
11914 <para>
11915 <indexterm role="concept">
11916 <primary>SQL lookup types</primary>
11917 </indexterm>
11918 <indexterm role="concept">
11919 <primary>MySQL</primary>
11920 <secondary>lookup type</secondary>
11921 </indexterm>
11922 <indexterm role="concept">
11923 <primary>PostgreSQL lookup type</primary>
11924 </indexterm>
11925 <indexterm role="concept">
11926 <primary>lookup</primary>
11927 <secondary>MySQL</secondary>
11928 </indexterm>
11929 <indexterm role="concept">
11930 <primary>lookup</primary>
11931 <secondary>PostgreSQL</secondary>
11932 </indexterm>
11933 <indexterm role="concept">
11934 <primary>Oracle</primary>
11935 <secondary>lookup type</secondary>
11936 </indexterm>
11937 <indexterm role="concept">
11938 <primary>lookup</primary>
11939 <secondary>Oracle</secondary>
11940 </indexterm>
11941 <indexterm role="concept">
11942 <primary>InterBase lookup type</primary>
11943 </indexterm>
11944 <indexterm role="concept">
11945 <primary>lookup</primary>
11946 <secondary>InterBase</secondary>
11947 </indexterm>
11948 <indexterm role="concept">
11949 <primary>Redis lookup type</primary>
11950 </indexterm>
11951 <indexterm role="concept">
11952 <primary>lookup</primary>
11953 <secondary>Redis</secondary>
11954 </indexterm>
11955 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11956 and SQLite
11957 databases. Queries for these databases contain SQL statements, so an example
11958 might be
11959 </para>
11960 <literallayout class="monospaced">
11961 ${lookup mysql{select mailbox from users where id='userx'}\
11962   {$value}fail}
11963 </literallayout>
11964 <para>
11965 If the result of the query contains more than one field, the data for each
11966 field in the row is returned, preceded by its name, so the result of
11967 </para>
11968 <literallayout class="monospaced">
11969 ${lookup pgsql{select home,name from users where id='userx'}\
11970   {$value}}
11971 </literallayout>
11972 <para>
11973 might be
11974 </para>
11975 <literallayout class="monospaced">
11976 home=/home/userx name="Mister X"
11977 </literallayout>
11978 <para>
11979 Empty values and values containing spaces are double quoted, with embedded
11980 quotes escaped by a backslash. If the result of the query contains just one
11981 field, the value is passed back verbatim, without a field name, for example:
11982 </para>
11983 <literallayout class="monospaced">
11984 Mister X
11985 </literallayout>
11986 <para>
11987 If the result of the query yields more than one row, it is all concatenated,
11988 with a newline between the data for each row.
11989 </para>
11990 </section>
11991 <section id="SECID72">
11992 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11993 <para>
11994 <indexterm role="concept">
11995 <primary>MySQL</primary>
11996 <secondary>lookup type</secondary>
11997 </indexterm>
11998 <indexterm role="concept">
11999 <primary>PostgreSQL lookup type</primary>
12000 </indexterm>
12001 <indexterm role="concept">
12002 <primary>lookup</primary>
12003 <secondary>MySQL</secondary>
12004 </indexterm>
12005 <indexterm role="concept">
12006 <primary>lookup</primary>
12007 <secondary>PostgreSQL</secondary>
12008 </indexterm>
12009 <indexterm role="concept">
12010 <primary>Oracle</primary>
12011 <secondary>lookup type</secondary>
12012 </indexterm>
12013 <indexterm role="concept">
12014 <primary>lookup</primary>
12015 <secondary>Oracle</secondary>
12016 </indexterm>
12017 <indexterm role="concept">
12018 <primary>InterBase lookup type</primary>
12019 </indexterm>
12020 <indexterm role="concept">
12021 <primary>lookup</primary>
12022 <secondary>InterBase</secondary>
12023 </indexterm>
12024 <indexterm role="concept">
12025 <primary>Redis lookup type</primary>
12026 </indexterm>
12027 <indexterm role="concept">
12028 <primary>lookup</primary>
12029 <secondary>Redis</secondary>
12030 </indexterm>
12031 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
12032 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
12033 or <option>redis_servers</option>
12034 option (as appropriate) must be set to a colon-separated list of server
12035 information.
12036 <indexterm role="option">
12037 <primary><option>mysql_servers</option></primary>
12038 </indexterm>
12039 <indexterm role="option">
12040 <primary><option>pgsql_servers</option></primary>
12041 </indexterm>
12042 <indexterm role="option">
12043 <primary><option>oracle_servers</option></primary>
12044 </indexterm>
12045 <indexterm role="option">
12046 <primary><option>ibase_servers</option></primary>
12047 </indexterm>
12048 <indexterm role="option">
12049 <primary><option>redis_servers</option></primary>
12050 </indexterm>
12051 (For MySQL and PostgreSQL, the global option need not be set if all
12052 queries contain their own server information &ndash; see section
12053 <xref linkend="SECTspeserque"/>.)
12054 For all but Redis
12055 each item in the list is a slash-separated list of four
12056 items: host name, database name, user name, and password. In the case of
12057 Oracle, the host name field is used for the <quote>service name</quote>, and the database
12058 name field is not used and should be empty. For example:
12059 </para>
12060 <literallayout class="monospaced">
12061 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
12062 </literallayout>
12063 <para>
12064 Because password data is sensitive, you should always precede the setting with
12065 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
12066 option. Here is an example where two MySQL servers are listed:
12067 </para>
12068 <literallayout class="monospaced">
12069 hide mysql_servers = localhost/users/root/secret:\
12070                      otherhost/users/root/othersecret
12071 </literallayout>
12072 <para>
12073 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
12074 because this is a colon-separated list, the colon has to be doubled. For each
12075 query, these parameter groups are tried in order until a connection is made and
12076 a query is successfully processed. The result of a query may be that no data is
12077 found, but that is still a successful query. In other words, the list of
12078 servers provides a backup facility, not a list of different places to look.
12079 </para>
12080 <para>
12081 For Redis the global option need not be specified if all queries contain their
12082 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
12083 If specified, the option must be set to a colon-separated list of server
12084 information.
12085 Each item in the list is a slash-separated list of three items:
12086 host, database number, and password.
12087 </para>
12088 <orderedlist numeration="arabic">
12089 <listitem>
12090 <para>
12091 The host is required and may be either an IPv4 address and optional
12092 port number (separated by a colon, which needs doubling due to the
12093 higher-level list), or a Unix socket pathname enclosed in parentheses
12094 </para>
12095 </listitem>
12096 <listitem>
12097 <para>
12098 The database number is optional; if present that number is selected in the backend
12099 </para>
12100 </listitem>
12101 <listitem>
12102 <para>
12103 The password is optional; if present it is used to authenticate to the backend
12104 </para>
12105 </listitem>
12106 </orderedlist>
12107 <para>
12108 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
12109 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
12110 respectively, and the characters single-quote, double-quote, and backslash
12111 itself are escaped with backslashes.
12112 </para>
12113 <para>
12114 The <option>quote_redis</option> expansion operator
12115 escapes whitespace and backslash characters with a backslash.
12116 </para>
12117 </section>
12118 <section id="SECTspeserque">
12119 <title>Specifying the server in the query</title>
12120 <para revisionflag="changed">
12121 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
12122 it is possible to specify a list of servers with an individual query. This is
12123 done by appending a comma-separated option to the query type:
12124 </para>
12125 <literallayout revisionflag="changed">
12126 </literallayout>
12127 <para revisionflag="changed">
12128 <literal>,servers=</literal><emphasis>server1:server2:server3:...</emphasis>
12129 </para>
12130 <para>
12131 Each item in the list may take one of two forms:
12132 </para>
12133 <orderedlist numeration="arabic">
12134 <listitem>
12135 <para>
12136 If it contains no slashes it is assumed to be just a host name. The appropriate
12137 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
12138 of the same name, and the remaining parameters (database, user, password) are
12139 taken from there.
12140 </para>
12141 </listitem>
12142 <listitem>
12143 <para>
12144 If it contains any slashes, it is taken as a complete parameter set.
12145 </para>
12146 </listitem>
12147 </orderedlist>
12148 <para>
12149 The list of servers is used in exactly the same way as the global list.
12150 Once a connection to a server has happened and a query has been
12151 successfully executed, processing of the lookup ceases.
12152 </para>
12153 <para>
12154 This feature is intended for use in master/slave situations where updates
12155 are occurring and you want to update the master rather than a slave. If the
12156 master is in the list as a backup for reading, you might have a global setting
12157 like this:
12158 </para>
12159 <literallayout class="monospaced">
12160 mysql_servers = slave1/db/name/pw:\
12161                 slave2/db/name/pw:\
12162                 master/db/name/pw
12163 </literallayout>
12164 <para>
12165 In an updating lookup, you could then write:
12166 </para>
12167 <literallayout class="monospaced">
12168 ${lookup mysql,servers=master {UPDATE ...} }
12169 </literallayout>
12170 <para>
12171 That query would then be sent only to the master server. If, on the other hand,
12172 the master is not to be used for reading, and so is not present in the global
12173 option, you can still update it by a query of this form:
12174 </para>
12175 <literallayout class="monospaced">
12176 ${lookup pgsql,servers=master/db/name/pw {UPDATE ...} }
12177 </literallayout>
12178 <para revisionflag="changed">
12179 An older syntax places the servers speciification before the qury,
12180 semicolon separated:
12181 </para>
12182 <literallayout class="monospaced" revisionflag="changed">
12183 ${lookup mysql{servers=master; UPDATE ...} }
12184 </literallayout>
12185 <para revisionflag="changed">
12186 The new version avoids potential issues with tainted
12187 arguments in the query, for explicit expansion.
12188 <emphasis role="bold">Note</emphasis>: server specifications in list-style lookups are still problematic.
12189 </para>
12190 </section>
12191 <section id="SECID73">
12192 <title>Special MySQL features</title>
12193 <para>
12194 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
12195 causes a connection to the server on the local host by means of a Unix domain
12196 socket. An alternate socket can be specified in parentheses.
12197 An option group name for MySQL option files can be specified in square brackets;
12198 the default value is <quote>exim</quote>.
12199 The full syntax of each item in <option>mysql_servers</option> is:
12200 </para>
12201 <literallayout>
12202 &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;
12203 </literallayout>
12204 <para>
12205 Any of the four sub-parts of the first field can be omitted. For normal use on
12206 the local host it can be left blank or set to just <quote>localhost</quote>.
12207 </para>
12208 <para>
12209 No database need be supplied &ndash; but if it is absent here, it must be given in
12210 the queries.
12211 </para>
12212 <para>
12213 If a MySQL query is issued that does not request any data (an insert, update,
12214 or delete command), the result of the lookup is the number of rows affected.
12215 </para>
12216 <para>
12217 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
12218 anything (for example, setting a field to the value it already has), the result
12219 is zero because no rows are affected.
12220 </para>
12221 </section>
12222 <section id="SECID74">
12223 <title>Special PostgreSQL features</title>
12224 <para>
12225 PostgreSQL lookups can also use Unix domain socket connections to the database.
12226 This is usually faster and costs less CPU time than a TCP/IP connection.
12227 However it can be used only if the mail server runs on the same machine as the
12228 database server. A configuration line for PostgreSQL via Unix domain sockets
12229 looks like this:
12230 </para>
12231 <literallayout class="monospaced">
12232 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
12233 </literallayout>
12234 <para>
12235 In other words, instead of supplying a host name, a path to the socket is
12236 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
12237 visually confused with the delimiters for the other server parameters.
12238 </para>
12239 <para>
12240 If a PostgreSQL query is issued that does not request any data (an insert,
12241 update, or delete command), the result of the lookup is the number of rows
12242 affected.
12243 </para>
12244 </section>
12245 <section id="SECTsqlite">
12246 <title>More about SQLite</title>
12247 <para>
12248 <indexterm role="concept">
12249 <primary>lookup</primary>
12250 <secondary>SQLite</secondary>
12251 </indexterm>
12252 <indexterm role="concept">
12253 <primary>sqlite lookup type</primary>
12254 </indexterm>
12255 SQLite is different to the other SQL lookups because a filename is required in
12256 addition to the SQL query. An SQLite database is a single file, and there is no
12257 daemon as in the other SQL databases.
12258 </para>
12259 <para revisionflag="changed">
12260 <indexterm role="option">
12261 <primary><option>sqlite_dbfile</option></primary>
12262 </indexterm>
12263 The preferred way of specifying the file is by using the
12264 <option>sqlite_dbfile</option> option, set to
12265 an absolute path.
12266 </para>
12267 <para>
12268 A deprecated method is available, prefixing the query with the filename
12269 separated by white space.
12270 This means that the path name cannot contain white space.
12271 <indexterm role="concept">
12272 <primary>tainted data</primary>
12273 <secondary>sqlite file</secondary>
12274 </indexterm>
12275 It also means that the query cannot use any tainted values, as that taints
12276 the entire query including the filename - resulting in a refusal to open
12277 the file.
12278 </para>
12279 <para revisionflag="changed">
12280 Here is a lookup expansion example:
12281 </para>
12282 <literallayout class="monospaced" revisionflag="changed">
12283 sqlite_dbfile = /some/thing/sqlitedb
12284 ...
12285 ${lookup sqlite {select name from aliases where id='userx';}}
12286 </literallayout>
12287 <para revisionflag="changed">
12288 In a list, the syntax is similar. For example:
12289 </para>
12290 <literallayout class="monospaced" revisionflag="changed">
12291 domainlist relay_to_domains = sqlite;\
12292    select * from relays where ip='$sender_host_address';
12293 </literallayout>
12294 <para>
12295 The only character affected by the <option>quote_sqlite</option> operator is a single
12296 quote, which it doubles.
12297 </para>
12298 <para>
12299 <indexterm role="concept">
12300 <primary>timeout</primary>
12301 <secondary>SQLite</secondary>
12302 </indexterm>
12303 <indexterm role="concept">
12304 <primary>sqlite</primary>
12305 <secondary>lookup timeout</secondary>
12306 </indexterm>
12307 The SQLite library handles multiple simultaneous accesses to the database
12308 internally. Multiple readers are permitted, but only one process can
12309 update at once. Attempts to access the database while it is being updated
12310 are rejected after a timeout period, during which the SQLite library
12311 waits for the lock to be released. In Exim, the default timeout is set
12312 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
12313 option.
12314 </para>
12315 </section>
12316 <section id="SECTredis">
12317 <title>More about Redis</title>
12318 <para>
12319 <indexterm role="concept">
12320 <primary>lookup</primary>
12321 <secondary>Redis</secondary>
12322 </indexterm>
12323 <indexterm role="concept">
12324 <primary>redis lookup type</primary>
12325 </indexterm>
12326 Redis is a non-SQL database. Commands are simple get and set.
12327 Examples:
12328 </para>
12329 <literallayout class="monospaced">
12330 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
12331 ${lookup redis{get keyname}}
12332 </literallayout>
12333 <para>
12334 As of release 4.91, "lightweight" support for Redis Cluster is available.
12335 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
12336 of which must be reachable from the running exim instance. If the cluster has
12337 master/slave replication, the list must contain all the master and slave
12338 servers.
12339 </para>
12340 <para>
12341 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
12342 immediately follow the redirection but treats the response as a DEFER, moving on
12343 to the next server in the <option>redis_servers</option> list until the correct server is
12344 reached.
12345 </para>
12346 <para>
12347 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
12348 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
12349 </para>
12350 </section>
12351 </chapter>
12352
12353 <chapter id="CHAPdomhosaddlists">
12354 <title>Domain, host, address, and local part lists</title>
12355 <titleabbrev>Domain, host, and address lists</titleabbrev>
12356 <para>
12357 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
12358 <primary>lists of domains; hosts; etc.</primary>
12359 </indexterm>
12360 A number of Exim configuration options contain lists of domains, hosts,
12361 email addresses, or local parts. For example, the <option>hold_domains</option> option
12362 contains a list of domains whose delivery is currently suspended. These lists
12363 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
12364 arguments to expansion conditions such as <option>match_domain</option>.
12365 </para>
12366 <para>
12367 Each item in one of these lists is a pattern to be matched against a domain,
12368 host, email address, or local part, respectively. In the sections below, the
12369 different types of pattern for each case are described, but first we cover some
12370 general facilities that apply to all four kinds of list.
12371 </para>
12372 <para>
12373 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
12374 support all the complexity available in
12375 domain, host, address and local part lists.
12376 </para>
12377 <section id="SECTlistexpand">
12378 <title>Expansion of lists</title>
12379 <para>
12380 <indexterm role="concept">
12381 <primary>expansion</primary>
12382 <secondary>of lists</secondary>
12383 </indexterm>
12384 Each list is expanded as a single string before it is used.
12385 </para>
12386 <para>
12387 <emphasis>Exception: the router headers_remove option, where list-item
12388 splitting is done before string-expansion.</emphasis>
12389 </para>
12390 <para>
12391 The result of
12392 expansion must be a list, possibly containing empty items, which is split up
12393 into separate items for matching. By default, colon is the separator character,
12394 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
12395 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
12396 discusses the way to specify empty list items.
12397 </para>
12398 <para>
12399 If the string expansion is forced to fail, Exim behaves as if the item it is
12400 testing (domain, host, address, or local part) is not in the list. Other
12401 expansion failures cause temporary errors.
12402 </para>
12403 <para>
12404 If an item in a list is a regular expression, backslashes, dollars and possibly
12405 other special characters in the expression must be protected against
12406 misinterpretation by the string expander. The easiest way to do this is to use
12407 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
12408 expression should not be expanded. For example, in an ACL you might have:
12409 </para>
12410 <literallayout class="monospaced">
12411 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
12412                ${lookup{$domain}lsearch{/badsenders/bydomain}}
12413 </literallayout>
12414 <para>
12415 The first item is a regular expression that is protected from expansion by
12416 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
12417 senders based on the receiving domain.
12418 </para>
12419 </section>
12420 <section id="SECID76">
12421 <title>Negated items in lists</title>
12422 <para>
12423 <indexterm role="concept">
12424 <primary>list</primary>
12425 <secondary>negation</secondary>
12426 </indexterm>
12427 <indexterm role="concept">
12428 <primary>negation</primary>
12429 <secondary>in lists</secondary>
12430 </indexterm>
12431 Items in a list may be positive or negative. Negative items are indicated by a
12432 leading exclamation mark, which may be followed by optional white space. A list
12433 defines a set of items (domains, etc). When Exim processes one of these lists,
12434 it is trying to find out whether a domain, host, address, or local part
12435 (respectively) is in the set that is defined by the list. It works like this:
12436 </para>
12437 <para>
12438 The list is scanned from left to right. If a positive item is matched, the
12439 subject that is being checked is in the set; if a negative item is matched, the
12440 subject is not in the set. If the end of the list is reached without the
12441 subject having matched any of the patterns, it is in the set if the last item
12442 was a negative one, but not if it was a positive one. For example, the list in
12443 </para>
12444 <literallayout class="monospaced">
12445 domainlist relay_to_domains = !a.b.c : *.b.c
12446 </literallayout>
12447 <para>
12448 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
12449 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
12450 list is positive. However, if the setting were
12451 </para>
12452 <literallayout class="monospaced">
12453 domainlist relay_to_domains = !a.b.c
12454 </literallayout>
12455 <para>
12456 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
12457 list is negative. In other words, a list that ends with a negative item behaves
12458 as if it had an extra item <literal>:*</literal> on the end.
12459 </para>
12460 <para>
12461 Another way of thinking about positive and negative items in lists is to read
12462 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
12463 item.
12464 </para>
12465 </section>
12466 <section id="SECTfilnamlis">
12467 <title>File names in lists</title>
12468 <para>
12469 <indexterm role="concept">
12470 <primary>list</primary>
12471 <secondary>filename in</secondary>
12472 </indexterm>
12473 If an item in a domain, host, address, or local part list is an absolute
12474 filename (beginning with a slash character), each line of the file is read and
12475 processed as if it were an independent item in the list, except that further
12476 filenames are not allowed,
12477 and no expansion of the data from the file takes place.
12478 Empty lines in the file are ignored, and the file may also contain comment
12479 lines:
12480 </para>
12481 <itemizedlist>
12482 <listitem>
12483 <para>
12484 For domain and host lists, if a # character appears anywhere in a line of the
12485 file, it and all following characters are ignored.
12486 </para>
12487 </listitem>
12488 <listitem>
12489 <para>
12490 Because local parts may legitimately contain # characters, a comment in an
12491 address list or local part list file is recognized only if # is preceded by
12492 white space or the start of the line. For example:
12493 </para>
12494 <literallayout class="monospaced">
12495 not#comment@x.y.z   # but this is a comment
12496 </literallayout>
12497 </listitem>
12498 </itemizedlist>
12499 <para>
12500 Putting a filename in a list has the same effect as inserting each line of the
12501 file as an item in the list (blank lines and comments excepted). However, there
12502 is one important difference: the file is read each time the list is processed,
12503 so if its contents vary over time, Exim&#x2019;s behaviour changes.
12504 </para>
12505 <para>
12506 If a filename is preceded by an exclamation mark, the sense of any match
12507 within the file is inverted. For example, if
12508 </para>
12509 <literallayout class="monospaced">
12510 hold_domains = !/etc/nohold-domains
12511 </literallayout>
12512 <para>
12513 and the file contains the lines
12514 </para>
12515 <literallayout class="monospaced">
12516 !a.b.c
12517 *.b.c
12518 </literallayout>
12519 <para>
12520 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
12521 any domain matching <literal>*.b.c</literal> is not.
12522 </para>
12523 </section>
12524 <section id="SECID77">
12525 <title>An lsearch file is not an out-of-line list</title>
12526 <para>
12527 As will be described in the sections that follow, lookups can be used in lists
12528 to provide indexed methods of checking list membership. There has been some
12529 confusion about the way <command>lsearch</command> lookups work in lists. Because
12530 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12531 sometimes thought that it is allowed to contain wild cards and other kinds of
12532 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12533 always fixed strings, just as for any other single-key lookup type.
12534 </para>
12535 <para>
12536 If you want to use a file to contain wild-card patterns that form part of a
12537 list, just give the filename on its own, without a search type, as described
12538 in the previous section. You could also use the <command>wildlsearch</command> or
12539 <command>nwildlsearch</command>, but there is no advantage in doing this.
12540 </para>
12541 </section>
12542 <section id="SECTlistresults" revisionflag="changed">
12543 <title>Results of list checking</title>
12544 <para revisionflag="changed">
12545 The primary result of doing a list check is a truth value.
12546 In some contexts additional information is stored
12547 about the list element that matched:
12548 </para>
12549 <variablelist revisionflag="changed">
12550 <varlistentry revisionflag="changed">
12551 <term>hosts</term>
12552 <listitem>
12553 <para revisionflag="changed">
12554 A <option>hosts</option> ACL condition
12555 will store a result in the <varname>$host_data</varname> variable.
12556 </para>
12557 </listitem></varlistentry>
12558 <varlistentry revisionflag="changed">
12559 <term>local_parts</term>
12560 <listitem>
12561 <para revisionflag="changed">
12562 A <option>local_parts</option> router option or <option>local_parts</option> ACL condition
12563 will store a result in the <varname>$local_part_data</varname> variable.
12564 </para>
12565 </listitem></varlistentry>
12566 <varlistentry revisionflag="changed">
12567 <term>domains</term>
12568 <listitem>
12569 <para revisionflag="changed">
12570 A <option>domains</option> router option or <option>domains</option> ACL condition
12571 </para>
12572 </listitem></varlistentry>
12573 <varlistentry revisionflag="changed">
12574 <term>senders</term>
12575 <listitem>
12576 <para revisionflag="changed">
12577 A <option>senders</option> router option or <option>senders</option> ACL condition
12578 will store a result in the <varname>$sender_data</varname> variable.
12579 </para>
12580 </listitem></varlistentry>
12581 <varlistentry revisionflag="changed">
12582 <term>recipients</term>
12583 <listitem>
12584 <para revisionflag="changed">
12585 A <option>recipients</option> ACL condition
12586 will store a result in the <varname>$recipient_data</varname> variable.
12587 </para>
12588 </listitem></varlistentry>
12589 </variablelist>
12590 <para revisionflag="changed">
12591 The detail of the additional information depends on the
12592 type of match and is given below as the <emphasis role="bold">value</emphasis> information.
12593 </para>
12594 </section>
12595 <section id="SECTnamedlists">
12596 <title>Named lists</title>
12597 <para>
12598 <indexterm role="concept">
12599 <primary>named lists</primary>
12600 </indexterm>
12601 <indexterm role="concept">
12602 <primary>list</primary>
12603 <secondary>named</secondary>
12604 </indexterm>
12605 A list of domains, hosts, email addresses, or local parts can be given a name
12606 which is then used to refer to the list elsewhere in the configuration. This is
12607 particularly convenient if the same list is required in several different
12608 places. It also allows lists to be given meaningful names, which can improve
12609 the readability of the configuration. For example, it is conventional to define
12610 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12611 locally on a host, using a configuration line such as
12612 </para>
12613 <literallayout class="monospaced">
12614 domainlist local_domains = localhost:my.dom.example
12615 </literallayout>
12616 <para>
12617 Named lists are referenced by giving their name preceded by a plus sign, so,
12618 for example, a router that is intended to handle local domains would be
12619 configured with the line
12620 </para>
12621 <literallayout class="monospaced">
12622 domains = +local_domains
12623 </literallayout>
12624 <para>
12625 The first router in a configuration is often one that handles all domains
12626 except the local ones, using a configuration with a negated item like this:
12627 </para>
12628 <literallayout class="monospaced">
12629 dnslookup:
12630   driver = dnslookup
12631   domains = ! +local_domains
12632   transport = remote_smtp
12633   no_more
12634 </literallayout>
12635 <para>
12636 The four kinds of named list are created by configuration lines starting with
12637 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12638 respectively. Then there follows the name that you are defining, followed by an
12639 equals sign and the list itself. For example:
12640 </para>
12641 <literallayout class="monospaced">
12642 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12643 addresslist bad_senders = cdb;/etc/badsenders
12644 </literallayout>
12645 <para>
12646 A named list may refer to other named lists:
12647 </para>
12648 <literallayout class="monospaced">
12649 domainlist  dom1 = first.example : second.example
12650 domainlist  dom2 = +dom1 : third.example
12651 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12652 </literallayout>
12653 <para>
12654 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12655 effect may not be what you intended, because the negation does not propagate
12656 out to the higher level. For example, consider:
12657 </para>
12658 <literallayout class="monospaced">
12659 domainlist  dom1 = !a.b
12660 domainlist  dom2 = +dom1 : *.b
12661 </literallayout>
12662 <para>
12663 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12664 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12665 means it matches the second list as well. The effect is not the same as
12666 </para>
12667 <literallayout class="monospaced">
12668 domainlist  dom2 = !a.b : *.b
12669 </literallayout>
12670 <para>
12671 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12672 referenced lists if you can.
12673 </para>
12674 <para revisionflag="changed">
12675 <indexterm role="concept">
12676 <primary>hiding named list values</primary>
12677 </indexterm>
12678 <indexterm role="concept">
12679 <primary>named lists</primary>
12680 <secondary>hiding value of</secondary>
12681 </indexterm>
12682 Some named list definitions may contain sensitive data, for example, passwords for
12683 accessing databases. To stop non-admin users from using the <option>-bP</option> command
12684 line option to read these values, you can precede the definition with the
12685 word <quote>hide</quote>. For example:
12686 </para>
12687 <literallayout class="monospaced" revisionflag="changed">
12688 hide domainlist filter_for_domains = ldap;PASS=secret ldap::/// ...
12689 </literallayout>
12690 <para>
12691 Named lists may have a performance advantage. When Exim is routing an
12692 address or checking an incoming message, it caches the result of tests on named
12693 lists. So, if you have a setting such as
12694 </para>
12695 <literallayout class="monospaced">
12696 domains = +local_domains
12697 </literallayout>
12698 <para>
12699 on several of your routers
12700 or in several ACL statements,
12701 the actual test is done only for the first one. However, the caching works only
12702 if there are no expansions within the list itself or any sublists that it
12703 references. In other words, caching happens only for lists that are known to be
12704 the same each time they are referenced.
12705 </para>
12706 <para>
12707 By default, there may be up to 16 named lists of each type. This limit can be
12708 extended by changing a compile-time variable. The use of domain and host lists
12709 is recommended for concepts such as local domains, relay domains, and relay
12710 hosts. The default configuration is set up like this.
12711 </para>
12712 </section>
12713 <section id="SECID78">
12714 <title>Named lists compared with macros</title>
12715 <para>
12716 <indexterm role="concept">
12717 <primary>list</primary>
12718 <secondary>named compared with macro</secondary>
12719 </indexterm>
12720 <indexterm role="concept">
12721 <primary>macro</primary>
12722 <secondary>compared with named list</secondary>
12723 </indexterm>
12724 At first sight, named lists might seem to be no different from macros in the
12725 configuration file. However, macros are just textual substitutions. If you
12726 write
12727 </para>
12728 <literallayout class="monospaced">
12729 ALIST = host1 : host2
12730 auth_advertise_hosts = !ALIST
12731 </literallayout>
12732 <para>
12733 it probably won&#x2019;t do what you want, because that is exactly the same as
12734 </para>
12735 <literallayout class="monospaced">
12736 auth_advertise_hosts = !host1 : host2
12737 </literallayout>
12738 <para>
12739 Notice that the second host name is not negated. However, if you use a host
12740 list, and write
12741 </para>
12742 <literallayout class="monospaced">
12743 hostlist alist = host1 : host2
12744 auth_advertise_hosts = ! +alist
12745 </literallayout>
12746 <para>
12747 the negation applies to the whole list, and so that is equivalent to
12748 </para>
12749 <literallayout class="monospaced">
12750 auth_advertise_hosts = !host1 : !host2
12751 </literallayout>
12752 </section>
12753 <section id="SECID79">
12754 <title>Named list caching</title>
12755 <para>
12756 <indexterm role="concept">
12757 <primary>list</primary>
12758 <secondary>caching of named</secondary>
12759 </indexterm>
12760 <indexterm role="concept">
12761 <primary>caching</primary>
12762 <secondary>named lists</secondary>
12763 </indexterm>
12764 While processing a message, Exim caches the result of checking a named list if
12765 it is sure that the list is the same each time. In practice, this means that
12766 the cache operates only if the list contains no $ characters, which guarantees
12767 that it will not change when it is expanded. Sometimes, however, you may have
12768 an expanded list that you know will be the same each time within a given
12769 message. For example:
12770 </para>
12771 <literallayout class="monospaced">
12772 domainlist special_domains = \
12773            ${lookup{$sender_host_address}cdb{/some/file}}
12774 </literallayout>
12775 <para>
12776 This provides a list of domains that depends only on the sending host&#x2019;s IP
12777 address. If this domain list is referenced a number of times (for example,
12778 in several ACL lines, or in several routers) the result of the check is not
12779 cached by default, because Exim does not know that it is going to be the
12780 same list each time.
12781 </para>
12782 <para>
12783 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12784 cache the result anyway. For example:
12785 </para>
12786 <literallayout class="monospaced">
12787 domainlist_cache special_domains = ${lookup{...
12788 </literallayout>
12789 <para>
12790 If you do this, you should be absolutely sure that caching is going to do
12791 the right thing in all cases. When in doubt, leave it out.
12792 </para>
12793 </section>
12794 <section id="SECTdomainlist">
12795 <title>Domain lists</title>
12796 <para>
12797 <indexterm role="concept">
12798 <primary>domain list</primary>
12799 <secondary>patterns for</secondary>
12800 </indexterm>
12801 <indexterm role="concept">
12802 <primary>list</primary>
12803 <secondary>domain list</secondary>
12804 </indexterm>
12805 Domain lists contain patterns that are to be matched against a mail domain.
12806 The following types of item may appear in domain lists:
12807 </para>
12808 <itemizedlist>
12809 <listitem>
12810 <para>
12811 <indexterm role="concept">
12812 <primary>primary host name</primary>
12813 </indexterm>
12814 <indexterm role="concept">
12815 <primary>host name</primary>
12816 <secondary>matched in domain list</secondary>
12817 </indexterm>
12818 <indexterm role="option">
12819 <primary><option>primary_hostname</option></primary>
12820 </indexterm>
12821 <indexterm role="concept">
12822 <primary>domain list</primary>
12823 <secondary>matching primary host name</secondary>
12824 </indexterm>
12825 <indexterm role="concept">
12826 <primary>@ in a domain list</primary>
12827 </indexterm>
12828 If a pattern consists of a single @ character, it matches the local host name,
12829 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12830 possible to use the same configuration file on several different hosts that
12831 differ only in their names.
12832 </para>
12833 <para revisionflag="changed">
12834 The value for a match will be the primary host name.
12835 </para>
12836 </listitem>
12837 <listitem>
12838 <para>
12839 <indexterm role="concept">
12840 <primary>@[] in a domain list</primary>
12841 </indexterm>
12842 <indexterm role="concept">
12843 <primary>domain list</primary>
12844 <secondary>matching local IP interfaces</secondary>
12845 </indexterm>
12846 <indexterm role="concept">
12847 <primary>domain literal</primary>
12848 </indexterm>
12849 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12850 in square brackets (as in an email address that contains a domain literal), but
12851 only if that IP address is recognized as local for email routing purposes. The
12852 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12853 control which of a host&#x2019;s several IP addresses are treated as local.
12854 In today&#x2019;s Internet, the use of domain literals is controversial;
12855 see the <option>allow_domain_literals</option> main option.
12856 </para>
12857 <para revisionflag="changed">
12858 The value for a match will be the string <literal>@[]</literal>.
12859 </para>
12860 </listitem>
12861 <listitem>
12862 <para>
12863 <indexterm role="concept">
12864 <primary>@mx_any</primary>
12865 </indexterm>
12866 <indexterm role="concept">
12867 <primary>@mx_primary</primary>
12868 </indexterm>
12869 <indexterm role="concept">
12870 <primary>@mx_secondary</primary>
12871 </indexterm>
12872 <indexterm role="concept">
12873 <primary>domain list</primary>
12874 <secondary>matching MX pointers to local host</secondary>
12875 </indexterm>
12876 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12877 has an MX record pointing to the local host or to any host that is listed in
12878 <indexterm role="option">
12879 <primary><option>hosts_treat_as_local</option></primary>
12880 </indexterm>
12881 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12882 are similar, except that the first matches only when a primary MX target is the
12883 local host, and the second only when no primary MX target is the local host,
12884 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12885 preference value &ndash; there may of course be more than one of them.
12886 </para>
12887 <para>
12888 The MX lookup that takes place when matching a pattern of this type is
12889 performed with the resolver options for widening names turned off. Thus, for
12890 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12891 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12892 options of the <command>dnslookup</command> router for a discussion of domain widening.
12893 </para>
12894 <para>
12895 Sometimes you may want to ignore certain IP addresses when using one of these
12896 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12897 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12898 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12899 on a router). For example:
12900 </para>
12901 <literallayout class="monospaced">
12902 domains = @mx_any/ignore=127.0.0.1
12903 </literallayout>
12904 <para>
12905 This example matches any domain that has an MX record pointing to one of
12906 the local host&#x2019;s IP addresses other than 127.0.0.1.
12907 </para>
12908 <para>
12909 The list of IP addresses is in fact processed by the same code that processes
12910 host lists, so it may contain CIDR-coded network specifications and it may also
12911 contain negative items.
12912 </para>
12913 <para>
12914 Because the list of IP addresses is a sublist within a domain list, you have to
12915 be careful about delimiters if there is more than one address. Like any other
12916 list, the default delimiter can be changed. Thus, you might have:
12917 </para>
12918 <literallayout class="monospaced">
12919 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12920           an.other.domain : ...
12921 </literallayout>
12922 <para>
12923 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12924 involved, it is easiest to change the delimiter for the main list as well:
12925 </para>
12926 <literallayout class="monospaced">
12927 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12928           an.other.domain ? ...
12929 </literallayout>
12930 <para revisionflag="changed">
12931 The value for a match will be the list element string (starting <literal>@mx_</literal>).
12932 </para>
12933 </listitem>
12934 <listitem>
12935 <para>
12936 <indexterm role="concept">
12937 <primary>asterisk</primary>
12938 <secondary>in domain list</secondary>
12939 </indexterm>
12940 <indexterm role="concept">
12941 <primary>domain list</primary>
12942 <secondary>asterisk in</secondary>
12943 </indexterm>
12944 <indexterm role="concept">
12945 <primary>domain list</primary>
12946 <secondary>matching <quote>ends with</quote></secondary>
12947 </indexterm>
12948 If a pattern starts with an asterisk, the remaining characters of the pattern
12949 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12950 domain lists differs from its use in partial matching lookups. In a domain
12951 list, the character following the asterisk need not be a dot, whereas partial
12952 matching works only in terms of dot-separated components. For example, a domain
12953 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12954 <emphasis>cipher.key.ex</emphasis>.
12955 </para>
12956 <para revisionflag="changed">
12957 The value for a match will be the list element string (starting with the asterisk).
12958 Additionally, <varname>$0</varname> will be set to the matched string
12959 and <varname>$1</varname> to the variable portion which the asterisk matched.
12960 </para>
12961 </listitem>
12962 <listitem>
12963 <para>
12964 <indexterm role="concept">
12965 <primary>regular expressions</primary>
12966 <secondary>in domain list</secondary>
12967 </indexterm>
12968 <indexterm role="concept">
12969 <primary>domain list</primary>
12970 <secondary>matching regular expression</secondary>
12971 </indexterm>
12972 If a pattern starts with a circumflex character, it is treated as a regular
12973 expression, and matched against the domain using a regular expression matching
12974 function. The circumflex is treated as part of the regular expression.
12975 Email domains are case-independent, so this regular expression match is by
12976 default case-independent, but you can make it case-dependent by starting it
12977 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12978 are given in chapter <xref linkend="CHAPregexp"/>.
12979 </para>
12980 <para>
12981 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12982 must escape any backslash and dollar characters in the regular expression, or
12983 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12984 it is not to be expanded (unless you really do want to build a regular
12985 expression by expansion, of course).
12986 </para>
12987 <para revisionflag="changed">
12988 The value for a match will be the list element string (starting with the circumflex).
12989 Additionally, <varname>$0</varname> will be set to the string matching the regular expression,
12990 and <varname>$1</varname> (onwards) to any submatches identified by parentheses.
12991 </para>
12992 </listitem>
12993 <listitem>
12994 <para>
12995 <indexterm role="concept">
12996 <primary>lookup</primary>
12997 <secondary>in domain list</secondary>
12998 </indexterm>
12999 <indexterm role="concept">
13000 <primary>domain list</primary>
13001 <secondary>matching by lookup</secondary>
13002 </indexterm>
13003 If a pattern starts with the name of a single-key lookup type followed by a
13004 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
13005 must be a filename in a suitable format for the lookup type. For example, for
13006 <quote>cdb;</quote> it must be an absolute path:
13007 </para>
13008 <literallayout class="monospaced">
13009 domains = cdb;/etc/mail/local_domains.cdb
13010 </literallayout>
13011 <para>
13012 The appropriate type of lookup is done on the file using the domain name as the
13013 key. In most cases, the value resulting from the lookup is not used; Exim is interested
13014 only in whether or not the key is present in the file. However, when a lookup
13015 is used for the <option>domains</option> option on a router
13016 or a <option>domains</option> condition in an ACL statement, the value is preserved in the
13017 <varname>$domain_data</varname> variable and can be referred to in other router options or
13018 other statements in the same ACL.
13019 <indexterm role="concept">
13020 <primary>tainted data</primary>
13021 <secondary>de-tainting</secondary>
13022 </indexterm>
13023 The value will be untainted.
13024 </para>
13025 </listitem>
13026 <listitem>
13027 <para>
13028 Any of the single-key lookup type names may be preceded by
13029 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
13030 </para>
13031 <literallayout class="monospaced">
13032 domains = partial-dbm;/partial/domains
13033 </literallayout>
13034 <para>
13035 This causes partial matching logic to be invoked; a description of how this
13036 works is given in section <xref linkend="SECTpartiallookup"/>.
13037 </para>
13038 </listitem>
13039 <listitem>
13040 <para>
13041 <indexterm role="concept">
13042 <primary>asterisk</primary>
13043 <secondary>in lookup type</secondary>
13044 </indexterm>
13045 Any of the single-key lookup types may be followed by an asterisk. This causes
13046 a default lookup for a key consisting of a single asterisk to be done if the
13047 original lookup fails. This is not a useful feature when using a domain list to
13048 select particular domains (because any domain would match), but it might have
13049 value if the result of the lookup is being used via the <varname>$domain_data</varname>
13050 expansion variable.
13051 </para>
13052 </listitem>
13053 <listitem>
13054 <para>
13055 If the pattern starts with the name of a query-style lookup type followed by a
13056 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
13057 pattern must be an appropriate query for the lookup type, as described in
13058 chapter <xref linkend="CHAPfdlookup"/>. For example:
13059 </para>
13060 <literallayout class="monospaced">
13061 hold_domains = mysql;select domain from holdlist \
13062   where domain = '${quote_mysql:$domain}';
13063 </literallayout>
13064 <para>
13065 In most cases, the value resulting from the lookup is not used (so for an SQL query, for
13066 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
13067 whether or not the query succeeds. However, when a lookup is used for the
13068 <option>domains</option> option on a router, the value is preserved in the <varname>$domain_data</varname>
13069 variable and can be referred to in other options.
13070 <indexterm role="concept">
13071 <primary>tainted data</primary>
13072 <secondary>de-tainting</secondary>
13073 </indexterm>
13074 The value will be untainted.
13075 </para>
13076 </listitem>
13077 <listitem>
13078 <para revisionflag="changed">
13079 If the pattern starts with the name of a lookup type
13080 of either kind (single-key or query-style) it may be
13081 followed by a comma and options,
13082 The options are lookup-type specific and consist of a comma-separated list.
13083 Each item starts with a tag and and equals "=".
13084 </para>
13085 </listitem>
13086 <listitem>
13087 <para>
13088 <indexterm role="concept">
13089 <primary>domain list</primary>
13090 <secondary>matching literal domain name</secondary>
13091 </indexterm>
13092 If none of the above cases apply, a caseless textual comparison is made
13093 between the pattern and the domain.
13094 </para>
13095 <para>
13096 The value for a match will be the list element string.
13097 <indexterm role="concept">
13098 <primary>tainted data</primary>
13099 <secondary>de-tainting</secondary>
13100 </indexterm>
13101 Note that this is commonly untainted
13102 (depending on the way the list was created).
13103 This is a useful way of obtaining an untainted equivalent to
13104 the domain, for later operations.
13105 </para>
13106 </listitem>
13107 </itemizedlist>
13108 <para>
13109 Here is an example that uses several different kinds of pattern:
13110 </para>
13111 <literallayout class="monospaced">
13112 domainlist funny_domains = \
13113   @ : \
13114   lib.unseen.edu : \
13115   *.foundation.fict.example : \
13116   \N^[1-2]\d{3}\.fict\.example$\N : \
13117   partial-dbm;/opt/data/penguin/book : \
13118   nis;domains.byname : \
13119   nisplus;[name=$domain,status=local],domains.org_dir
13120 </literallayout>
13121 <para>
13122 There are obvious processing trade-offs among the various matching modes. Using
13123 an asterisk is faster than a regular expression, and listing a few names
13124 explicitly probably is too. The use of a file or database lookup is expensive,
13125 but may be the only option if hundreds of names are required. Because the
13126 patterns are tested in order, it makes sense to put the most commonly matched
13127 patterns earlier.
13128 </para>
13129 </section>
13130 <section id="SECThostlist">
13131 <title>Host lists</title>
13132 <para>
13133 <indexterm role="concept">
13134 <primary>host list</primary>
13135 <secondary>patterns in</secondary>
13136 </indexterm>
13137 <indexterm role="concept">
13138 <primary>list</primary>
13139 <secondary>host list</secondary>
13140 </indexterm>
13141 Host lists are used to control what remote hosts are allowed to do. For
13142 example, some hosts may be allowed to use the local host as a relay, and some
13143 may be permitted to use the SMTP ETRN command. Hosts can be identified in
13144 two different ways, by name or by IP address. In a host list, some types of
13145 pattern are matched to a host name, and some are matched to an IP address.
13146 You need to be particularly careful with this when single-key lookups are
13147 involved, to ensure that the right value is being used as the key.
13148 </para>
13149 </section>
13150 <section id="SECID80">
13151 <title>Special host list patterns</title>
13152 <para>
13153 <indexterm role="concept">
13154 <primary>empty item in hosts list</primary>
13155 </indexterm>
13156 <indexterm role="concept">
13157 <primary>host list</primary>
13158 <secondary>empty string in</secondary>
13159 </indexterm>
13160 If a host list item is the empty string, it matches only when no remote host is
13161 involved. This is the case when a message is being received from a local
13162 process using SMTP on the standard input, that is, when a TCP/IP connection is
13163 not used.
13164 </para>
13165 <para>
13166 <indexterm role="concept">
13167 <primary>asterisk</primary>
13168 <secondary>in host list</secondary>
13169 </indexterm>
13170 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
13171 the IP address nor the name is actually inspected.
13172 </para>
13173 </section>
13174 <section id="SECThoslispatip">
13175 <title>Host list patterns that match by IP address</title>
13176 <para>
13177 <indexterm role="concept">
13178 <primary>host list</primary>
13179 <secondary>matching IP addresses</secondary>
13180 </indexterm>
13181 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
13182 the incoming address actually appears in the IPv6 host as
13183 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
13184 list, it is converted into a traditional IPv4 address first. (Not all operating
13185 systems accept IPv4 calls on IPv6 sockets, as there have been some security
13186 concerns.)
13187 </para>
13188 <para>
13189 The following types of pattern in a host list check the remote host by
13190 inspecting its IP address:
13191 </para>
13192 <itemizedlist>
13193 <listitem>
13194 <para>
13195 If the pattern is a plain domain name (not a regular expression, not starting
13196 with *, not a lookup of any kind), Exim calls the operating system function
13197 to find the associated IP address(es). Exim uses the newer
13198 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
13199 This typically causes a forward DNS lookup of the name. The result is compared
13200 with the IP address of the subject host.
13201 </para>
13202 <para>
13203 If there is a temporary problem (such as a DNS timeout) with the host name
13204 lookup, a temporary error occurs. For example, if the list is being used in an
13205 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
13206 temporary SMTP error code. If no IP address can be found for the host name,
13207 what happens is described in section <xref linkend="SECTbehipnot"/> below.
13208 </para>
13209 </listitem>
13210 <listitem>
13211 <para>
13212 <indexterm role="concept">
13213 <primary>@ in a host list</primary>
13214 </indexterm>
13215 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
13216 domain name, as just described.
13217 </para>
13218 </listitem>
13219 <listitem>
13220 <para>
13221 If the pattern is an IP address, it is matched against the IP address of the
13222 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
13223 IPv6 addresses can be given in colon-separated format, but the colons have to
13224 be doubled so as not to be taken as item separators when the default list
13225 separator is used. IPv6 addresses are recognized even when Exim is compiled
13226 without IPv6 support. This means that if they appear in a host list on an
13227 IPv4-only host, Exim will not treat them as host names. They are just addresses
13228 that can never match a client host.
13229 </para>
13230 </listitem>
13231 <listitem>
13232 <para>
13233 <indexterm role="concept">
13234 <primary>@[] in a host list</primary>
13235 </indexterm>
13236 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
13237 the local host. For example, if the local host is an IPv4 host with one
13238 interface address 10.45.23.56, these two ACL statements have the same effect:
13239 </para>
13240 <literallayout class="monospaced">
13241 accept hosts = 127.0.0.1 : 10.45.23.56
13242 accept hosts = @[]
13243 </literallayout>
13244 </listitem>
13245 <listitem>
13246 <para>
13247 <indexterm role="concept">
13248 <primary>CIDR notation</primary>
13249 </indexterm>
13250 If the pattern is an IP address followed by a slash and a mask length (for
13251 example 10.11.42.0/24), it is matched against the IP address of the subject
13252 host under the given mask. This allows, an entire network of hosts to be
13253 included (or excluded) by a single item. The mask uses CIDR notation; it
13254 specifies the number of address bits that must match, starting from the most
13255 significant end of the address.
13256 </para>
13257 <para>
13258 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
13259 of a range of addresses. It is the number of bits in the network portion of the
13260 address. The above example specifies a 24-bit netmask, so it matches all 256
13261 addresses in the 10.11.42.0 network. An item such as
13262 </para>
13263 <literallayout class="monospaced">
13264 192.168.23.236/31
13265 </literallayout>
13266 <para>
13267 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
13268 32 for an IPv4 address is the same as no mask at all; just a single address
13269 matches.
13270 </para>
13271 <para>
13272 Here is another example which shows an IPv4 and an IPv6 network:
13273 </para>
13274 <literallayout class="monospaced">
13275 recipient_unqualified_hosts = 192.168.0.0/16: \
13276                               3ffe::ffff::836f::::/48
13277 </literallayout>
13278 <para>
13279 The doubling of list separator characters applies only when these items
13280 appear inline in a host list. It is not required when indirecting via a file.
13281 For example:
13282 </para>
13283 <literallayout class="monospaced">
13284 recipient_unqualified_hosts = /opt/exim/unqualnets
13285 </literallayout>
13286 <para>
13287 could make use of a file containing
13288 </para>
13289 <literallayout class="monospaced">
13290 172.16.0.0/12
13291 3ffe:ffff:836f::/48
13292 </literallayout>
13293 <para>
13294 to have exactly the same effect as the previous example. When listing IPv6
13295 addresses inline, it is usually more convenient to use the facility for
13296 changing separator characters. This list contains the same two networks:
13297 </para>
13298 <literallayout class="monospaced">
13299 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
13300                                  3ffe:ffff:836f::/48
13301 </literallayout>
13302 <para>
13303 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
13304 list.
13305 </para>
13306 </listitem>
13307 </itemizedlist>
13308 </section>
13309 <section id="SECThoslispatsikey">
13310 <title>Host list patterns for single-key lookups by host address</title>
13311 <para>
13312 <indexterm role="concept">
13313 <primary>host list</primary>
13314 <secondary>lookup of IP address</secondary>
13315 </indexterm>
13316 When a host is to be identified by a single-key lookup of its complete IP
13317 address, the pattern takes this form:
13318 </para>
13319 <literallayout>
13320 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
13321 </literallayout>
13322 <para>
13323 For example:
13324 </para>
13325 <literallayout class="monospaced">
13326 hosts_lookup = net-cdb;/hosts-by-ip.db
13327 </literallayout>
13328 <para>
13329 The text form of the IP address of the subject host is used as the lookup key.
13330 IPv6 addresses are converted to an unabbreviated form, using lower case
13331 letters, with dots as separators because colon is the key terminator in
13332 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
13333 quoting the keys, but this is a facility that was added later.] The data
13334 returned by the lookup is not used.
13335 </para>
13336 <para>
13337 <indexterm role="concept">
13338 <primary>IP address</primary>
13339 <secondary>masking</secondary>
13340 </indexterm>
13341 <indexterm role="concept">
13342 <primary>host list</primary>
13343 <secondary>masked IP address</secondary>
13344 </indexterm>
13345 Single-key lookups can also be performed using masked IP addresses, using
13346 patterns of this form:
13347 </para>
13348 <literallayout>
13349 <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>
13350 </literallayout>
13351 <para>
13352 For example:
13353 </para>
13354 <literallayout class="monospaced">
13355 net24-dbm;/networks.db
13356 </literallayout>
13357 <para>
13358 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
13359 length. A textual string is constructed from the masked value, followed by the
13360 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
13361 is 192.168.34.6, the key that is looked up for the above example is
13362 <quote>192.168.34.0/24</quote>.
13363 </para>
13364 <para>
13365 When an IPv6 address is converted to a string, dots are normally used instead
13366 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
13367 terminate <command>lsearch</command> keys). This was implemented some time before the ability
13368 to quote keys was made available in <command>lsearch</command> files. However, the more
13369 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
13370 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
13371 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
13372 converted using colons and not dots.
13373 In all cases except IPv4-mapped IPv6, full, unabbreviated IPv6
13374 addresses are always used.
13375 The latter are converted to IPv4 addresses, in dotted-quad form.
13376 </para>
13377 <para>
13378 Ideally, it would be nice to tidy up this anomalous situation by changing to
13379 colons in all cases, given that quoting is now available for <command>lsearch</command>.
13380 However, this would be an incompatible change that might break some existing
13381 configurations.
13382 </para>
13383 <para>
13384 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
13385 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
13386 the former case the key strings include the mask value, whereas in the latter
13387 case the IP address is used on its own.
13388 </para>
13389 </section>
13390 <section id="SECThoslispatnam">
13391 <title>Host list patterns that match by host name</title>
13392 <para>
13393 <indexterm role="concept">
13394 <primary>host</primary>
13395 <secondary>lookup failures</secondary>
13396 </indexterm>
13397 <indexterm role="concept">
13398 <primary>unknown host name</primary>
13399 </indexterm>
13400 <indexterm role="concept">
13401 <primary>host list</primary>
13402 <secondary>matching host name</secondary>
13403 </indexterm>
13404 There are several types of pattern that require Exim to know the name of the
13405 remote host. These are either wildcard patterns or lookups by name. (If a
13406 complete hostname is given without any wildcarding, it is used to find an IP
13407 address to match against, as described in section <xref linkend="SECThoslispatip"/>
13408 above.)
13409 </para>
13410 <para>
13411 If the remote host name is not already known when Exim encounters one of these
13412 patterns, it has to be found from the IP address.
13413 Although many sites on the Internet are conscientious about maintaining reverse
13414 DNS data for their hosts, there are also many that do not do this.
13415 Consequently, a name cannot always be found, and this may lead to unwanted
13416 effects. Take care when configuring host lists with wildcarded name patterns.
13417 Consider what will happen if a name cannot be found.
13418 </para>
13419 <para>
13420 Because of the problems of determining host names from IP addresses, matching
13421 against host names is not as common as matching against IP addresses.
13422 </para>
13423 <para>
13424 By default, in order to find a host name, Exim first does a reverse DNS lookup;
13425 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
13426 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
13427 are done can be changed by setting the <option>host_lookup_order</option> option. For
13428 security, once Exim has found one or more names, it looks up the IP addresses
13429 for these names and compares them with the IP address that it started with.
13430 Only those names whose IP addresses match are accepted. Any other names are
13431 discarded. If no names are left, Exim behaves as if the host name cannot be
13432 found. In the most common case there is only one name and one IP address.
13433 </para>
13434 <para>
13435 There are some options that control what happens if a host name cannot be
13436 found. These are described in section <xref linkend="SECTbehipnot"/> below.
13437 </para>
13438 <para>
13439 <indexterm role="concept">
13440 <primary>host</primary>
13441 <secondary>alias for</secondary>
13442 </indexterm>
13443 <indexterm role="concept">
13444 <primary>alias for host</primary>
13445 </indexterm>
13446 As a result of aliasing, hosts may have more than one name. When processing any
13447 of the following types of pattern, all the host&#x2019;s names are checked:
13448 </para>
13449 <itemizedlist>
13450 <listitem>
13451 <para>
13452 <indexterm role="concept">
13453 <primary>asterisk</primary>
13454 <secondary>in host list</secondary>
13455 </indexterm>
13456 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
13457 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
13458 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
13459 requirement. Other kinds of wildcarding require the use of a regular
13460 expression.
13461 </para>
13462 </listitem>
13463 <listitem>
13464 <para>
13465 <indexterm role="concept">
13466 <primary>regular expressions</primary>
13467 <secondary>in host list</secondary>
13468 </indexterm>
13469 <indexterm role="concept">
13470 <primary>host list</primary>
13471 <secondary>regular expression in</secondary>
13472 </indexterm>
13473 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
13474 matched against the host name. Host names are case-independent, so this regular
13475 expression match is by default case-independent, but you can make it
13476 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
13477 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
13478 example,
13479 </para>
13480 <literallayout class="monospaced">
13481 ^(a|b)\.c\.d$
13482 </literallayout>
13483 <para>
13484 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
13485 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
13486 that backslash and dollar characters are not misinterpreted as part of the
13487 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
13488 part of the string as non-expandable. For example:
13489 </para>
13490 <literallayout class="monospaced">
13491 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
13492 </literallayout>
13493 <para>
13494 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
13495 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
13496 example. Without it, a match at the start of the host name is all that is
13497 required.
13498 </para>
13499 </listitem>
13500 </itemizedlist>
13501 </section>
13502 <section id="SECTbehipnot">
13503 <title>Behaviour when an IP address or name cannot be found</title>
13504 <para>
13505 <indexterm role="concept">
13506 <primary>host</primary>
13507 <secondary>lookup failures, permanent</secondary>
13508 </indexterm>
13509 While processing a host list, Exim may need to look up an IP address from a
13510 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
13511 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
13512 behaviour when it fails to find the information it is seeking is the same.
13513 </para>
13514 <para>
13515 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
13516 apply to temporary DNS errors, whose handling is described in the next section.
13517 </para>
13518 <para>
13519 <indexterm role="concept">
13520 <primary><literal>+include_unknown</literal></primary>
13521 </indexterm>
13522 <indexterm role="concept">
13523 <primary><literal>+ignore_unknown</literal></primary>
13524 </indexterm>
13525 Exim parses a host list from left to right. If it encounters a permanent
13526 lookup failure in any item in the host list before it has found a match,
13527 Exim treats it as a failure and the default behavior is as if the host
13528 does not match the list. This may not always be what you want to happen.
13529 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
13530 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
13531 not recognized in an indirected file).
13532 </para>
13533 <itemizedlist>
13534 <listitem>
13535 <para>
13536 If any item that follows <literal>+include_unknown</literal> requires information that
13537 cannot found, Exim behaves as if the host does match the list. For example,
13538 </para>
13539 <literallayout class="monospaced">
13540 host_reject_connection = +include_unknown:*.enemy.ex
13541 </literallayout>
13542 <para>
13543 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
13544 any hosts whose name it cannot find.
13545 </para>
13546 </listitem>
13547 <listitem>
13548 <para>
13549 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
13550 be found, Exim ignores that item and proceeds to the rest of the list. For
13551 example:
13552 </para>
13553 <literallayout class="monospaced">
13554 accept hosts = +ignore_unknown : friend.example : \
13555                192.168.4.5
13556 </literallayout>
13557 <para>
13558 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
13559 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
13560 name can be found for 192.168.4.5, it is rejected.
13561 </para>
13562 </listitem>
13563 </itemizedlist>
13564 <para>
13565 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
13566 list. The effect of each one lasts until the next, or until the end of the
13567 list.
13568 </para>
13569 </section>
13570 <section id="SECTmixwilhos">
13571 <title>Mixing wildcarded host names and addresses in host lists</title>
13572 <para>
13573 <indexterm role="concept">
13574 <primary>host list</primary>
13575 <secondary>mixing names and addresses in</secondary>
13576 </indexterm>
13577 </para>
13578 <para>
13579 This section explains the host/ip processing logic with the same concepts
13580 as the previous section, but specifically addresses what happens when a
13581 wildcarded hostname is one of the items in the hostlist.
13582 </para>
13583 <itemizedlist>
13584 <listitem>
13585 <para>
13586 If you have name lookups or wildcarded host names and
13587 IP addresses in the same host list, you should normally put the IP
13588 addresses first. For example, in an ACL you could have:
13589 </para>
13590 <literallayout class="monospaced">
13591 accept hosts = 10.9.8.7 : *.friend.example
13592 </literallayout>
13593 <para>
13594 The reason you normally would order it this way lies in the
13595 left-to-right way that Exim processes lists.  It can test IP addresses
13596 without doing any DNS lookups, but when it reaches an item that requires
13597 a host name, it fails if it cannot find a host name to compare with the
13598 pattern. If the above list is given in the opposite order, the
13599 <option>accept</option> statement fails for a host whose name cannot be found, even
13600 if its IP address is 10.9.8.7.
13601 </para>
13602 </listitem>
13603 <listitem>
13604 <para>
13605 If you really do want to do the name check first, and still recognize the IP
13606 address, you can rewrite the ACL like this:
13607 </para>
13608 <literallayout class="monospaced">
13609 accept hosts = *.friend.example
13610 accept hosts = 10.9.8.7
13611 </literallayout>
13612 <para>
13613 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
13614 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
13615 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
13616 this section.
13617 </para>
13618 </listitem>
13619 </itemizedlist>
13620 </section>
13621 <section id="SECTtemdnserr">
13622 <title>Temporary DNS errors when looking up host information</title>
13623 <para>
13624 <indexterm role="concept">
13625 <primary>host</primary>
13626 <secondary>lookup failures, temporary</secondary>
13627 </indexterm>
13628 <indexterm role="concept">
13629 <primary><literal>+include_defer</literal></primary>
13630 </indexterm>
13631 <indexterm role="concept">
13632 <primary><literal>+ignore_defer</literal></primary>
13633 </indexterm>
13634 A temporary DNS lookup failure normally causes a defer action (except when
13635 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
13636 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
13637 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
13638 section. These options should be used with care, probably only in non-critical
13639 host lists such as whitelists.
13640 </para>
13641 </section>
13642 <section id="SECThoslispatnamsk">
13643 <title>Host list patterns for single-key lookups by host name</title>
13644 <para>
13645 <indexterm role="concept">
13646 <primary>unknown host name</primary>
13647 </indexterm>
13648 <indexterm role="concept">
13649 <primary>host list</primary>
13650 <secondary>matching host name</secondary>
13651 </indexterm>
13652 If a pattern is of the form
13653 </para>
13654 <literallayout>
13655 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
13656 </literallayout>
13657 <para>
13658 for example
13659 </para>
13660 <literallayout class="monospaced">
13661 dbm;/host/accept/list
13662 </literallayout>
13663 <para>
13664 a single-key lookup is performed, using the host name as its key. If the
13665 lookup succeeds, the host matches the item. The actual data that is looked up
13666 is not used.
13667 </para>
13668 <para>
13669 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13670 keys in the file, not IP addresses. If you want to do lookups based on IP
13671 addresses, you must precede the search type with <quote>net-</quote> (see section
13672 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13673 two items in the same list, one doing an address lookup and one doing a name
13674 lookup, both using the same file.
13675 </para>
13676 </section>
13677 <section id="SECID81">
13678 <title>Host list patterns for query-style lookups</title>
13679 <para>
13680 If a pattern is of the form
13681 </para>
13682 <literallayout>
13683 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13684 </literallayout>
13685 <para>
13686 the query is obeyed, and if it succeeds, the host matches the item. The actual
13687 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13688 <varname>$sender_host_name</varname> can be used in the query. For example:
13689 </para>
13690 <literallayout class="monospaced">
13691 hosts_lookup = pgsql;\
13692   select ip from hostlist where ip='$sender_host_address'
13693 </literallayout>
13694 <para>
13695 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13696 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13697 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13698 operator.
13699 </para>
13700 <para>
13701 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13702 looks up the host name if it has not already done so. (See section
13703 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13704 </para>
13705 <para>
13706 Historical note: prior to release 4.30, Exim would always attempt to find a
13707 host name before running the query, unless the search type was preceded by
13708 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13709 still recognized for query-style lookups, but its presence or absence has no
13710 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13711 See section <xref linkend="SECThoslispatsikey"/>.)
13712 </para>
13713 </section>
13714 <section id="SECTaddresslist">
13715 <title>Address lists</title>
13716 <para>
13717 <indexterm role="concept">
13718 <primary>list</primary>
13719 <secondary>address list</secondary>
13720 </indexterm>
13721 <indexterm role="concept">
13722 <primary>address list</primary>
13723 <secondary>empty item</secondary>
13724 </indexterm>
13725 <indexterm role="concept">
13726 <primary>address list</primary>
13727 <secondary>patterns</secondary>
13728 </indexterm>
13729 Address lists contain patterns that are matched against mail addresses. There
13730 is one special case to be considered: the sender address of a bounce message is
13731 always empty. You can test for this by providing an empty item in an address
13732 list. For example, you can set up a router to process bounce messages by
13733 using this option setting:
13734 </para>
13735 <literallayout class="monospaced">
13736 senders = :
13737 </literallayout>
13738 <para>
13739 The presence of the colon creates an empty item. If you do not provide any
13740 data, the list is empty and matches nothing. The empty sender can also be
13741 detected by a regular expression that matches an empty string,
13742 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13743 </para>
13744 <para>
13745 Non-empty items in an address list can be straightforward email addresses. For
13746 example:
13747 </para>
13748 <literallayout class="monospaced">
13749 senders = jbc@askone.example : hs@anacreon.example
13750 </literallayout>
13751 <para>
13752 A certain amount of wildcarding is permitted. If a pattern contains an @
13753 character, but is not a regular expression and does not begin with a
13754 semicolon-terminated lookup type (described below), the local part of the
13755 subject address is compared with the local part of the pattern, which may start
13756 with an asterisk. If the local parts match, the domain is checked in exactly
13757 the same way as for a pattern in a domain list. For example, the domain can be
13758 wildcarded, refer to a named list, or be a lookup:
13759 </para>
13760 <literallayout class="monospaced">
13761 deny senders = *@*.spamming.site:\
13762                *@+hostile_domains:\
13763                bozo@partial-lsearch;/list/of/dodgy/sites:\
13764                *@dbm;/bad/domains.db
13765 </literallayout>
13766 <para>
13767 <indexterm role="concept">
13768 <primary>local part</primary>
13769 <secondary>starting with !</secondary>
13770 </indexterm>
13771 <indexterm role="concept">
13772 <primary>address list</primary>
13773 <secondary>local part starting with !</secondary>
13774 </indexterm>
13775 If a local part that begins with an exclamation mark is required, it has to be
13776 specified using a regular expression, because otherwise the exclamation mark is
13777 treated as a sign of negation, as is standard in lists.
13778 </para>
13779 <para>
13780 If a non-empty pattern that is not a regular expression or a lookup does not
13781 contain an @ character, it is matched against the domain part of the subject
13782 address. The only two formats that are recognized this way are a literal
13783 domain, or a domain pattern that starts with *. In both these cases, the effect
13784 is the same as if <literal>*@</literal> preceded the pattern. For example:
13785 </para>
13786 <literallayout class="monospaced">
13787 deny senders = enemy.domain : *.enemy.domain
13788 </literallayout>
13789 <para>
13790 The following kinds of more complicated address list pattern can match any
13791 address, including the empty address that is characteristic of bounce message
13792 senders:
13793 </para>
13794 <itemizedlist>
13795 <listitem>
13796 <para>
13797 <indexterm role="concept">
13798 <primary>regular expressions</primary>
13799 <secondary>in address list</secondary>
13800 </indexterm>
13801 <indexterm role="concept">
13802 <primary>address list</primary>
13803 <secondary>regular expression in</secondary>
13804 </indexterm>
13805 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13806 done against the complete address, with the pattern as the regular expression.
13807 You must take care that backslash and dollar characters are not misinterpreted
13808 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13809 to mark that part of the string as non-expandable. For example:
13810 </para>
13811 <literallayout class="monospaced">
13812 deny senders = \N^.*this.*@example\.com$\N : \
13813                \N^\d{8}.+@spamhaus.example$\N : ...
13814 </literallayout>
13815 <para>
13816 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13817 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13818 </para>
13819 </listitem>
13820 <listitem>
13821 <para>
13822 <indexterm role="concept">
13823 <primary>address list</primary>
13824 <secondary>lookup for complete address</secondary>
13825 </indexterm>
13826 Complete addresses can be looked up by using a pattern that starts with a
13827 lookup type terminated by a semicolon, followed by the data for the lookup. For
13828 example:
13829 </para>
13830 <literallayout class="monospaced">
13831 deny senders = cdb;/etc/blocked.senders : \
13832   mysql;select address from blocked where \
13833   address='${quote_mysql:$sender_address}'
13834 </literallayout>
13835 <para>
13836 Both query-style and single-key lookup types can be used. For a single-key
13837 lookup type, Exim uses the complete address as the key. However, empty keys are
13838 not supported for single-key lookups, so a match against the empty address
13839 always fails. This restriction does not apply to query-style lookups.
13840 </para>
13841 <para>
13842 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13843 cannot be used, and is ignored if specified, with an entry being written to the
13844 panic log.
13845 <indexterm role="concept">
13846 <primary>*@ with single-key lookup</primary>
13847 </indexterm>
13848 However, you can configure lookup defaults, as described in section
13849 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13850 default. For example, with this lookup:
13851 </para>
13852 <literallayout class="monospaced">
13853 accept senders = lsearch*@;/some/file
13854 </literallayout>
13855 <para>
13856 the file could contains lines like this:
13857 </para>
13858 <literallayout class="monospaced">
13859 user1@domain1.example
13860 *@domain2.example
13861 </literallayout>
13862 <para>
13863 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13864 that are tried is:
13865 </para>
13866 <literallayout class="monospaced">
13867 nimrod@jaeger.example
13868 *@jaeger.example
13869 *
13870 </literallayout>
13871 <para>
13872 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13873 would mean that every address matches, thus rendering the test useless.
13874 </para>
13875 <para>
13876 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13877 </para>
13878 <literallayout class="monospaced">
13879 deny recipients = dbm*@;/some/file
13880 deny recipients = *@dbm;/some/file
13881 </literallayout>
13882 <para>
13883 The first does a whole address lookup, with defaulting, as just described,
13884 because it starts with a lookup type. The second matches the local part and
13885 domain independently, as described in a bullet point below.
13886 </para>
13887 </listitem>
13888 </itemizedlist>
13889 <para>
13890 The following kinds of address list pattern can match only non-empty addresses.
13891 If the subject address is empty, a match against any of these pattern types
13892 always fails.
13893 </para>
13894 <itemizedlist>
13895 <listitem>
13896 <para>
13897 <indexterm role="concept">
13898 <primary>@@ with single-key lookup</primary>
13899 </indexterm>
13900 <indexterm role="concept">
13901 <primary>address list</primary>
13902 <secondary>@@ lookup type</secondary>
13903 </indexterm>
13904 <indexterm role="concept">
13905 <primary>address list</primary>
13906 <secondary>split local part and domain</secondary>
13907 </indexterm>
13908 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13909 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13910 split into a local part and a domain. The domain is looked up in the file. If
13911 it is not found, there is no match. If it is found, the data that is looked up
13912 from the file is treated as a colon-separated list of local part patterns, each
13913 of which is matched against the subject local part in turn.
13914 </para>
13915 <para>
13916 <indexterm role="concept">
13917 <primary>asterisk</primary>
13918 <secondary>in address list</secondary>
13919 </indexterm>
13920 The lookup may be a partial one, and/or one involving a search for a default
13921 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13922 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13923 even be further lookups. They may also be independently negated. For example,
13924 with
13925 </para>
13926 <literallayout class="monospaced">
13927 deny senders = @@dbm;/etc/reject-by-domain
13928 </literallayout>
13929 <para>
13930 the data from which the DBM file is built could contain lines like
13931 </para>
13932 <literallayout class="monospaced">
13933 baddomain.com:  !postmaster : *
13934 </literallayout>
13935 <para>
13936 to reject all senders except <option>postmaster</option> from that domain.
13937 </para>
13938 <para>
13939 <indexterm role="concept">
13940 <primary>local part</primary>
13941 <secondary>starting with !</secondary>
13942 </indexterm>
13943 If a local part that actually begins with an exclamation mark is required, it
13944 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13945 may be split over several lines by indenting the second and subsequent lines,
13946 but the separating colon must still be included at line breaks. White space
13947 surrounding the colons is ignored. For example:
13948 </para>
13949 <literallayout class="monospaced">
13950 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13951   spammer3 : spammer4
13952 </literallayout>
13953 <para>
13954 As in all colon-separated lists in Exim, a colon can be included in an item by
13955 doubling.
13956 </para>
13957 <para>
13958 If the last item in the list starts with a right angle-bracket, the remainder
13959 of the item is taken as a new key to look up in order to obtain a continuation
13960 list of local parts. The new key can be any sequence of characters. Thus one
13961 might have entries like
13962 </para>
13963 <literallayout class="monospaced">
13964 aol.com: spammer1 : spammer 2 : &gt;*
13965 xyz.com: spammer3 : &gt;*
13966 *:       ^\d{8}$
13967 </literallayout>
13968 <para>
13969 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13970 local parts for all domains, in addition to the specific local parts listed for
13971 each domain. Of course, using this feature costs another lookup each time a
13972 chain is followed, but the effort needed to maintain the data is reduced.
13973 </para>
13974 <para>
13975 <indexterm role="concept">
13976 <primary>loop</primary>
13977 <secondary>in lookups</secondary>
13978 </indexterm>
13979 It is possible to construct loops using this facility, and in order to catch
13980 them, the chains may be no more than fifty items long.
13981 </para>
13982 </listitem>
13983 <listitem>
13984 <para>
13985 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13986 lookup, but in this case, the chaining facility is not available. The lookup
13987 can only return a single list of local parts.
13988 </para>
13989 </listitem>
13990 </itemizedlist>
13991 <para>
13992 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13993 in these two examples:
13994 </para>
13995 <literallayout class="monospaced">
13996 senders = +my_list
13997 senders = *@+my_list
13998 </literallayout>
13999 <para>
14000 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
14001 example it is a named domain list.
14002 </para>
14003 </section>
14004 <section id="SECTcasletadd">
14005 <title>Case of letters in address lists</title>
14006 <para>
14007 <indexterm role="concept">
14008 <primary>case of local parts</primary>
14009 </indexterm>
14010 <indexterm role="concept">
14011 <primary>address list</primary>
14012 <secondary>case forcing</secondary>
14013 </indexterm>
14014 <indexterm role="concept">
14015 <primary>case forcing in address lists</primary>
14016 </indexterm>
14017 Domains in email addresses are always handled caselessly, but for local parts
14018 case may be significant on some systems (see <option>caseful_local_part</option> for how
14019 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
14020 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
14021 blocking lists should be done in a case-independent manner. Since most address
14022 lists in Exim are used for this kind of control, Exim attempts to do this by
14023 default.
14024 </para>
14025 <para>
14026 The domain portion of an address is always lowercased before matching it to an
14027 address list. The local part is lowercased by default, and any string
14028 comparisons that take place are done caselessly. This means that the data in
14029 the address list itself, in files included as plain filenames, and in any file
14030 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
14031 keys in files that are looked up by a search type other than <command>lsearch</command> (which
14032 works caselessly) must be in lower case, because these lookups are not
14033 case-independent.
14034 </para>
14035 <para>
14036 <indexterm role="concept">
14037 <primary><literal>+caseful</literal></primary>
14038 </indexterm>
14039 To allow for the possibility of caseful address list matching, if an item in
14040 an address list is the string <quote>+caseful</quote>, the original case of the local
14041 part is restored for any comparisons that follow, and string comparisons are no
14042 longer case-independent. This does not affect the domain, which remains in
14043 lower case. However, although independent matches on the domain alone are still
14044 performed caselessly, regular expressions that match against an entire address
14045 become case-sensitive after <quote>+caseful</quote> has been seen.
14046 </para>
14047 </section>
14048 <section id="SECTlocparlis">
14049 <title>Local part lists</title>
14050 <para>
14051 <indexterm role="concept">
14052 <primary>list</primary>
14053 <secondary>local part list</secondary>
14054 </indexterm>
14055 <indexterm role="concept">
14056 <primary>local part</primary>
14057 <secondary>list</secondary>
14058 </indexterm>
14059 Case-sensitivity in local part lists is handled in the same way as for address
14060 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
14061 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
14062 set false, the subject is lowercased and the matching is initially
14063 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
14064 matching in the local part list, but not elsewhere in the router. If
14065 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
14066 option is case-sensitive from the start.
14067 </para>
14068 <para>
14069 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
14070 comments are handled in the same way as address lists &ndash; they are recognized
14071 only if the # is preceded by white space or the start of the line.
14072 Otherwise, local part lists are matched in the same way as domain lists, except
14073 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
14074 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
14075 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
14076 types.
14077 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
14078 </para>
14079 </section>
14080 </chapter>
14081
14082 <chapter id="CHAPexpand">
14083 <title>String expansions</title>
14084 <para>
14085 <indexterm role="concept" id="IIDstrexp" class="startofrange">
14086 <primary>expansion</primary>
14087 <secondary>of strings</secondary>
14088 </indexterm>
14089 Many strings in Exim&#x2019;s runtime configuration are expanded before use. Some of
14090 them are expanded every time they are used; others are expanded only once.
14091 </para>
14092 <para>
14093 When a string is being expanded it is copied verbatim from left to right except
14094 <indexterm role="concept">
14095 <primary>expansion</primary>
14096 <secondary>string concatenation</secondary>
14097 </indexterm>
14098 when a dollar or backslash character is encountered. A dollar specifies the
14099 start of a portion of the string that is interpreted and replaced as described
14100 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
14101 escape character, as described in the following section.
14102 </para>
14103 <para>
14104 Whether a string is expanded depends upon the context.  Usually this is solely
14105 dependent upon the option for which a value is sought; in this documentation,
14106 options for which string expansion is performed are marked with &dagger; after
14107 the data type.  ACL rules always expand strings.  A couple of expansion
14108 conditions do not expand some of the brace-delimited branches, for security
14109 reasons,
14110 <indexterm role="concept">
14111 <primary>tainted data</primary>
14112 <secondary>expansion</secondary>
14113 </indexterm>
14114 <indexterm role="concept">
14115 <primary>expansion</primary>
14116 <secondary>tainted data</secondary>
14117 </indexterm>
14118 and expansion of data deriving from the sender (<quote>tainted data</quote>)
14119 is not permitted.
14120 </para>
14121 <section id="SECTlittext">
14122 <title>Literal text in expanded strings</title>
14123 <para>
14124 <indexterm role="concept">
14125 <primary>expansion</primary>
14126 <secondary>including literal text</secondary>
14127 </indexterm>
14128 An uninterpreted dollar can be included in an expanded string by putting a
14129 backslash in front of it. A backslash can be used to prevent any special
14130 character being treated specially in an expansion, including backslash itself.
14131 If the string appears in quotes in the configuration file, two backslashes are
14132 required because the quotes themselves cause interpretation of backslashes when
14133 the string is read in (see section <xref linkend="SECTstrings"/>).
14134 </para>
14135 <para>
14136 <indexterm role="concept">
14137 <primary>expansion</primary>
14138 <secondary>non-expandable substrings</secondary>
14139 </indexterm>
14140 A portion of the string can specified as non-expandable by placing it between
14141 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
14142 expressions, which often contain backslashes and dollar signs. For example:
14143 </para>
14144 <literallayout class="monospaced">
14145 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
14146 </literallayout>
14147 <para>
14148 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
14149 without interpretation until it reaches the next <literal>\N</literal> or the end of the
14150 string.
14151 </para>
14152 </section>
14153 <section id="SECID82">
14154 <title>Character escape sequences in expanded strings</title>
14155 <para>
14156 <indexterm role="concept">
14157 <primary>expansion</primary>
14158 <secondary>escape sequences</secondary>
14159 </indexterm>
14160 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
14161 expanded string is recognized as an escape sequence for the character newline,
14162 carriage return, or tab, respectively. A backslash followed by up to three
14163 octal digits is recognized as an octal encoding for a single character, and a
14164 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
14165 encoding.
14166 </para>
14167 <para>
14168 These escape sequences are also recognized in quoted strings when they are read
14169 in. Their interpretation in expansions as well is useful for unquoted strings,
14170 and for other cases such as looked-up strings that are then expanded.
14171 </para>
14172 </section>
14173 <section id="SECID83">
14174 <title>Testing string expansions</title>
14175 <para>
14176 <indexterm role="concept">
14177 <primary>expansion</primary>
14178 <secondary>testing</secondary>
14179 </indexterm>
14180 <indexterm role="concept">
14181 <primary>testing</primary>
14182 <secondary>string expansion</secondary>
14183 </indexterm>
14184 <indexterm role="option">
14185 <primary><option>-be</option></primary>
14186 </indexterm>
14187 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
14188 takes the command arguments, or lines from the standard input if there are no
14189 arguments, runs them through the string expansion code, and writes the results
14190 to the standard output. Variables based on configuration values are set up, but
14191 since no message is being processed, variables such as <varname>$local_part</varname> have no
14192 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
14193 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
14194 and <option>nhash</option>.
14195 </para>
14196 <para>
14197 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
14198 instead runs under the uid and gid it was called with, to prevent users from
14199 using <option>-be</option> for reading files to which they do not have access.
14200 </para>
14201 <para>
14202 <indexterm role="option">
14203 <primary><option>-bem</option></primary>
14204 </indexterm>
14205 If you want to test expansions that include variables whose values are taken
14206 from a message, there are two other options that can be used. The <option>-bem</option>
14207 option is like <option>-be</option> except that it is followed by a filename. The file is
14208 read as a message before doing the test expansions. For example:
14209 </para>
14210 <literallayout class="monospaced">
14211 exim -bem /tmp/test.message '$h_subject:'
14212 </literallayout>
14213 <para>
14214 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
14215 Exim message identifier. For example:
14216 </para>
14217 <literallayout class="monospaced">
14218 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
14219 </literallayout>
14220 <para>
14221 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
14222 is therefore restricted to admin users.
14223 </para>
14224 </section>
14225 <section id="SECTforexpfai">
14226 <title>Forced expansion failure</title>
14227 <para>
14228 <indexterm role="concept">
14229 <primary>expansion</primary>
14230 <secondary>forced failure</secondary>
14231 </indexterm>
14232 A number of expansions that are described in the following section have
14233 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
14234 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
14235 used depends on some condition that is evaluated as part of the expansion. If,
14236 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
14237 the entire string expansion fails in a way that can be detected by the code
14238 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
14239 its consequences depend on the circumstances. In some cases it is no different
14240 from any other expansion failure, but in others a different action may be
14241 taken. Such variations are mentioned in the documentation of the option that is
14242 being expanded.
14243 </para>
14244 </section>
14245 <section id="SECTexpansionitems">
14246 <title>Expansion items</title>
14247 <para>
14248 The following items are recognized in expanded strings. White space may be used
14249 between sub-items that are keywords or substrings enclosed in braces inside an
14250 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
14251 white space is significant.
14252 </para>
14253 <variablelist>
14254 <varlistentry>
14255 <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>
14256 <listitem>
14257 <para>
14258 <indexterm role="concept">
14259 <primary>expansion</primary>
14260 <secondary>variables</secondary>
14261 </indexterm>
14262 Substitute the contents of the named variable, for example:
14263 </para>
14264 <literallayout class="monospaced">
14265 $local_part
14266 ${domain}
14267 </literallayout>
14268 <para>
14269 The second form can be used to separate the name from subsequent alphanumeric
14270 characters. This form (using braces) is available only for variables; it does
14271 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
14272 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
14273 given, the expansion fails.
14274 </para>
14275 </listitem></varlistentry>
14276 <varlistentry>
14277 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14278 <listitem>
14279 <para>
14280 <indexterm role="concept">
14281 <primary>expansion</primary>
14282 <secondary>operators</secondary>
14283 </indexterm>
14284 The string is first itself expanded, and then the operation specified by
14285 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
14286 </para>
14287 <literallayout class="monospaced">
14288 ${lc:$local_part}
14289 </literallayout>
14290 <para>
14291 The string starts with the first character after the colon, which may be
14292 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
14293 below. The operator notation is used for simple expansion items that have just
14294 one argument, because it reduces the number of braces and therefore makes the
14295 string easier to understand.
14296 </para>
14297 </listitem></varlistentry>
14298 <varlistentry>
14299 <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>
14300 <listitem>
14301 <para>
14302 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
14303 expansion item below.
14304 </para>
14305 </listitem></varlistentry>
14306 <varlistentry>
14307 <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>
14308 <listitem>
14309 <para>
14310 <indexterm role="concept">
14311 <primary>expansion</primary>
14312 <secondary>calling an acl</secondary>
14313 </indexterm>
14314 <indexterm role="concept">
14315 <primary><option>acl</option></primary>
14316 <secondary>call from expansion</secondary>
14317 </indexterm>
14318 The name and zero to nine argument strings are first expanded separately.  The expanded
14319 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
14320 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
14321 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
14322 and may use the variables; if another acl expansion is used the values
14323 are restored after it returns.  If the ACL sets
14324 a value using a "message =" modifier and returns accept or deny, the value becomes
14325 the result of the expansion.
14326 If no message is set and the ACL returns accept or deny
14327 the expansion result is an empty string.
14328 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
14329 </para>
14330 </listitem></varlistentry>
14331 <varlistentry>
14332 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14333 <listitem>
14334 <para>
14335 <indexterm role="concept">
14336 <primary>authentication</primary>
14337 <secondary>results header</secondary>
14338 </indexterm>
14339 <indexterm role="concept">
14340 <primary>headers</primary>
14341 <secondary>authentication-results:</secondary>
14342 </indexterm>
14343 <indexterm role="concept">
14344 <primary>authentication</primary>
14345 <secondary>expansion item</secondary>
14346 </indexterm>
14347 This item returns a string suitable for insertion as an
14348 <emphasis>Authentication-Results:</emphasis>
14349 header line.
14350 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
14351 will be a domain name identifying the system performing the authentications.
14352 Methods that might be present in the result include:
14353 </para>
14354 <literallayout class="monospaced">
14355 none
14356 iprev
14357 auth
14358 spf
14359 dkim
14360 </literallayout>
14361 <para>
14362 Example use (as an ACL modifier):
14363 </para>
14364 <literallayout class="monospaced">
14365       add_header = :at_start:${authresults {$primary_hostname}}
14366 </literallayout>
14367 <para>
14368 This is safe even if no authentication results are available.
14369 </para>
14370 </listitem></varlistentry>
14371 <varlistentry>
14372 <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>
14373 <listitem>
14374 <para>
14375 <indexterm role="concept">
14376 <primary>expansion</primary>
14377 <secondary>extracting certificate fields</secondary>
14378 </indexterm>
14379 <indexterm role="concept">
14380 <primary><option>certextract</option></primary>
14381 <secondary>certificate fields</secondary>
14382 </indexterm>
14383 <indexterm role="concept">
14384 <primary>certificate</primary>
14385 <secondary>extracting fields</secondary>
14386 </indexterm>
14387 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
14388 The field name is expanded and used to retrieve the relevant field from
14389 the certificate.  Supported fields are:
14390 </para>
14391 <literallayout>
14392 <literal>version        </literal>
14393 <literal>serial_number  </literal>
14394 <literal>subject        </literal> RFC4514 DN
14395 <literal>issuer         </literal> RFC4514 DN
14396 <literal>notbefore      </literal> time
14397 <literal>notafter       </literal> time
14398 <literal>sig_algorithm  </literal>
14399 <literal>signature      </literal>
14400 <literal>subj_altname   </literal> tagged list
14401 <literal>ocsp_uri       </literal> list
14402 <literal>crl_uri        </literal> list
14403 </literallayout>
14404 <para>
14405 If the field is found,
14406 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14407 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14408 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14409 is restored to any previous value it might have had.
14410 </para>
14411 <para>
14412 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14413 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14414 extracted is used.
14415 </para>
14416 <para>
14417 Some field names take optional modifiers, appended and separated by commas.
14418 </para>
14419 <para>
14420 The field selectors marked as "RFC4514" above
14421 output a Distinguished Name string which is
14422 not quite
14423 parseable by Exim as a comma-separated tagged list
14424 (the exceptions being elements containing commas).
14425 RDN elements of a single type may be selected by
14426 a modifier of the type label; if so the expansion
14427 result is a list (newline-separated by default).
14428 The separator may be changed by another modifier of
14429 a right angle-bracket followed immediately by the new separator.
14430 Recognised RDN type labels include "CN", "O", "OU" and "DC".
14431 </para>
14432 <para>
14433 The field selectors marked as "time" above
14434 take an optional modifier of "int"
14435 for which the result is the number of seconds since epoch.
14436 Otherwise the result is a human-readable string
14437 in the timezone selected by the main "timezone" option.
14438 </para>
14439 <para>
14440 The field selectors marked as "list" above return a list,
14441 newline-separated by default,
14442 (embedded separator characters in elements are doubled).
14443 The separator may be changed by a modifier of
14444 a right angle-bracket followed immediately by the new separator.
14445 </para>
14446 <para>
14447 The field selectors marked as "tagged" above
14448 prefix each list element with a type string and an equals sign.
14449 Elements of only one type may be selected by a modifier
14450 which is one of "dns", "uri" or "mail";
14451 if so the element tags are omitted.
14452 </para>
14453 <para>
14454 If not otherwise noted field values are presented in human-readable form.
14455 </para>
14456 </listitem></varlistentry>
14457 <varlistentry>
14458 <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>
14459 <listitem>
14460 <para>
14461 <indexterm role="concept">
14462 <primary><option>dlfunc</option></primary>
14463 </indexterm>
14464 This expansion dynamically loads and then calls a locally-written C function.
14465 This functionality is available only if Exim is compiled with
14466 </para>
14467 <literallayout class="monospaced">
14468 EXPAND_DLFUNC=yes
14469 </literallayout>
14470 <para>
14471 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
14472 object so that it doesn&#x2019;t reload the same object file in the same Exim process
14473 (but of course Exim does start new processes frequently).
14474 </para>
14475 <para>
14476 There may be from zero to eight arguments to the function.
14477 </para>
14478 <para>
14479 When compiling
14480 a local function that is to be called in this way,
14481 first <filename>DLFUNC_IMPL</filename> should be defined,
14482 and second <filename>local_scan.h</filename> should be included.
14483 The Exim variables and functions that are defined by that API
14484 are also available for dynamically loaded functions. The function itself
14485 must have the following type:
14486 </para>
14487 <literallayout class="monospaced">
14488 int dlfunction(uschar **yield, int argc, uschar *argv[])
14489 </literallayout>
14490 <para>
14491 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
14492 function should return one of the following values:
14493 </para>
14494 <para>
14495 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
14496 into the expanded string that is being built.
14497 </para>
14498 <para>
14499 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
14500 from <emphasis>yield</emphasis>, if it is set.
14501 </para>
14502 <para>
14503 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
14504 taken from <emphasis>yield</emphasis> if it is set.
14505 </para>
14506 <para>
14507 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
14508 </para>
14509 <para>
14510 When compiling a function that is to be used in this way with gcc,
14511 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
14512 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
14513 </para>
14514 </listitem></varlistentry>
14515 <varlistentry>
14516 <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>
14517 <listitem>
14518 <para>
14519 <indexterm role="concept">
14520 <primary>expansion</primary>
14521 <secondary>extracting value from environment</secondary>
14522 </indexterm>
14523 <indexterm role="concept">
14524 <primary>environment</primary>
14525 <secondary>values from</secondary>
14526 </indexterm>
14527 The key is first expanded separately, and leading and trailing white space
14528 removed.
14529 This is then searched for as a name in the environment.
14530 If a variable is found then its value is placed in <varname>$value</varname>
14531 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
14532 </para>
14533 <para>
14534 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14535 appear, for example:
14536 </para>
14537 <literallayout class="monospaced">
14538 ${env{USER}{$value} fail }
14539 </literallayout>
14540 <para>
14541 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14542 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14543 </para>
14544 <para>
14545 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
14546 search failure.
14547 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
14548 search success.
14549 </para>
14550 <para>
14551 The environment is adjusted by the <option>keep_environment</option> and
14552 <option>add_environment</option> main section options.
14553 </para>
14554 </listitem></varlistentry>
14555 <varlistentry>
14556 <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>
14557 <listitem>
14558 <para>
14559 <indexterm role="concept">
14560 <primary>expansion</primary>
14561 <secondary>extracting substrings by key</secondary>
14562 </indexterm>
14563 <indexterm role="concept">
14564 <primary><option>extract</option></primary>
14565 <secondary>substrings by key</secondary>
14566 </indexterm>
14567 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14568 white space is removed from the key (but not from any of the strings). The key
14569 must not be empty and must not consist entirely of digits.
14570 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14571 </para>
14572 <literallayout>
14573 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
14574 </literallayout>
14575 <para>
14576 <indexterm role="variable">
14577 <primary><varname>$value</varname></primary>
14578 </indexterm>
14579 where the equals signs and spaces (but not both) are optional. If any of the
14580 values contain white space, they must be enclosed in double quotes, and any
14581 values that are enclosed in double quotes are subject to escape processing as
14582 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
14583 for the value that corresponds to the key. The search is case-insensitive. If
14584 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14585 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14586 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14587 is restored to any previous value it might have had.
14588 </para>
14589 <para>
14590 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14591 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14592 extracted is used. Thus, for example, these two expansions are identical, and
14593 yield <quote>2001</quote>:
14594 </para>
14595 <literallayout class="monospaced">
14596 ${extract{gid}{uid=1984 gid=2001}}
14597 ${extract{gid}{uid=1984 gid=2001}{$value}}
14598 </literallayout>
14599 <para>
14600 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14601 appear, for example:
14602 </para>
14603 <literallayout class="monospaced">
14604 ${extract{Z}{A=... B=...}{$value} fail }
14605 </literallayout>
14606 <para>
14607 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14608 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14609 </para>
14610 </listitem></varlistentry>
14611 <varlistentry>
14612 <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>
14613 <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>
14614 <listitem>
14615 <para>
14616 <indexterm role="concept">
14617 <primary>expansion</primary>
14618 <secondary>extracting from JSON object</secondary>
14619 </indexterm>
14620 <indexterm role="concept">
14621 <primary>JSON</primary>
14622 <secondary>expansions</secondary>
14623 </indexterm>
14624 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14625 white space is removed from the key (but not from any of the strings). The key
14626 must not be empty and must not consist entirely of digits.
14627 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14628 </para>
14629 <literallayout>
14630 { &lt;<emphasis>"key1"</emphasis>&gt; : &lt;<emphasis>value1</emphasis>&gt; ,  &lt;<emphasis>"key2"</emphasis>&gt; , &lt;<emphasis>value2</emphasis>&gt; ... }
14631 </literallayout>
14632 <para>
14633 <indexterm role="variable">
14634 <primary><varname>$value</varname></primary>
14635 </indexterm>
14636 The braces, commas and colons, and the quoting of the member name are required;
14637 the spaces are optional.
14638 Matching of the key against the member names is done case-sensitively.
14639 For the <quote>json</quote> variant,
14640 if a returned value is a JSON string, it retains its leading and
14641 trailing quotes.
14642 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
14643 leading and trailing quotes are removed from the returned value.
14644 </para>
14645 <para>
14646 The results of matching are handled as above.
14647 </para>
14648 </listitem></varlistentry>
14649 <varlistentry>
14650 <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>
14651 <listitem>
14652 <para>
14653 <indexterm role="concept">
14654 <primary>expansion</primary>
14655 <secondary>extracting substrings by number</secondary>
14656 </indexterm>
14657 <indexterm role="concept">
14658 <primary><option>extract</option></primary>
14659 <secondary>substrings by number</secondary>
14660 </indexterm>
14661 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14662 apart from leading and trailing white space, which is ignored.
14663 This is what distinguishes this form of <option>extract</option> from the previous kind. It
14664 behaves in the same way, except that, instead of extracting a named field, it
14665 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
14666 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
14667 &lt;<emphasis>string3</emphasis>&gt; as before.
14668 </para>
14669 <para>
14670 The fields in the string are separated by any one of the characters in the
14671 separator string. These may include space or tab characters.
14672 The first field is numbered one. If the number is negative, the fields are
14673 counted from the end of the string, with the rightmost one numbered -1. If the
14674 number given is zero, the entire string is returned. If the modulus of the
14675 number is greater than the number of fields in the string, the result is the
14676 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
14677 provided. For example:
14678 </para>
14679 <literallayout class="monospaced">
14680 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14681 </literallayout>
14682 <para>
14683 yields <quote>42</quote>, and
14684 </para>
14685 <literallayout class="monospaced">
14686 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14687 </literallayout>
14688 <para>
14689 yields <quote>99</quote>. Two successive separators mean that the field between them is
14690 empty (for example, the fifth field above).
14691 </para>
14692 </listitem></varlistentry>
14693 <varlistentry>
14694 <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>
14695 <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>
14696 <listitem>
14697 <para>
14698 <indexterm role="concept">
14699 <primary>expansion</primary>
14700 <secondary>extracting from JSON array</secondary>
14701 </indexterm>
14702 <indexterm role="concept">
14703 <primary>JSON</primary>
14704 <secondary>expansions</secondary>
14705 </indexterm>
14706 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14707 apart from leading and trailing white space, which is ignored.
14708 </para>
14709 <para>
14710 Field selection and result handling is as above;
14711 there is no choice of field separator.
14712 For the <quote>json</quote> variant,
14713 if a returned value is a JSON string, it retains its leading and
14714 trailing quotes.
14715 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
14716 leading and trailing quotes are removed from the returned value.
14717 </para>
14718 </listitem></varlistentry>
14719 <varlistentry>
14720 <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>
14721 <listitem>
14722 <para>
14723 <indexterm role="concept">
14724 <primary>list</primary>
14725 <secondary>selecting by condition</secondary>
14726 </indexterm>
14727 <indexterm role="concept">
14728 <primary>expansion</primary>
14729 <secondary>selecting from list by condition</secondary>
14730 </indexterm>
14731 <indexterm role="variable">
14732 <primary><varname>$item</varname></primary>
14733 </indexterm>
14734 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14735 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
14736 For each item
14737 in this list, its value is place in <varname>$item</varname>, and then the condition is
14738 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
14739 item in a new list; if the condition is false, the item is discarded. The
14740 separator used for the output list is the same as the one used for the
14741 input, but a separator setting is not included in the output. For example:
14742 </para>
14743 <literallayout class="monospaced">
14744 ${filter{a:b:c}{!eq{$item}{b}}}
14745 </literallayout>
14746 <para>
14747 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
14748 to what it was before. See also the <option>map</option> and <option>reduce</option> expansion items.
14749 </para>
14750 </listitem></varlistentry>
14751 <varlistentry>
14752 <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>
14753 <listitem>
14754 <para>
14755 <indexterm role="concept">
14756 <primary>hash function</primary>
14757 <secondary>textual</secondary>
14758 </indexterm>
14759 <indexterm role="concept">
14760 <primary>expansion</primary>
14761 <secondary>textual hash</secondary>
14762 </indexterm>
14763 This is a textual hashing function, and was the first to be implemented in
14764 early versions of Exim. In current releases, there are other hashing functions
14765 (numeric, MD5, and SHA-1), which are described below.
14766 </para>
14767 <para>
14768 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
14769 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
14770 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
14771 use the simpler operator notation that avoids some of the braces:
14772 </para>
14773 <literallayout class="monospaced">
14774 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14775 </literallayout>
14776 <para>
14777 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
14778 or equal to the length of the string, the expansion item returns the string.
14779 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
14780 function to the string. The new string consists of characters taken from the
14781 first &lt;<emphasis>m</emphasis>&gt; characters of the string
14782 </para>
14783 <literallayout class="monospaced">
14784 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
14785 </literallayout>
14786 <para>
14787 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
14788 letters appear. For example:
14789 </para>
14790 <literallayout>
14791 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
14792 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14793 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14794 </literallayout>
14795 </listitem></varlistentry>
14796 <varlistentry>
14797 <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>
14798 <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>
14799 <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>
14800 <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>
14801 <listitem>
14802 <para>
14803 <indexterm role="concept">
14804 <primary>expansion</primary>
14805 <secondary>header insertion</secondary>
14806 </indexterm>
14807 <indexterm role="variable">
14808 <primary><varname>$header_</varname></primary>
14809 </indexterm>
14810 <indexterm role="variable">
14811 <primary><varname>$bheader_</varname></primary>
14812 </indexterm>
14813 <indexterm role="variable">
14814 <primary><varname>$lheader_</varname></primary>
14815 </indexterm>
14816 <indexterm role="variable">
14817 <primary><varname>$rheader_</varname></primary>
14818 </indexterm>
14819 <indexterm role="concept">
14820 <primary>header lines</primary>
14821 <secondary>in expansion strings</secondary>
14822 </indexterm>
14823 <indexterm role="concept">
14824 <primary>header lines</primary>
14825 <secondary>character sets</secondary>
14826 </indexterm>
14827 <indexterm role="concept">
14828 <primary>header lines</primary>
14829 <secondary>decoding</secondary>
14830 </indexterm>
14831 Substitute the contents of the named message header line, for example
14832 </para>
14833 <literallayout class="monospaced">
14834 $header_reply-to:
14835 </literallayout>
14836 <para>
14837 The newline that terminates a header line is not included in the expansion, but
14838 internal newlines (caused by splitting the header line over several physical
14839 lines) may be present.
14840 </para>
14841 <para>
14842 The difference between the four pairs of expansions is in the way
14843 the data in the header line is interpreted.
14844 </para>
14845 <itemizedlist>
14846 <listitem>
14847 <para>
14848 <indexterm role="concept">
14849 <primary>white space</primary>
14850 <secondary>in header lines</secondary>
14851 </indexterm>
14852 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14853 processing at all, and without the removal of leading and trailing white space.
14854 </para>
14855 </listitem>
14856 <listitem>
14857 <para>
14858 <indexterm role="concept">
14859 <primary>list</primary>
14860 <secondary>of header lines</secondary>
14861 </indexterm>
14862 <option>lheader</option> gives a colon-separated list, one element per header when there
14863 are multiple headers with a given name.
14864 Any embedded colon characters within an element are doubled, so normal Exim
14865 list-processing facilities can be used.
14866 The terminating newline of each element is removed; in other respects
14867 the content is <quote>raw</quote>.
14868 </para>
14869 </listitem>
14870 <listitem>
14871 <para>
14872 <indexterm role="concept">
14873 <primary>base64 encoding</primary>
14874 <secondary>in header lines</secondary>
14875 </indexterm>
14876 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14877 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14878 character set translation. If decoding of what looks superficially like a MIME
14879 <quote>word</quote> fails, the raw string is returned. If decoding
14880 <indexterm role="concept">
14881 <primary>binary zero</primary>
14882 <secondary>in header line</secondary>
14883 </indexterm>
14884 produces a binary zero character, it is replaced by a question mark &ndash; this is
14885 what Exim does for binary zeros that are actually received in header lines.
14886 </para>
14887 </listitem>
14888 <listitem>
14889 <para>
14890 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14891 standard character set. This is an attempt to produce the same string as would
14892 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14893 returned. Translation is attempted only on operating systems that support the
14894 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14895 a system Makefile or in <filename>Local/Makefile</filename>.
14896 </para>
14897 </listitem>
14898 </itemizedlist>
14899 <para>
14900 In a filter file, the target character set for <option>header</option> can be specified by a
14901 command of the following form:
14902 </para>
14903 <literallayout class="monospaced">
14904 headers charset "UTF-8"
14905 </literallayout>
14906 <para>
14907 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14908 subsequently obeyed filter commands. In the absence of this command, the target
14909 character set in a filter is taken from the setting of the <option>headers_charset</option>
14910 option in the runtime configuration. The value of this option defaults to the
14911 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14912 ISO-8859-1.
14913 </para>
14914 <para>
14915 Header names follow the syntax of RFC 2822, which states that they may contain
14916 any printing characters except space and colon. Consequently, curly brackets
14917 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14918 if they were variables. Attempting to do so causes a syntax error.
14919 </para>
14920 <para>
14921 Only header lines that are common to all copies of a message are visible to
14922 this mechanism. These are the original header lines that are received with the
14923 message, and any that are added by an ACL statement or by a system
14924 filter. Header lines that are added to a particular copy of a message by a
14925 router or transport are not accessible.
14926 </para>
14927 <para>
14928 For incoming SMTP messages, no header lines are visible in
14929 ACLs that are obeyed before the data phase completes,
14930 because the header structure is not set up until the message is received.
14931 They are visible in DKIM, PRDR and DATA ACLs.
14932 Header lines that are added in a RCPT ACL (for example)
14933 are saved until the message&#x2019;s incoming header lines are available, at which
14934 point they are added.
14935 When any of the above ACLs ar
14936 running, however, header lines added by earlier ACLs are visible.
14937 </para>
14938 <para>
14939 Upper case and lower case letters are synonymous in header names. If the
14940 following character is white space, the terminating colon may be omitted, but
14941 this is not recommended, because you may then forget it when it is needed. When
14942 white space terminates the header name, this white space is included in the
14943 expanded string.  If the message does not contain the given header, the
14944 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14945 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14946 header.)
14947 </para>
14948 <para>
14949 If there is more than one header with the same name, they are all concatenated
14950 to form the substitution string, up to a maximum length of 64K. Unless
14951 <option>rheader</option> is being used, leading and trailing white space is removed from
14952 each header before concatenation, and a completely empty header is ignored. A
14953 newline character is then inserted between non-empty headers, but there is no
14954 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14955 those headers that contain lists of addresses, a comma is also inserted at the
14956 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14957 </para>
14958 <para revisionflag="changed">
14959 <indexterm role="concept">
14960 <primary>tainted data</primary>
14961 </indexterm>
14962 When the headers are from an incoming message,
14963 the result of expanding any of these variables is tainted.
14964 </para>
14965 </listitem></varlistentry>
14966 <varlistentry>
14967 <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>
14968 <listitem>
14969 <para>
14970 <indexterm role="concept">
14971 <primary>expansion</primary>
14972 <secondary>hmac hashing</secondary>
14973 </indexterm>
14974 <indexterm role="concept">
14975 <primary><option>hmac</option></primary>
14976 </indexterm>
14977 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14978 shared secret and some text into a message authentication code, as specified in
14979 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14980 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14981 cryptographic hash, allowing for authentication that is not possible with MD5
14982 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14983 present. For example:
14984 </para>
14985 <literallayout class="monospaced">
14986 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14987 </literallayout>
14988 <para>
14989 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14990 produces:
14991 </para>
14992 <literallayout class="monospaced">
14993 dd97e3ba5d1a61b5006108f8c8252953
14994 </literallayout>
14995 <para>
14996 As an example of how this might be used, you might put in the main part of
14997 an Exim configuration:
14998 </para>
14999 <literallayout class="monospaced">
15000 SPAMSCAN_SECRET=cohgheeLei2thahw
15001 </literallayout>
15002 <para>
15003 In a router or a transport you could then have:
15004 </para>
15005 <literallayout class="monospaced">
15006 headers_add = \
15007   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
15008   ${hmac{md5}{SPAMSCAN_SECRET}\
15009   {${primary_hostname},${message_exim_id},$h_message-id:}}
15010 </literallayout>
15011 <para>
15012 Then given a message, you can check where it was scanned by looking at the
15013 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
15014 this header line is authentic by recomputing the authentication code from the
15015 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
15016 using Exim&#x2019;s <option>-be</option> option, or by other means, for example, by using the
15017 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
15018 </para>
15019 </listitem></varlistentry>
15020 <varlistentry>
15021 <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>
15022 <listitem>
15023 <para>
15024 <indexterm role="concept">
15025 <primary>expansion</primary>
15026 <secondary>conditional</secondary>
15027 </indexterm>
15028 <indexterm role="concept">
15029 <primary><option>if</option>, expansion item</primary>
15030 </indexterm>
15031 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
15032 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
15033 in section <xref linkend="SECTexpcond"/> below. For example:
15034 </para>
15035 <literallayout class="monospaced">
15036 ${if eq {$local_part}{postmaster} {yes}{no} }
15037 </literallayout>
15038 <para>
15039 The second string need not be present; if it is not and the condition is not
15040 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
15041 be present instead of the second string (without any curly brackets). In this
15042 case, the expansion is forced to fail if the condition is not true (see section
15043 <xref linkend="SECTforexpfai"/>).
15044 </para>
15045 <para>
15046 If both strings are omitted, the result is the string <literal>true</literal> if the condition
15047 is true, and the empty string if the condition is false. This makes it less
15048 cumbersome to write custom ACL and router conditions. For example, instead of
15049 </para>
15050 <literallayout class="monospaced">
15051 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
15052 </literallayout>
15053 <para>
15054 you can use
15055 </para>
15056 <literallayout class="monospaced">
15057 condition = ${if &gt;{$acl_m4}{3}}
15058 </literallayout>
15059 </listitem></varlistentry>
15060 <varlistentry>
15061 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15062 <listitem>
15063 <para>
15064 <indexterm role="concept">
15065 <primary>expansion</primary>
15066 <secondary>imap folder</secondary>
15067 </indexterm>
15068 <indexterm role="concept">
15069 <primary><option>imapfolder</option> expansion item</primary>
15070 </indexterm>
15071 This item converts a (possibly multilevel, or with non-ASCII characters)
15072 folder specification to a Maildir name for filesystem use.
15073 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
15074 </para>
15075 </listitem></varlistentry>
15076 <varlistentry>
15077 <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>
15078 <listitem>
15079 <para>
15080 <indexterm role="concept">
15081 <primary>expansion</primary>
15082 <secondary>string truncation</secondary>
15083 </indexterm>
15084 <indexterm role="concept">
15085 <primary><option>length</option> expansion item</primary>
15086 </indexterm>
15087 The <option>length</option> item is used to extract the initial portion of a string. Both
15088 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
15089 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
15090 change when expanded, you can use the simpler operator notation that avoids
15091 some of the braces:
15092 </para>
15093 <literallayout class="monospaced">
15094 ${length_&lt;n&gt;:&lt;string&gt;}
15095 </literallayout>
15096 <para>
15097 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; bytes or the whole
15098 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
15099 <option>strlen</option>, which gives the length of a string.
15100 All measurement is done in bytes and is not UTF-8 aware.
15101 </para>
15102 </listitem></varlistentry>
15103 <varlistentry>
15104 <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>
15105 <listitem>
15106 <para>
15107 <indexterm role="concept">
15108 <primary>expansion</primary>
15109 <secondary>extracting list elements by number</secondary>
15110 </indexterm>
15111 <indexterm role="concept">
15112 <primary><option>listextract</option></primary>
15113 <secondary>extract list elements by number</secondary>
15114 </indexterm>
15115 <indexterm role="concept">
15116 <primary>list</primary>
15117 <secondary>extracting elements by number</secondary>
15118 </indexterm>
15119 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15120 apart from an optional leading minus,
15121 and leading and trailing white space (which is ignored).
15122 </para>
15123 <para>
15124 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15125 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15126 </para>
15127 <para>
15128 The first field of the list is numbered one.
15129 If the number is negative, the fields are
15130 counted from the end of the list, with the rightmost one numbered -1.
15131 The numbered element of the list is extracted and placed in <varname>$value</varname>,
15132 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
15133 </para>
15134 <para>
15135 If the modulus of the
15136 number is zero or greater than the number of fields in the string,
15137 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
15138 </para>
15139 <para>
15140 For example:
15141 </para>
15142 <literallayout class="monospaced">
15143 ${listextract{2}{x:42:99}}
15144 </literallayout>
15145 <para>
15146 yields <quote>42</quote>, and
15147 </para>
15148 <literallayout class="monospaced">
15149 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
15150 </literallayout>
15151 <para>
15152 yields <quote>result: 42</quote>.
15153 </para>
15154 <para>
15155 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
15156 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15157 extracted is used.
15158 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
15159 </para>
15160 </listitem></varlistentry>
15161 <varlistentry>
15162 <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>
15163 <listitem>
15164 <para>
15165 This is the first of one of two different types of lookup item, which are both
15166 described in the next item.
15167 </para>
15168 </listitem></varlistentry>
15169 <varlistentry>
15170 <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>
15171 <listitem>
15172 <para>
15173 <indexterm role="concept">
15174 <primary>expansion</primary>
15175 <secondary>lookup in</secondary>
15176 </indexterm>
15177 <indexterm role="concept">
15178 <primary>file</primary>
15179 <secondary>lookups</secondary>
15180 </indexterm>
15181 <indexterm role="concept">
15182 <primary>lookup</primary>
15183 <secondary>in expanded string</secondary>
15184 </indexterm>
15185 The two forms of lookup item specify data lookups in files and databases, as
15186 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
15187 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
15188 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
15189 </para>
15190 <para>
15191 If there is any white space in a lookup item which is part of a filter command,
15192 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
15193 other place where white space is significant, the lookup item must be enclosed
15194 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
15195 out by the system administrator.
15196 </para>
15197 <para>
15198 <indexterm role="variable">
15199 <primary><varname>$value</varname></primary>
15200 </indexterm>
15201 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
15202 During its expansion, the variable <varname>$value</varname> contains the data returned by the
15203 lookup. Afterwards it reverts to the value it had previously (at the outer
15204 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
15205 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
15206 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
15207 lookup, thus providing a mechanism for looking up a default value when the
15208 original lookup fails.
15209 </para>
15210 <para>
15211 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
15212 data for the outer lookup while the parameters of the second lookup are
15213 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
15214 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
15215 appear, and in this case, if the lookup fails, the entire expansion is forced
15216 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
15217 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
15218 successful lookup, and nothing in the case of failure.
15219 </para>
15220 <para>
15221 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
15222 search type in order to do partial matching, and * or *@ may follow a search
15223 type to request default lookups if the key does not match (see sections
15224 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
15225 </para>
15226 <para>
15227 <indexterm role="concept">
15228 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15229 <secondary>in lookup expansion</secondary>
15230 </indexterm>
15231 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
15232 and non-wild parts of the key during the expansion of the replacement text.
15233 They return to their previous values at the end of the lookup item.
15234 </para>
15235 <para>
15236 This example looks up the postmaster alias in the conventional alias file:
15237 </para>
15238 <literallayout class="monospaced">
15239 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
15240 </literallayout>
15241 <para>
15242 This example uses NIS+ to look up the full name of the user corresponding to
15243 the local part of an address, forcing the expansion to fail if it is not found:
15244 </para>
15245 <literallayout class="monospaced">
15246 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
15247   {$value}fail}
15248 </literallayout>
15249 </listitem></varlistentry>
15250 <varlistentry>
15251 <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>
15252 <listitem>
15253 <para>
15254 <indexterm role="concept">
15255 <primary>expansion</primary>
15256 <secondary>list creation</secondary>
15257 </indexterm>
15258 <indexterm role="variable">
15259 <primary><varname>$item</varname></primary>
15260 </indexterm>
15261 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15262 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15263 For each item
15264 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
15265 expanded and added to the output as an item in a new list. The separator used
15266 for the output list is the same as the one used for the input, but a separator
15267 setting is not included in the output. For example:
15268 </para>
15269 <literallayout class="monospaced">
15270 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
15271 </literallayout>
15272 <para>
15273 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
15274 value of <varname>$item</varname> is restored to what it was before. See also the <option>filter</option>
15275 and <option>reduce</option> expansion items.
15276 </para>
15277 </listitem></varlistentry>
15278 <varlistentry>
15279 <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>
15280 <listitem>
15281 <para>
15282 <indexterm role="concept">
15283 <primary>expansion</primary>
15284 <secondary>numeric hash</secondary>
15285 </indexterm>
15286 <indexterm role="concept">
15287 <primary>hash function</primary>
15288 <secondary>numeric</secondary>
15289 </indexterm>
15290 The three strings are expanded; the first two must yield numbers. Call them
15291 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15292 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15293 can use the simpler operator notation that avoids some of the braces:
15294 </para>
15295 <literallayout class="monospaced">
15296 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15297 </literallayout>
15298 <para>
15299 The second number is optional (in both notations). If there is only one number,
15300 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
15301 processed by a div/mod hash function that returns two numbers, separated by a
15302 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
15303 example,
15304 </para>
15305 <literallayout class="monospaced">
15306 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
15307 </literallayout>
15308 <para>
15309 returns the string <quote>6/33</quote>.
15310 </para>
15311 </listitem></varlistentry>
15312 <varlistentry>
15313 <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>
15314 <listitem>
15315 <para>
15316 <indexterm role="concept">
15317 <primary>Perl</primary>
15318 <secondary>use in expanded string</secondary>
15319 </indexterm>
15320 <indexterm role="concept">
15321 <primary>expansion</primary>
15322 <secondary>calling Perl from</secondary>
15323 </indexterm>
15324 This item is available only if Exim has been built to include an embedded Perl
15325 interpreter. The subroutine name and the arguments are first separately
15326 expanded, and then the Perl subroutine is called with those arguments. No
15327 additional arguments need be given; the maximum number permitted, including the
15328 name of the subroutine, is nine.
15329 </para>
15330 <para>
15331 The return value of the subroutine is inserted into the expanded string, unless
15332 the return value is <option>undef</option>. In that case, the expansion fails in the same
15333 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
15334 Whatever you return is evaluated in a scalar context. For example, if you
15335 return the name of a Perl vector, the return value is the size of the vector,
15336 not its contents.
15337 </para>
15338 <para>
15339 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
15340 with the error message that was passed to <option>die</option>. More details of the embedded
15341 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
15342 </para>
15343 <para>
15344 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
15345 out the use of this expansion item in filter files.
15346 </para>
15347 </listitem></varlistentry>
15348 <varlistentry>
15349 <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>
15350 <listitem>
15351 <para>
15352 <indexterm role="concept">
15353 <primary><option>prvs</option> expansion item</primary>
15354 </indexterm>
15355 The first argument is a complete email address and the second is secret
15356 keystring. The third argument, specifying a key number, is optional. If absent,
15357 it defaults to 0. The result of the expansion is a prvs-signed email address,
15358 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
15359 as part of a bounce address tag validation (BATV) scheme. For more discussion
15360 and an example, see section <xref linkend="SECTverifyPRVS"/>.
15361 </para>
15362 </listitem></varlistentry>
15363 <varlistentry>
15364 <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>
15365 <listitem>
15366 <para>
15367 <indexterm role="concept">
15368 <primary><option>prvscheck</option> expansion item</primary>
15369 </indexterm>
15370 This expansion item is the complement of the <option>prvs</option> item. It is used for
15371 checking prvs-signed addresses. If the expansion of the first argument does not
15372 yield a syntactically valid prvs-signed address, the whole item expands to the
15373 empty string. When the first argument does expand to a syntactically valid
15374 prvs-signed address, the second argument is expanded, with the prvs-decoded
15375 version of the address and the key number extracted from the address in the
15376 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
15377 </para>
15378 <para>
15379 These two variables can be used in the expansion of the second argument to
15380 retrieve the secret. The validity of the prvs-signed address is then checked
15381 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
15382 which is empty for failure or <quote>1</quote> for success.
15383 </para>
15384 <para>
15385 The third argument is optional; if it is missing, it defaults to an empty
15386 string. This argument is now expanded. If the result is an empty string, the
15387 result of the expansion is the decoded version of the address. This is the case
15388 whether or not the signature was valid. Otherwise, the result of the expansion
15389 is the expansion of the third argument.
15390 </para>
15391 <para>
15392 All three variables can be used in the expansion of the third argument.
15393 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
15394 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
15395 </para>
15396 </listitem></varlistentry>
15397 <varlistentry>
15398 <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>
15399 <listitem>
15400 <para>
15401 <indexterm role="concept">
15402 <primary>expansion</primary>
15403 <secondary>inserting an entire file</secondary>
15404 </indexterm>
15405 <indexterm role="concept">
15406 <primary>file</primary>
15407 <secondary>inserting into expansion</secondary>
15408 </indexterm>
15409 <indexterm role="concept">
15410 <primary><option>readfile</option> expansion item</primary>
15411 </indexterm>
15412 The filename and end-of-line string are first expanded separately. The file is
15413 then read, and its contents replace the entire item. All newline characters in
15414 the file are replaced by the end-of-line string if it is present. Otherwise,
15415 newlines are left in the string.
15416 String expansion is not applied to the contents of the file. If you want this,
15417 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
15418 the string expansion fails.
15419 </para>
15420 <para>
15421 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
15422 locks out the use of this expansion item in filter files.
15423 </para>
15424 </listitem></varlistentry>
15425 <varlistentry>
15426 <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>
15427 <listitem>
15428 <para>
15429 <indexterm role="concept">
15430 <primary>expansion</primary>
15431 <secondary>inserting from a socket</secondary>
15432 </indexterm>
15433 <indexterm role="concept">
15434 <primary>socket, use of in expansion</primary>
15435 </indexterm>
15436 <indexterm role="concept">
15437 <primary><option>readsocket</option> expansion item</primary>
15438 </indexterm>
15439 This item inserts data from a Unix domain or TCP socket into the expanded
15440 string. The minimal way of using it uses just two arguments, as in these
15441 examples:
15442 </para>
15443 <literallayout class="monospaced">
15444 ${readsocket{/socket/name}{request string}}
15445 ${readsocket{inet:some.host:1234}{request string}}
15446 </literallayout>
15447 <para>
15448 For a Unix domain socket, the first substring must be the path to the socket.
15449 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
15450 a host name or IP address, followed by a colon and a port, which can be a
15451 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
15452 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
15453 example:
15454 </para>
15455 <literallayout class="monospaced">
15456 ${readsocket{inet:[::1]:1234}{request string}}
15457 </literallayout>
15458 <para>
15459 Only a single host name may be given, but if looking it up yields more than
15460 one IP address, they are each tried in turn until a connection is made. For
15461 both kinds of socket, Exim makes a connection, writes the request string
15462 unless it is an empty string; and no terminating NUL is ever sent)
15463 and reads from the socket until an end-of-file
15464 is read. A timeout of 5 seconds is applied. Additional, optional arguments
15465 extend what can be done. Firstly, you can vary the timeout. For example:
15466 </para>
15467 <literallayout class="monospaced">
15468 ${readsocket{/socket/name}{request string}{3s}}
15469 </literallayout>
15470 <para>
15471 The third argument is a list of options, of which the first element is the timeout
15472 and must be present if any options are given.
15473 Further elements are options of form <emphasis>name=value</emphasis>.
15474 Example:
15475 </para>
15476 <literallayout class="monospaced">
15477 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
15478 </literallayout>
15479 <para revisionflag="changed">
15480 The following option names are recognised:
15481 </para>
15482 <itemizedlist revisionflag="changed">
15483 <listitem>
15484 <para revisionflag="changed">
15485 <emphasis role="bold">cache</emphasis>
15486 Defines if the result data can be cached for use by a later identical
15487 request in the same process.
15488 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15489 If not, all cached results for this connection specification
15490 will be invalidated.
15491 </para>
15492 </listitem>
15493 <listitem>
15494 <para revisionflag="changed">
15495 <emphasis role="bold">shutdown</emphasis>
15496 Defines whether or not a write-shutdown is done on the connection after
15497 sending the request. Values are <quote>yes</quote> (the default) or <quote>no</quote>
15498 (preferred, eg. by some webservers).
15499 </para>
15500 </listitem>
15501 <listitem>
15502 <para revisionflag="changed">
15503 <emphasis role="bold">tls</emphasis>
15504 Controls the use of TLS on the connection.
15505 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15506 If it is enabled, a shutdown as descripbed above is never done.
15507 </para>
15508 </listitem>
15509 </itemizedlist>
15510 <para>
15511 A fourth argument allows you to change any newlines that are in the data
15512 that is read, in the same way as for <option>readfile</option> (see above). This example
15513 turns them into spaces:
15514 </para>
15515 <literallayout class="monospaced">
15516 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
15517 </literallayout>
15518 <para>
15519 As with all expansions, the substrings are expanded before the processing
15520 happens. Errors in these sub-expansions cause the expansion to fail. In
15521 addition, the following errors can occur:
15522 </para>
15523 <itemizedlist>
15524 <listitem>
15525 <para>
15526 Failure to create a socket file descriptor;
15527 </para>
15528 </listitem>
15529 <listitem>
15530 <para>
15531 Failure to connect the socket;
15532 </para>
15533 </listitem>
15534 <listitem>
15535 <para>
15536 Failure to write the request string;
15537 </para>
15538 </listitem>
15539 <listitem>
15540 <para>
15541 Timeout on reading from the socket.
15542 </para>
15543 </listitem>
15544 </itemizedlist>
15545 <para>
15546 By default, any of these errors causes the expansion to fail. However, if
15547 you supply a fifth substring, it is expanded and used when any of the above
15548 errors occurs. For example:
15549 </para>
15550 <literallayout class="monospaced">
15551 ${readsocket{/socket/name}{request string}{3s}{\n}\
15552   {socket failure}}
15553 </literallayout>
15554 <para>
15555 You can test for the existence of a Unix domain socket by wrapping this
15556 expansion in <literal>${if exists</literal>, but there is a race condition between that test
15557 and the actual opening of the socket, so it is safer to use the fifth argument
15558 if you want to be absolutely sure of avoiding an expansion error for a
15559 non-existent Unix domain socket, or a failure to connect to an Internet socket.
15560 </para>
15561 <para>
15562 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
15563 locks out the use of this expansion item in filter files.
15564 </para>
15565 </listitem></varlistentry>
15566 <varlistentry>
15567 <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>
15568 <listitem>
15569 <para>
15570 <indexterm role="concept">
15571 <primary>expansion</primary>
15572 <secondary>reducing a list to a scalar</secondary>
15573 </indexterm>
15574 <indexterm role="concept">
15575 <primary>list</primary>
15576 <secondary>reducing to a scalar</secondary>
15577 </indexterm>
15578 <indexterm role="variable">
15579 <primary><varname>$value</varname></primary>
15580 </indexterm>
15581 <indexterm role="variable">
15582 <primary><varname>$item</varname></primary>
15583 </indexterm>
15584 This operation reduces a list to a single, scalar string. After expansion,
15585 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
15586 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15587 Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
15588 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
15589 list is assigned to <varname>$item</varname>, in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
15590 them. The result of that expansion is assigned to <varname>$value</varname> before the next
15591 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
15592 added to the expansion output. The <option>reduce</option> expansion item can be used in a
15593 number of ways. For example, to add up a list of numbers:
15594 </para>
15595 <literallayout class="monospaced">
15596 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
15597 </literallayout>
15598 <para>
15599 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
15600 can be found:
15601 </para>
15602 <literallayout class="monospaced">
15603 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
15604 </literallayout>
15605 <para>
15606 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
15607 restored to what they were before. See also the <option>filter</option> and <option>map</option>
15608 expansion items.
15609 </para>
15610 </listitem></varlistentry>
15611 <varlistentry>
15612 <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>
15613 <listitem>
15614 <para>
15615 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
15616 expansion item in section <xref linkend="SECTexpansionitems"/> above.
15617 </para>
15618 </listitem></varlistentry>
15619 <varlistentry>
15620 <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>
15621 <listitem>
15622 <para>
15623 <indexterm role="concept">
15624 <primary>expansion</primary>
15625 <secondary>running a command</secondary>
15626 </indexterm>
15627 <indexterm role="concept">
15628 <primary><option>run</option> expansion item</primary>
15629 </indexterm>
15630 The command and its arguments are first expanded as one string. The string is
15631 split apart into individual arguments by spaces, and then the command is run
15632 in a separate process, but under the same uid and gid.  As in other command
15633 executions from Exim, a shell is not used by default. If the command requires
15634 a shell, you must explicitly code it.
15635 </para>
15636 <para>
15637 Since the arguments are split by spaces, when there is a variable expansion
15638 which has an empty result, it will cause the situation that the argument will
15639 simply be omitted when the program is actually executed by Exim. If the
15640 script/program requires a specific number of arguments and the expanded
15641 variable could possibly result in this empty expansion, the variable must be
15642 quoted. This is more difficult if the expanded variable itself could result
15643 in a string containing quotes, because it would interfere with the quotes
15644 around the command arguments. A possible guard against this is to wrap the
15645 variable in the <option>sg</option> operator to change any quote marks to some other
15646 character.
15647 </para>
15648 <para>
15649 The standard input for the command exists, but is empty. The standard output
15650 and standard error are set to the same file descriptor.
15651 <indexterm role="concept">
15652 <primary>return code</primary>
15653 <secondary>from <option>run</option> expansion</secondary>
15654 </indexterm>
15655 <indexterm role="variable">
15656 <primary><varname>$value</varname></primary>
15657 </indexterm>
15658 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
15659 and replaces the entire item; during this expansion, the standard output/error
15660 from the command is in the variable <varname>$value</varname>. If the command fails,
15661 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
15662 expansion, the standard output/error from the command is in the variable
15663 <varname>$value</varname>.
15664 </para>
15665 <para>
15666 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
15667 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
15668 command does not succeed. If both strings are omitted, the result is contents
15669 of the standard output/error on success, and nothing on failure.
15670 </para>
15671 <para>
15672 <indexterm role="variable">
15673 <primary><varname>$run_in_acl</varname></primary>
15674 </indexterm>
15675 The standard output/error of the command is put in the variable <varname>$value</varname>.
15676 In this ACL example, the output of a command is logged for the admin to
15677 troubleshoot:
15678 </para>
15679 <literallayout class="monospaced">
15680 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
15681       log_message  = Output of id: $value
15682 </literallayout>
15683 <para>
15684 If the command requires shell idioms, such as the &gt; redirect operator, the
15685 shell must be invoked directly, such as with:
15686 </para>
15687 <literallayout class="monospaced">
15688 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
15689 </literallayout>
15690 <para>
15691 <indexterm role="variable">
15692 <primary><varname>$runrc</varname></primary>
15693 </indexterm>
15694 The return code from the command is put in the variable <varname>$runrc</varname>, and this
15695 remains set afterwards, so in a filter file you can do things like this:
15696 </para>
15697 <literallayout class="monospaced">
15698 if "${run{x y z}{}}$runrc" is 1 then ...
15699   elif $runrc is 2 then ...
15700   ...
15701 endif
15702 </literallayout>
15703 <para>
15704 If execution of the command fails (for example, the command does not exist),
15705 the return code is 127 &ndash; the same code that shells use for non-existent
15706 commands.
15707 </para>
15708 <para>
15709 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
15710 option values are expanded, except for those preconditions whose order of
15711 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
15712 by the expansion of one option, and use it in another.
15713 </para>
15714 <para>
15715 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
15716 out the use of this expansion item in filter files.
15717 </para>
15718 </listitem></varlistentry>
15719 <varlistentry>
15720 <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>
15721 <listitem>
15722 <para>
15723 <indexterm role="concept">
15724 <primary>expansion</primary>
15725 <secondary>string substitution</secondary>
15726 </indexterm>
15727 <indexterm role="concept">
15728 <primary><option>sg</option> expansion item</primary>
15729 </indexterm>
15730 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
15731 option; hence its name. However, unlike the Perl equivalent, Exim does not
15732 modify the subject string; instead it returns the modified string for insertion
15733 into the overall expansion. The item takes three arguments: the subject string,
15734 a regular expression, and a substitution string. For example:
15735 </para>
15736 <literallayout class="monospaced">
15737 ${sg{abcdefabcdef}{abc}{xyz}}
15738 </literallayout>
15739 <para>
15740 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
15741 if any $, } or \ characters are required in the regular expression or in the
15742 substitution string, they have to be escaped. For example:
15743 </para>
15744 <literallayout class="monospaced">
15745 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
15746 </literallayout>
15747 <para>
15748 yields <quote>defabc</quote>, and
15749 </para>
15750 <literallayout class="monospaced">
15751 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
15752 </literallayout>
15753 <para>
15754 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
15755 the regular expression from string expansion.
15756 </para>
15757 <para>
15758 The regular expression is compiled in 8-bit mode, working against bytes
15759 rather than any Unicode-aware character handling.
15760 </para>
15761 </listitem></varlistentry>
15762 <varlistentry>
15763 <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>
15764 <listitem>
15765 <para>
15766 <indexterm role="concept">
15767 <primary>sorting</primary>
15768 <secondary>a list</secondary>
15769 </indexterm>
15770 <indexterm role="concept">
15771 <primary>list</primary>
15772 <secondary>sorting</secondary>
15773 </indexterm>
15774 <indexterm role="concept">
15775 <primary>expansion</primary>
15776 <secondary>list sorting</secondary>
15777 </indexterm>
15778 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15779 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15780 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
15781 of a two-argument expansion condition.
15782 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
15783 The comparison should return true when applied to two values
15784 if the first value should sort before the second value.
15785 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
15786 the element being placed in <varname>$item</varname>,
15787 to give values for comparison.
15788 </para>
15789 <para>
15790 The item result is a sorted list,
15791 with the original list separator,
15792 of the list elements (in full) of the original.
15793 </para>
15794 <para>
15795 Examples:
15796 </para>
15797 <literallayout class="monospaced">
15798 ${sort{3:2:1:4}{&lt;}{$item}}
15799 </literallayout>
15800 <para>
15801 sorts a list of numbers, and
15802 </para>
15803 <literallayout class="monospaced">
15804 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
15805 </literallayout>
15806 <para>
15807 will sort an MX lookup into priority order.
15808 </para>
15809 </listitem></varlistentry>
15810 <varlistentry>
15811 <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>
15812 <listitem>
15813 <para>
15814 <indexterm role="concept">
15815 <primary><option>substr</option> expansion item</primary>
15816 </indexterm>
15817 <indexterm role="concept">
15818 <primary>substring extraction</primary>
15819 </indexterm>
15820 <indexterm role="concept">
15821 <primary>expansion</primary>
15822 <secondary>substring extraction</secondary>
15823 </indexterm>
15824 The three strings are expanded; the first two must yield numbers. Call them
15825 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15826 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15827 can use the simpler operator notation that avoids some of the braces:
15828 </para>
15829 <literallayout class="monospaced">
15830 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15831 </literallayout>
15832 <para>
15833 The second number is optional (in both notations).
15834 If it is absent in the simpler format, the preceding underscore must also be
15835 omitted.
15836 </para>
15837 <para>
15838 The <option>substr</option> item can be used to extract more general substrings than
15839 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
15840 length required. For example
15841 </para>
15842 <literallayout class="monospaced">
15843 ${substr{3}{2}{$local_part}}
15844 </literallayout>
15845 <para>
15846 If the starting offset is greater than the string length the result is the
15847 null string; if the length plus starting offset is greater than the string
15848 length, the result is the right-hand part of the string, starting from the
15849 given offset. The first byte (character) in the string has offset zero.
15850 </para>
15851 <para>
15852 The <option>substr</option> expansion item can take negative offset values to count
15853 from the right-hand end of its operand. The last byte (character) is offset -1,
15854 the second-last is offset -2, and so on. Thus, for example,
15855 </para>
15856 <literallayout class="monospaced">
15857 ${substr{-5}{2}{1234567}}
15858 </literallayout>
15859 <para>
15860 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15861 length of the string, the substring starts at the beginning of the string, and
15862 the length is reduced by the amount of overshoot. Thus, for example,
15863 </para>
15864 <literallayout class="monospaced">
15865 ${substr{-5}{2}{12}}
15866 </literallayout>
15867 <para>
15868 yields an empty string, but
15869 </para>
15870 <literallayout class="monospaced">
15871 ${substr{-3}{2}{12}}
15872 </literallayout>
15873 <para>
15874 yields <quote>1</quote>.
15875 </para>
15876 <para>
15877 When the second number is omitted from <option>substr</option>, the remainder of the string
15878 is taken if the offset is positive. If it is negative, all bytes (characters) in the
15879 string preceding the offset point are taken. For example, an offset of -1 and
15880 no length, as in these semantically identical examples:
15881 </para>
15882 <literallayout class="monospaced">
15883 ${substr_-1:abcde}
15884 ${substr{-1}{abcde}}
15885 </literallayout>
15886 <para>
15887 yields all but the last character of the string, that is, <quote>abcd</quote>.
15888 </para>
15889 <para>
15890 All measurement is done in bytes and is not UTF-8 aware.
15891 </para>
15892 </listitem></varlistentry>
15893 <varlistentry>
15894 <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>
15895 <listitem>
15896 <para>
15897 <indexterm role="concept">
15898 <primary>expansion</primary>
15899 <secondary>character translation</secondary>
15900 </indexterm>
15901 <indexterm role="concept">
15902 <primary><option>tr</option> expansion item</primary>
15903 </indexterm>
15904 This item does single-character (in bytes) translation on its subject string. The second
15905 argument is a list of characters to be translated in the subject string. Each
15906 matching character is replaced by the corresponding character from the
15907 replacement list. For example
15908 </para>
15909 <literallayout class="monospaced">
15910 ${tr{abcdea}{ac}{13}}
15911 </literallayout>
15912 <para>
15913 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15914 last occurrence is used. If the third string is shorter than the second, its
15915 last character is replicated. However, if it is empty, no translation takes
15916 place.
15917 </para>
15918 <para>
15919 All character handling is done in bytes and is not UTF-8 aware.
15920 </para>
15921 </listitem></varlistentry>
15922 </variablelist>
15923 </section>
15924 <section id="SECTexpop">
15925 <title>Expansion operators</title>
15926 <para>
15927 <indexterm role="concept">
15928 <primary>expansion</primary>
15929 <secondary>operators</secondary>
15930 </indexterm>
15931 For expansion items that perform transformations on a single argument string,
15932 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15933 The substring is first expanded before the operation is applied to it. The
15934 following operations can be performed:
15935 </para>
15936 <variablelist>
15937 <varlistentry>
15938 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15939 <listitem>
15940 <para>
15941 <indexterm role="concept">
15942 <primary>expansion</primary>
15943 <secondary>RFC 2822 address handling</secondary>
15944 </indexterm>
15945 <indexterm role="concept">
15946 <primary><option>address</option> expansion item</primary>
15947 </indexterm>
15948 The string is interpreted as an RFC 2822 address, as it might appear in a
15949 header line, and the effective address is extracted from it. If the string does
15950 not parse successfully, the result is empty.
15951 </para>
15952 <para>
15953 The parsing correctly handles SMTPUTF8 Unicode in the string.
15954 </para>
15955 </listitem></varlistentry>
15956 <varlistentry>
15957 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15958 <listitem>
15959 <para>
15960 <indexterm role="concept">
15961 <primary>expansion</primary>
15962 <secondary>RFC 2822 address handling</secondary>
15963 </indexterm>
15964 <indexterm role="concept">
15965 <primary><option>addresses</option> expansion item</primary>
15966 </indexterm>
15967 The string (after expansion) is interpreted as a list of addresses in RFC
15968 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15969 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15970 result of the expansion is a colon-separated list, with appropriate
15971 doubling of colons should any happen to be present in the email addresses.
15972 Syntactically invalid RFC2822 address items are omitted from the output.
15973 </para>
15974 <para>
15975 It is possible to specify a character other than colon for the output
15976 separator by starting the string with &gt; followed by the new separator
15977 character. For example:
15978 </para>
15979 <literallayout class="monospaced">
15980 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15981 </literallayout>
15982 <para>
15983 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
15984 first, so if the expanded string starts with &gt;, it may change the output
15985 separator unintentionally. This can be avoided by setting the output
15986 separator explicitly:
15987 </para>
15988 <literallayout class="monospaced">
15989 ${addresses:&gt;:$h_from:}
15990 </literallayout>
15991 <para>
15992 Compare the <option>address</option> (singular)
15993 expansion item, which extracts the working address from a single RFC2822
15994 address. See the <option>filter</option>, <option>map</option>, and <option>reduce</option> items for ways of
15995 processing lists.
15996 </para>
15997 <para>
15998 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15999 a strict interpretation of header line formatting.  Exim parses the bare,
16000 unquoted portion of an email address and if it finds a comma, treats it as an
16001 email address separator. For the example header line:
16002 </para>
16003 <literallayout class="monospaced">
16004 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
16005 </literallayout>
16006 <para>
16007 The first example below demonstrates that Q-encoded email addresses are parsed
16008 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
16009 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
16010 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
16011 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
16012 The third example shows that the presence of a comma is skipped when it is
16013 quoted.  The fourth example shows SMTPUTF8 handling.
16014 </para>
16015 <literallayout class="monospaced">
16016 # exim -be '${addresses:From: \
16017 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
16018 user@example.com
16019 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
16020 Last:user@example.com
16021 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
16022 user@example.com
16023 # exim -be '${addresses:フィル &lt;フィリップ@example.jp&gt;}'
16024 フィリップ@example.jp
16025 </literallayout>
16026 </listitem></varlistentry>
16027 <varlistentry>
16028 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16029 <listitem>
16030 <para>
16031 <indexterm role="concept">
16032 <primary><option>base32</option> expansion item</primary>
16033 </indexterm>
16034 <indexterm role="concept">
16035 <primary>expansion</primary>
16036 <secondary>conversion to base 32</secondary>
16037 </indexterm>
16038 The string must consist entirely of decimal digits. The number is converted to
16039 base 32 and output as a (empty, for zero) string of characters.
16040 Only lowercase letters are used.
16041 </para>
16042 </listitem></varlistentry>
16043 <varlistentry>
16044 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16045 <listitem>
16046 <para>
16047 <indexterm role="concept">
16048 <primary><option>base32d</option> expansion item</primary>
16049 </indexterm>
16050 <indexterm role="concept">
16051 <primary>expansion</primary>
16052 <secondary>conversion to base 32</secondary>
16053 </indexterm>
16054 The string must consist entirely of base-32 digits.
16055 The number is converted to decimal and output as a string.
16056 </para>
16057 </listitem></varlistentry>
16058 <varlistentry>
16059 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16060 <listitem>
16061 <para>
16062 <indexterm role="concept">
16063 <primary><option>base62</option> expansion item</primary>
16064 </indexterm>
16065 <indexterm role="concept">
16066 <primary>expansion</primary>
16067 <secondary>conversion to base 62</secondary>
16068 </indexterm>
16069 The string must consist entirely of decimal digits. The number is converted to
16070 base 62 and output as a string of six characters, including leading zeros. In
16071 the few operating environments where Exim uses base 36 instead of base 62 for
16072 its message identifiers (because those systems do not have case-sensitive
16073 filenames), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just
16074 to be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
16075 </para>
16076 </listitem></varlistentry>
16077 <varlistentry>
16078 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16079 <listitem>
16080 <para>
16081 <indexterm role="concept">
16082 <primary><option>base62d</option> expansion item</primary>
16083 </indexterm>
16084 <indexterm role="concept">
16085 <primary>expansion</primary>
16086 <secondary>conversion to base 62</secondary>
16087 </indexterm>
16088 The string must consist entirely of base-62 digits, or, in operating
16089 environments where Exim uses base 36 instead of base 62 for its message
16090 identifiers, base-36 digits. The number is converted to decimal and output as a
16091 string.
16092 </para>
16093 </listitem></varlistentry>
16094 <varlistentry>
16095 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16096 <listitem>
16097 <para>
16098 <indexterm role="concept">
16099 <primary>expansion</primary>
16100 <secondary>base64 encoding</secondary>
16101 </indexterm>
16102 <indexterm role="concept">
16103 <primary>base64 encoding</primary>
16104 <secondary>in string expansion</secondary>
16105 </indexterm>
16106 <indexterm role="concept">
16107 <primary><option>base64</option> expansion item</primary>
16108 </indexterm>
16109 <indexterm role="concept">
16110 <primary>certificate</primary>
16111 <secondary>base64 of DER</secondary>
16112 </indexterm>
16113 This operator converts a string into one that is base64 encoded.
16114 </para>
16115 <para>
16116 If the string is a single variable of type certificate,
16117 returns the base64 encoding of the DER form of the certificate.
16118 </para>
16119 </listitem></varlistentry>
16120 <varlistentry>
16121 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16122 <listitem>
16123 <para>
16124 <indexterm role="concept">
16125 <primary>expansion</primary>
16126 <secondary>base64 decoding</secondary>
16127 </indexterm>
16128 <indexterm role="concept">
16129 <primary>base64 decoding</primary>
16130 <secondary>in string expansion</secondary>
16131 </indexterm>
16132 <indexterm role="concept">
16133 <primary><option>base64d</option> expansion item</primary>
16134 </indexterm>
16135 This operator converts a base64-encoded string into the un-coded form.
16136 </para>
16137 </listitem></varlistentry>
16138 <varlistentry>
16139 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16140 <listitem>
16141 <para>
16142 <indexterm role="concept">
16143 <primary>domain</primary>
16144 <secondary>extraction</secondary>
16145 </indexterm>
16146 <indexterm role="concept">
16147 <primary>expansion</primary>
16148 <secondary>domain extraction</secondary>
16149 </indexterm>
16150 The string is interpreted as an RFC 2822 address and the domain is extracted
16151 from it. If the string does not parse successfully, the result is empty.
16152 </para>
16153 </listitem></varlistentry>
16154 <varlistentry>
16155 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16156 <listitem>
16157 <para>
16158 <indexterm role="concept">
16159 <primary>expansion</primary>
16160 <secondary>escaping non-printing characters</secondary>
16161 </indexterm>
16162 <indexterm role="concept">
16163 <primary><option>escape</option> expansion item</primary>
16164 </indexterm>
16165 If the string contains any non-printing characters, they are converted to
16166 escape sequences starting with a backslash. Whether characters with the most
16167 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
16168 is controlled by the <option>print_topbitchars</option> option.
16169 </para>
16170 </listitem></varlistentry>
16171 <varlistentry>
16172 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16173 <listitem>
16174 <para>
16175 <indexterm role="concept">
16176 <primary>expansion</primary>
16177 <secondary>escaping 8-bit characters</secondary>
16178 </indexterm>
16179 <indexterm role="concept">
16180 <primary><option>escape8bit</option> expansion item</primary>
16181 </indexterm>
16182 If the string contains and characters with the most significant bit set,
16183 they are converted to escape sequences starting with a backslash.
16184 Backslashes and DEL characters are also converted.
16185 </para>
16186 </listitem></varlistentry>
16187 <varlistentry>
16188 <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>
16189 <listitem>
16190 <para>
16191 <indexterm role="concept">
16192 <primary>expansion</primary>
16193 <secondary>expression evaluation</secondary>
16194 </indexterm>
16195 <indexterm role="concept">
16196 <primary>expansion</primary>
16197 <secondary>arithmetic expression</secondary>
16198 </indexterm>
16199 <indexterm role="concept">
16200 <primary><option>eval</option> expansion item</primary>
16201 </indexterm>
16202 These items supports simple arithmetic and bitwise logical operations in
16203 expansion strings. The string (after expansion) must be a conventional
16204 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
16205 logical operators, and parentheses. All operations are carried out using
16206 integer arithmetic. The operator priorities are as follows (the same as in the
16207 C programming language):
16208 </para>
16209 <informaltable frame="none">
16210 <tgroup cols="2" colsep="0" rowsep="0">
16211 <colspec colwidth="70pt" align="left"/>
16212 <colspec colwidth="300pt" align="left"/>
16213 <tbody>
16214 <row>
16215 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
16216 <entry>not (~), negate (-)</entry>
16217 </row>
16218 <row>
16219 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16220 <entry>multiply (*), divide (/), remainder (%)</entry>
16221 </row>
16222 <row>
16223 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16224 <entry>plus (+), minus (-)</entry>
16225 </row>
16226 <row>
16227 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16228 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
16229 </row>
16230 <row>
16231 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16232 <entry>and (&amp;)</entry>
16233 </row>
16234 <row>
16235 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16236 <entry>xor (^)</entry>
16237 </row>
16238 <row>
16239 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
16240 <entry>or (|)</entry>
16241 </row>
16242 </tbody>
16243 </tgroup>
16244 </informaltable>
16245 <para>
16246 Binary operators with the same priority are evaluated from left to right. White
16247 space is permitted before or after operators.
16248 </para>
16249 <para>
16250 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
16251 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
16252 decimal, even if they start with a leading zero; hexadecimal numbers are not
16253 permitted. This can be useful when processing numbers extracted from dates or
16254 times, which often do have leading zeros.
16255 </para>
16256 <para>
16257 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
16258 or 1024*1024*1024,
16259 respectively. Negative numbers are supported. The result of the computation is
16260 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
16261 </para>
16262 <literallayout>
16263 <literal>${eval:1+1}            </literal>  yields 2
16264 <literal>${eval:1+2*3}          </literal>  yields 7
16265 <literal>${eval:(1+2)*3}        </literal>  yields 9
16266 <literal>${eval:2+42%5}         </literal>  yields 4
16267 <literal>${eval:0xc&amp;5}          </literal>  yields 4
16268 <literal>${eval:0xc|5}          </literal>  yields 13
16269 <literal>${eval:0xc^5}          </literal>  yields 9
16270 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
16271 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
16272 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
16273 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
16274 </literallayout>
16275 <para>
16276 As a more realistic example, in an ACL you might have
16277 </para>
16278 <literallayout class="monospaced">
16279 deny   condition =                    \
16280          ${if and {                   \
16281            {&gt;{$rcpt_count}{10}}       \
16282            {                          \
16283            &lt;                          \
16284              {$recipients_count}      \
16285              {${eval:$rcpt_count/2}}  \
16286            }                          \
16287          }{yes}{no}}
16288        message = Too many bad recipients
16289 </literallayout>
16290 <para>
16291 The condition is true if there have been more than 10 RCPT commands and
16292 fewer than half of them have resulted in a valid recipient.
16293 </para>
16294 </listitem></varlistentry>
16295 <varlistentry>
16296 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16297 <listitem>
16298 <para>
16299 <indexterm role="concept">
16300 <primary>expansion</primary>
16301 <secondary>re-expansion of substring</secondary>
16302 </indexterm>
16303 The <option>expand</option> operator causes a string to be expanded for a second time. For
16304 example,
16305 </para>
16306 <literallayout class="monospaced">
16307 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
16308 </literallayout>
16309 <para>
16310 first looks up a string in a file while expanding the operand for <option>expand</option>,
16311 and then re-expands what it has found.
16312 </para>
16313 </listitem></varlistentry>
16314 <varlistentry>
16315 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16316 <listitem>
16317 <para>
16318 <indexterm role="concept">
16319 <primary>Unicode</primary>
16320 </indexterm>
16321 <indexterm role="concept">
16322 <primary>UTF-8</primary>
16323 <secondary>conversion from</secondary>
16324 </indexterm>
16325 <indexterm role="concept">
16326 <primary>expansion</primary>
16327 <secondary>UTF-8 conversion</secondary>
16328 </indexterm>
16329 <indexterm role="concept">
16330 <primary><option>from_utf8</option> expansion item</primary>
16331 </indexterm>
16332 The world is slowly moving towards Unicode, although there are no standards for
16333 email yet. However, other applications (including some databases) are starting
16334 to store data in Unicode, using UTF-8 encoding. This operator converts from a
16335 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
16336 converted to underscores. The input must be a valid UTF-8 string. If it is not,
16337 the result is an undefined sequence of bytes.
16338 </para>
16339 <para>
16340 Unicode code points with values less than 256 are compatible with ASCII and
16341 ISO-8859-1 (also known as Latin-1).
16342 For example, character 169 is the copyright symbol in both cases, though the
16343 way it is encoded is different. In UTF-8, more than one byte is needed for
16344 characters with code values greater than 127, whereas ISO-8859-1 is a
16345 single-byte encoding (but thereby limited to 256 characters). This makes
16346 translation from UTF-8 to ISO-8859-1 straightforward.
16347 </para>
16348 </listitem></varlistentry>
16349 <varlistentry>
16350 <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>
16351 <listitem>
16352 <para>
16353 <indexterm role="concept">
16354 <primary>hash function</primary>
16355 <secondary>textual</secondary>
16356 </indexterm>
16357 <indexterm role="concept">
16358 <primary>expansion</primary>
16359 <secondary>textual hash</secondary>
16360 </indexterm>
16361 The <option>hash</option> operator is a simpler interface to the hashing function that can
16362 be used when the two parameters are fixed numbers (as opposed to strings that
16363 change when expanded). The effect is the same as
16364 </para>
16365 <literallayout class="monospaced">
16366 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16367 </literallayout>
16368 <para>
16369 See the description of the general <option>hash</option> item above for details. The
16370 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
16371 </para>
16372 </listitem></varlistentry>
16373 <varlistentry>
16374 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16375 <listitem>
16376 <para>
16377 <indexterm role="concept">
16378 <primary>base64 encoding</primary>
16379 <secondary>conversion from hex</secondary>
16380 </indexterm>
16381 <indexterm role="concept">
16382 <primary>expansion</primary>
16383 <secondary>hex to base64</secondary>
16384 </indexterm>
16385 <indexterm role="concept">
16386 <primary><option>hex2b64</option> expansion item</primary>
16387 </indexterm>
16388 This operator converts a hex string into one that is base64 encoded. This can
16389 be useful for processing the output of the various hashing functions.
16390 </para>
16391 </listitem></varlistentry>
16392 <varlistentry>
16393 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16394 <listitem>
16395 <para>
16396 <indexterm role="concept">
16397 <primary>quoting</primary>
16398 <secondary>hex-encoded unprintable characters</secondary>
16399 </indexterm>
16400 <indexterm role="concept">
16401 <primary><option>hexquote</option> expansion item</primary>
16402 </indexterm>
16403 This operator converts non-printable characters in a string into a hex
16404 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
16405 as is, and other byte values are converted to <literal>\xNN</literal>, for example, a
16406 byte value 127 is converted to <literal>\x7f</literal>.
16407 </para>
16408 </listitem></varlistentry>
16409 <varlistentry>
16410 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16411 <listitem>
16412 <para>
16413 <indexterm role="concept">
16414 <primary><option>ipv6denorm</option> expansion item</primary>
16415 </indexterm>
16416 <indexterm role="concept">
16417 <primary>IP address</primary>
16418 <secondary>normalisation</secondary>
16419 </indexterm>
16420 This expands an IPv6 address to a full eight-element colon-separated set
16421 of hex digits including leading zeroes.
16422 A trailing ipv4-style dotted-decimal set is converted to hex.
16423 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16424 </para>
16425 </listitem></varlistentry>
16426 <varlistentry>
16427 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16428 <listitem>
16429 <para>
16430 <indexterm role="concept">
16431 <primary><option>ipv6norm</option> expansion item</primary>
16432 </indexterm>
16433 <indexterm role="concept">
16434 <primary>IP address</primary>
16435 <secondary>normalisation</secondary>
16436 </indexterm>
16437 <indexterm role="concept">
16438 <primary>IP address</primary>
16439 <secondary>canonical form</secondary>
16440 </indexterm>
16441 This converts an IPv6 address to canonical form.
16442 Leading zeroes of groups are omitted, and the longest
16443 set of zero-valued groups is replaced with a double colon.
16444 A trailing ipv4-style dotted-decimal set is converted to hex.
16445 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16446 </para>
16447 </listitem></varlistentry>
16448 <varlistentry>
16449 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16450 <listitem>
16451 <para>
16452 <indexterm role="concept">
16453 <primary>case forcing in strings</primary>
16454 </indexterm>
16455 <indexterm role="concept">
16456 <primary>string</primary>
16457 <secondary>case forcing</secondary>
16458 </indexterm>
16459 <indexterm role="concept">
16460 <primary>lower casing</primary>
16461 </indexterm>
16462 <indexterm role="concept">
16463 <primary>expansion</primary>
16464 <secondary>case forcing</secondary>
16465 </indexterm>
16466 <indexterm role="concept">
16467 <primary><option>lc</option> expansion item</primary>
16468 </indexterm>
16469 This forces the letters in the string into lower-case, for example:
16470 </para>
16471 <literallayout class="monospaced">
16472 ${lc:$local_part}
16473 </literallayout>
16474 <para>
16475 Case is defined per the system C locale.
16476 </para>
16477 </listitem></varlistentry>
16478 <varlistentry>
16479 <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>
16480 <listitem>
16481 <para>
16482 <indexterm role="concept">
16483 <primary>expansion</primary>
16484 <secondary>string truncation</secondary>
16485 </indexterm>
16486 <indexterm role="concept">
16487 <primary><option>length</option> expansion item</primary>
16488 </indexterm>
16489 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
16490 can be used when the parameter is a fixed number (as opposed to a string that
16491 changes when expanded). The effect is the same as
16492 </para>
16493 <literallayout class="monospaced">
16494 ${length{&lt;number&gt;}{&lt;string&gt;}}
16495 </literallayout>
16496 <para>
16497 See the description of the general <option>length</option> item above for details. Note that
16498 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
16499 when <option>length</option> is used as an operator.
16500 All measurement is done in bytes and is not UTF-8 aware.
16501 </para>
16502 </listitem></varlistentry>
16503 <varlistentry>
16504 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16505 <listitem>
16506 <para>
16507 <indexterm role="concept">
16508 <primary>expansion</primary>
16509 <secondary>list item count</secondary>
16510 </indexterm>
16511 <indexterm role="concept">
16512 <primary>list</primary>
16513 <secondary>item count</secondary>
16514 </indexterm>
16515 <indexterm role="concept">
16516 <primary>list</primary>
16517 <secondary>count of items</secondary>
16518 </indexterm>
16519 <indexterm role="concept">
16520 <primary><option>listcount</option> expansion item</primary>
16521 </indexterm>
16522 The string is interpreted as a list and the number of items is returned.
16523 </para>
16524 </listitem></varlistentry>
16525 <varlistentry>
16526 <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>
16527 <listitem>
16528 <para>
16529 <indexterm role="concept">
16530 <primary>expansion</primary>
16531 <secondary>named list</secondary>
16532 </indexterm>
16533 <indexterm role="concept">
16534 <primary><option>listnamed</option> expansion item</primary>
16535 </indexterm>
16536 The name is interpreted as a named list and the content of the list is returned,
16537 expanding any referenced lists, re-quoting as needed for colon-separation.
16538 If the optional type is given it must be one of "a", "d", "h" or "l"
16539 and selects address-, domain-, host- or localpart- lists to search among respectively.
16540 Otherwise all types are searched in an undefined order and the first
16541 matching list is returned.
16542 </para>
16543 </listitem></varlistentry>
16544 <varlistentry>
16545 <term><emphasis role="bold">${local_part:</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>local part extraction</secondary>
16551 </indexterm>
16552 <indexterm role="concept">
16553 <primary><option>local_part</option> expansion item</primary>
16554 </indexterm>
16555 The string is interpreted as an RFC 2822 address and the local part is
16556 extracted from it. If the string does not parse successfully, the result is
16557 empty.
16558 The parsing correctly handles SMTPUTF8 Unicode in the string.
16559 </para>
16560 </listitem></varlistentry>
16561 <varlistentry>
16562 <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>
16563 <listitem>
16564 <para>
16565 <indexterm role="concept">
16566 <primary>masked IP address</primary>
16567 </indexterm>
16568 <indexterm role="concept">
16569 <primary>IP address</primary>
16570 <secondary>masking</secondary>
16571 </indexterm>
16572 <indexterm role="concept">
16573 <primary>CIDR notation</primary>
16574 </indexterm>
16575 <indexterm role="concept">
16576 <primary>expansion</primary>
16577 <secondary>IP address masking</secondary>
16578 </indexterm>
16579 <indexterm role="concept">
16580 <primary><option>mask</option> expansion item</primary>
16581 </indexterm>
16582 If the form of the string to be operated on is not an IP address followed by a
16583 slash and an integer (that is, a network address in CIDR notation), the
16584 expansion fails. Otherwise, this operator converts the IP address to binary,
16585 masks off the least significant bits according to the bit count, and converts
16586 the result back to text, with mask appended. For example,
16587 </para>
16588 <literallayout class="monospaced">
16589 ${mask:10.111.131.206/28}
16590 </literallayout>
16591 <para>
16592 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
16593 be mostly used for looking up masked addresses in files, the result for an IPv6
16594 address uses dots to separate components instead of colons, because colon
16595 terminates a key string in lsearch files. So, for example,
16596 </para>
16597 <literallayout class="monospaced">
16598 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
16599 </literallayout>
16600 <para>
16601 returns the string
16602 </para>
16603 <literallayout class="monospaced">
16604 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
16605 </literallayout>
16606 <para>
16607 Letters in IPv6 addresses are always output in lower case.
16608 </para>
16609 </listitem></varlistentry>
16610 <varlistentry>
16611 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16612 <listitem>
16613 <para>
16614 <indexterm role="concept">
16615 <primary>MD5 hash</primary>
16616 </indexterm>
16617 <indexterm role="concept">
16618 <primary>expansion</primary>
16619 <secondary>MD5 hash</secondary>
16620 </indexterm>
16621 <indexterm role="concept">
16622 <primary>certificate</primary>
16623 <secondary>fingerprint</secondary>
16624 </indexterm>
16625 <indexterm role="concept">
16626 <primary><option>md5</option> expansion item</primary>
16627 </indexterm>
16628 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
16629 as a 32-digit hexadecimal number, in which any letters are in lower case.
16630 </para>
16631 <para>
16632 If the string is a single variable of type certificate,
16633 returns the MD5 hash fingerprint of the certificate.
16634 </para>
16635 </listitem></varlistentry>
16636 <varlistentry>
16637 <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>
16638 <listitem>
16639 <para>
16640 <indexterm role="concept">
16641 <primary>expansion</primary>
16642 <secondary>numeric hash</secondary>
16643 </indexterm>
16644 <indexterm role="concept">
16645 <primary>hash function</primary>
16646 <secondary>numeric</secondary>
16647 </indexterm>
16648 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
16649 that can be used when the two parameters are fixed numbers (as opposed to
16650 strings that change when expanded). The effect is the same as
16651 </para>
16652 <literallayout class="monospaced">
16653 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16654 </literallayout>
16655 <para>
16656 See the description of the general <option>nhash</option> item above for details.
16657 </para>
16658 </listitem></varlistentry>
16659 <varlistentry>
16660 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16661 <listitem>
16662 <para>
16663 <indexterm role="concept">
16664 <primary>quoting</primary>
16665 <secondary>in string expansions</secondary>
16666 </indexterm>
16667 <indexterm role="concept">
16668 <primary>expansion</primary>
16669 <secondary>quoting</secondary>
16670 </indexterm>
16671 <indexterm role="concept">
16672 <primary><option>quote</option> expansion item</primary>
16673 </indexterm>
16674 The <option>quote</option> operator puts its argument into double quotes if it
16675 is an empty string or
16676 contains anything other than letters, digits, underscores, dots, and hyphens.
16677 Any occurrences of double quotes and backslashes are escaped with a backslash.
16678 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
16679 respectively For example,
16680 </para>
16681 <literallayout class="monospaced">
16682 ${quote:ab"*"cd}
16683 </literallayout>
16684 <para>
16685 becomes
16686 </para>
16687 <literallayout class="monospaced">
16688 "ab\"*\"cd"
16689 </literallayout>
16690 <para>
16691 The place where this is useful is when the argument is a substitution from a
16692 variable or a message header.
16693 </para>
16694 </listitem></varlistentry>
16695 <varlistentry>
16696 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16697 <listitem>
16698 <para>
16699 <indexterm role="concept">
16700 <primary><option>quote_local_part</option> expansion item</primary>
16701 </indexterm>
16702 This operator is like <option>quote</option>, except that it quotes the string only if
16703 required to do so by the rules of RFC 2822 for quoting local parts. For
16704 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
16705 If you are creating a new email address from the contents of <varname>$local_part</varname>
16706 (or any other unknown data), you should always use this operator.
16707 </para>
16708 <para>
16709 This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data
16710 will likely use the quoting form.
16711 Thus <emphasis>${quote_local_part:フィル}</emphasis> will always become <emphasis>"フィル"</emphasis>.
16712 </para>
16713 </listitem></varlistentry>
16714 <varlistentry>
16715 <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>
16716 <listitem>
16717 <para>
16718 <indexterm role="concept">
16719 <primary>quoting</primary>
16720 <secondary>lookup-specific</secondary>
16721 </indexterm>
16722 This operator applies lookup-specific quoting rules to the string. Each
16723 query-style lookup type has its own quoting rules which are described with
16724 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
16725 </para>
16726 <literallayout class="monospaced">
16727 ${quote_ldap:two * two}
16728 </literallayout>
16729 <para>
16730 returns
16731 </para>
16732 <literallayout class="monospaced">
16733 two%20%5C2A%20two
16734 </literallayout>
16735 <para>
16736 For single-key lookup types, no quoting is ever necessary and this operator
16737 yields an unchanged string.
16738 </para>
16739 </listitem></varlistentry>
16740 <varlistentry>
16741 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16742 <listitem>
16743 <para>
16744 <indexterm role="concept">
16745 <primary>random number</primary>
16746 </indexterm>
16747 This operator returns a somewhat random number which is less than the
16748 supplied number and is at least 0.  The quality of this randomness depends
16749 on how Exim was built; the values are not suitable for keying material.
16750 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
16751 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
16752 for versions of GnuTLS with that function.
16753 Otherwise, the implementation may be arc4random(), random() seeded by
16754 srandomdev() or srandom(), or a custom implementation even weaker than
16755 random().
16756 </para>
16757 </listitem></varlistentry>
16758 <varlistentry>
16759 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16760 <listitem>
16761 <para>
16762 <indexterm role="concept">
16763 <primary>expansion</primary>
16764 <secondary>IP address</secondary>
16765 </indexterm>
16766 This operator reverses an IP address; for IPv4 addresses, the result is in
16767 dotted-quad decimal form, while for IPv6 addresses the result is in
16768 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
16769 for DNS.  For example,
16770 </para>
16771 <literallayout class="monospaced">
16772 ${reverse_ip:192.0.2.4}
16773 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
16774 </literallayout>
16775 <para>
16776 returns
16777 </para>
16778 <literallayout class="monospaced">
16779 4.2.0.192
16780 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
16781 </literallayout>
16782 </listitem></varlistentry>
16783 <varlistentry>
16784 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16785 <listitem>
16786 <para>
16787 <indexterm role="concept">
16788 <primary>expansion</primary>
16789 <secondary>RFC 2047</secondary>
16790 </indexterm>
16791 <indexterm role="concept">
16792 <primary>RFC 2047</primary>
16793 <secondary>expansion operator</secondary>
16794 </indexterm>
16795 <indexterm role="concept">
16796 <primary><option>rfc2047</option> expansion item</primary>
16797 </indexterm>
16798 This operator encodes text according to the rules of RFC 2047. This is an
16799 encoding that is used in header lines to encode non-ASCII characters. It is
16800 assumed that the input string is in the encoding specified by the
16801 <option>headers_charset</option> option, which gets its default at build time. If the string
16802 contains only characters in the range 33&ndash;126, and no instances of the
16803 characters
16804 </para>
16805 <literallayout class="monospaced">
16806 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
16807 </literallayout>
16808 <para>
16809 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
16810 string, using as many <quote>encoded words</quote> as necessary to encode all the
16811 characters.
16812 </para>
16813 </listitem></varlistentry>
16814 <varlistentry>
16815 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16816 <listitem>
16817 <para>
16818 <indexterm role="concept">
16819 <primary>expansion</primary>
16820 <secondary>RFC 2047</secondary>
16821 </indexterm>
16822 <indexterm role="concept">
16823 <primary>RFC 2047</primary>
16824 <secondary>decoding</secondary>
16825 </indexterm>
16826 <indexterm role="concept">
16827 <primary><option>rfc2047d</option> expansion item</primary>
16828 </indexterm>
16829 This operator decodes strings that are encoded as per RFC 2047. Binary zero
16830 bytes are replaced by question marks. Characters are converted into the
16831 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
16832 not recognized unless <option>check_rfc2047_length</option> is set false.
16833 </para>
16834 <para>
16835 <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
16836 access a header line, RFC 2047 decoding is done automatically. You do not need
16837 to use this operator as well.
16838 </para>
16839 </listitem></varlistentry>
16840 <varlistentry>
16841 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16842 <listitem>
16843 <para>
16844 <indexterm role="concept">
16845 <primary>quoting</primary>
16846 <secondary>in regular expressions</secondary>
16847 </indexterm>
16848 <indexterm role="concept">
16849 <primary>regular expressions</primary>
16850 <secondary>quoting</secondary>
16851 </indexterm>
16852 <indexterm role="concept">
16853 <primary><option>rxquote</option> expansion item</primary>
16854 </indexterm>
16855 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
16856 characters in its argument. This is useful when substituting the values of
16857 variables or headers inside regular expressions.
16858 </para>
16859 </listitem></varlistentry>
16860 <varlistentry>
16861 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16862 <listitem>
16863 <para>
16864 <indexterm role="concept">
16865 <primary>SHA-1 hash</primary>
16866 </indexterm>
16867 <indexterm role="concept">
16868 <primary>expansion</primary>
16869 <secondary>SHA-1 hashing</secondary>
16870 </indexterm>
16871 <indexterm role="concept">
16872 <primary>certificate</primary>
16873 <secondary>fingerprint</secondary>
16874 </indexterm>
16875 <indexterm role="concept">
16876 <primary><option>sha1</option> expansion item</primary>
16877 </indexterm>
16878 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
16879 it as a 40-digit hexadecimal number, in which any letters are in upper case.
16880 </para>
16881 <para>
16882 If the string is a single variable of type certificate,
16883 returns the SHA-1 hash fingerprint of the certificate.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16888 <term><emphasis role="bold">${sha2:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16889 <term><emphasis role="bold">${sha2_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16890 <listitem>
16891 <para>
16892 <indexterm role="concept">
16893 <primary>SHA-256 hash</primary>
16894 </indexterm>
16895 <indexterm role="concept">
16896 <primary>SHA-2 hash</primary>
16897 </indexterm>
16898 <indexterm role="concept">
16899 <primary>certificate</primary>
16900 <secondary>fingerprint</secondary>
16901 </indexterm>
16902 <indexterm role="concept">
16903 <primary>expansion</primary>
16904 <secondary>SHA-256 hashing</secondary>
16905 </indexterm>
16906 <indexterm role="concept">
16907 <primary><option>sha256</option> expansion item</primary>
16908 </indexterm>
16909 <indexterm role="concept">
16910 <primary><option>sha2</option> expansion item</primary>
16911 </indexterm>
16912 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16913 and returns
16914 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16915 </para>
16916 <para>
16917 If the string is a single variable of type certificate,
16918 returns the SHA-256 hash fingerprint of the certificate.
16919 </para>
16920 <para>
16921 The operator can also be spelled <option>sha2</option> and does the same as <option>sha256</option>
16922 (except for certificates, which are not supported).
16923 Finally, if an underbar
16924 and a number is appended it specifies the output length, selecting a
16925 member of the SHA-2 family of hash functions.
16926 Values of 256, 384 and 512 are accepted, with 256 being the default.
16927 </para>
16928 </listitem></varlistentry>
16929 <varlistentry>
16930 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16931 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16932 <listitem>
16933 <para>
16934 <indexterm role="concept">
16935 <primary>SHA3 hash</primary>
16936 </indexterm>
16937 <indexterm role="concept">
16938 <primary>expansion</primary>
16939 <secondary>SHA3 hashing</secondary>
16940 </indexterm>
16941 <indexterm role="concept">
16942 <primary><option>sha3</option> expansion item</primary>
16943 </indexterm>
16944 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16945 and returns
16946 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16947 </para>
16948 <para>
16949 If a number is appended, separated by an underbar, it specifies
16950 the output length.  Values of 224, 256, 384 and 512 are accepted;
16951 with 256 being the default.
16952 </para>
16953 <para>
16954 The <option>sha3</option> expansion item is only supported if Exim has been
16955 compiled with GnuTLS 3.5.0 or later,
16956 or OpenSSL 1.1.1 or later.
16957 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
16958 </para>
16959 </listitem></varlistentry>
16960 <varlistentry>
16961 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16962 <listitem>
16963 <para>
16964 <indexterm role="concept">
16965 <primary>expansion</primary>
16966 <secondary>statting a file</secondary>
16967 </indexterm>
16968 <indexterm role="concept">
16969 <primary>file</primary>
16970 <secondary>extracting characteristics</secondary>
16971 </indexterm>
16972 <indexterm role="concept">
16973 <primary><option>stat</option> expansion item</primary>
16974 </indexterm>
16975 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16976 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16977 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16978 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16979 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16980 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16981 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16982 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16983 can extract individual fields using the <option>extract</option> expansion item.
16984 </para>
16985 <para>
16986 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16987 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16988 systems for files larger than 2GB.
16989 </para>
16990 </listitem></varlistentry>
16991 <varlistentry>
16992 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16993 <listitem>
16994 <para>
16995 <indexterm role="concept">
16996 <primary><option>str2b64</option> expansion item</primary>
16997 </indexterm>
16998 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16999 </para>
17000 </listitem></varlistentry>
17001 <varlistentry>
17002 <term><emphasis role="bold">${strlen:</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>string length</secondary>
17008 </indexterm>
17009 <indexterm role="concept">
17010 <primary>string</primary>
17011 <secondary>length in expansion</secondary>
17012 </indexterm>
17013 <indexterm role="concept">
17014 <primary><option>strlen</option> expansion item</primary>
17015 </indexterm>
17016 The item is replace by the length of the expanded string, expressed as a
17017 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
17018 All measurement is done in bytes and is not UTF-8 aware.
17019 </para>
17020 </listitem></varlistentry>
17021 <varlistentry>
17022 <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>
17023 <listitem>
17024 <para>
17025 <indexterm role="concept">
17026 <primary><option>substr</option> expansion item</primary>
17027 </indexterm>
17028 <indexterm role="concept">
17029 <primary>substring extraction</primary>
17030 </indexterm>
17031 <indexterm role="concept">
17032 <primary>expansion</primary>
17033 <secondary>substring expansion</secondary>
17034 </indexterm>
17035 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
17036 can be used when the two parameters are fixed numbers (as opposed to strings
17037 that change when expanded). The effect is the same as
17038 </para>
17039 <literallayout class="monospaced">
17040 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
17041 </literallayout>
17042 <para>
17043 See the description of the general <option>substr</option> item above for details. The
17044 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
17045 All measurement is done in bytes and is not UTF-8 aware.
17046 </para>
17047 </listitem></varlistentry>
17048 <varlistentry>
17049 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17050 <listitem>
17051 <para>
17052 <indexterm role="concept">
17053 <primary><option>time_eval</option> expansion item</primary>
17054 </indexterm>
17055 <indexterm role="concept">
17056 <primary>time interval</primary>
17057 <secondary>decoding</secondary>
17058 </indexterm>
17059 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
17060 seconds.
17061 </para>
17062 </listitem></varlistentry>
17063 <varlistentry>
17064 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17065 <listitem>
17066 <para>
17067 <indexterm role="concept">
17068 <primary><option>time_interval</option> expansion item</primary>
17069 </indexterm>
17070 <indexterm role="concept">
17071 <primary>time interval</primary>
17072 <secondary>formatting</secondary>
17073 </indexterm>
17074 The argument (after sub-expansion) must be a sequence of decimal digits that
17075 represents an interval of time as a number of seconds. It is converted into a
17076 number of larger units and output in Exim&#x2019;s normal time format, for example,
17077 <literal>1w3d4h2m6s</literal>.
17078 </para>
17079 </listitem></varlistentry>
17080 <varlistentry>
17081 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17082 <listitem>
17083 <para>
17084 <indexterm role="concept">
17085 <primary>case forcing in strings</primary>
17086 </indexterm>
17087 <indexterm role="concept">
17088 <primary>string</primary>
17089 <secondary>case forcing</secondary>
17090 </indexterm>
17091 <indexterm role="concept">
17092 <primary>upper casing</primary>
17093 </indexterm>
17094 <indexterm role="concept">
17095 <primary>expansion</primary>
17096 <secondary>case forcing</secondary>
17097 </indexterm>
17098 <indexterm role="concept">
17099 <primary><option>uc</option> expansion item</primary>
17100 </indexterm>
17101 This forces the letters in the string into upper-case.
17102 Case is defined per the system C locale.
17103 </para>
17104 </listitem></varlistentry>
17105 <varlistentry>
17106 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17107 <listitem>
17108 <para>
17109 <indexterm role="concept">
17110 <primary>correction of invalid utf-8 sequences in strings</primary>
17111 </indexterm>
17112 <indexterm role="concept">
17113 <primary>utf-8</primary>
17114 <secondary>utf-8 sequences</secondary>
17115 </indexterm>
17116 <indexterm role="concept">
17117 <primary>incorrect utf-8</primary>
17118 </indexterm>
17119 <indexterm role="concept">
17120 <primary>expansion</primary>
17121 <secondary>utf-8 forcing</secondary>
17122 </indexterm>
17123 <indexterm role="concept">
17124 <primary><option>utf8clean</option> expansion item</primary>
17125 </indexterm>
17126 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
17127 In versions of Exim before 4.92, this did not correctly do so for a truncated
17128 final codepoint&#x2019;s encoding, and the character would be silently dropped.
17129 If you must handle detection of this scenario across both sets of Exim behavior,
17130 the complexity will depend upon the task.
17131 For instance, to detect if the first character is multibyte and a 1-byte
17132 extraction can be successfully used as a path component (as is common for
17133 dividing up delivery folders), you might use:
17134 </para>
17135 <literallayout class="monospaced">
17136 condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}}
17137 </literallayout>
17138 <para>
17139 (which will false-positive if the first character of the local part is a
17140 literal question mark).
17141 </para>
17142 </listitem></varlistentry>
17143 <varlistentry>
17144 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17145 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17146 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17147 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17148 <listitem>
17149 <para>
17150 <indexterm role="concept">
17151 <primary>expansion</primary>
17152 <secondary>UTF-8</secondary>
17153 </indexterm>
17154 <indexterm role="concept">
17155 <primary>UTF-8</primary>
17156 <secondary>expansion</secondary>
17157 </indexterm>
17158 <indexterm role="concept">
17159 <primary>EAI</primary>
17160 </indexterm>
17161 <indexterm role="concept">
17162 <primary>internationalisation</primary>
17163 </indexterm>
17164 <indexterm role="concept">
17165 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
17166 </indexterm>
17167 <indexterm role="concept">
17168 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
17169 </indexterm>
17170 <indexterm role="concept">
17171 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
17172 </indexterm>
17173 <indexterm role="concept">
17174 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
17175 </indexterm>
17176 These convert EAI mail name components between UTF-8 and a-label forms.
17177 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
17178 </para>
17179 </listitem></varlistentry>
17180 </variablelist>
17181 </section>
17182 <section id="SECTexpcond">
17183 <title>Expansion conditions</title>
17184 <para>
17185 <indexterm role="concept" id="IIDexpcond" class="startofrange">
17186 <primary>expansion</primary>
17187 <secondary>conditions</secondary>
17188 </indexterm>
17189 The following conditions are available for testing by the <option>${if</option> construct
17190 while expanding strings:
17191 </para>
17192 <variablelist>
17193 <varlistentry>
17194 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
17195 <listitem>
17196 <para>
17197 <indexterm role="concept">
17198 <primary>expansion</primary>
17199 <secondary>negating a condition</secondary>
17200 </indexterm>
17201 <indexterm role="concept">
17202 <primary>negation</primary>
17203 <secondary>in expansion condition</secondary>
17204 </indexterm>
17205 Preceding any condition with an exclamation mark negates the result of the
17206 condition.
17207 </para>
17208 </listitem></varlistentry>
17209 <varlistentry>
17210 <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>
17211 <listitem>
17212 <para>
17213 <indexterm role="concept">
17214 <primary>numeric comparison</primary>
17215 </indexterm>
17216 <indexterm role="concept">
17217 <primary>expansion</primary>
17218 <secondary>numeric comparison</secondary>
17219 </indexterm>
17220 There are a number of symbolic operators for doing numeric comparisons. They
17221 are:
17222 </para>
17223 <literallayout>
17224 <literal>=   </literal>   equal
17225 <literal>==  </literal>   equal
17226 <literal>&gt;   </literal>   greater
17227 <literal>&gt;=  </literal>   greater or equal
17228 <literal>&lt;   </literal>   less
17229 <literal>&lt;=  </literal>   less or equal
17230 </literallayout>
17231 <para>
17232 For example:
17233 </para>
17234 <literallayout class="monospaced">
17235 ${if &gt;{$message_size}{10M} ...
17236 </literallayout>
17237 <para>
17238 Note that the general negation operator provides for inequality testing. The
17239 two strings must take the form of optionally signed decimal integers,
17240 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
17241 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
17242 As a special case, the numerical value of an empty string is taken as
17243 zero.
17244 </para>
17245 <para>
17246 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
17247 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
17248 10M, not if 10M is larger than <varname>$message_size</varname>.
17249 </para>
17250 </listitem></varlistentry>
17251 <varlistentry>
17252 <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>
17253 <listitem>
17254 <para>
17255 <indexterm role="concept">
17256 <primary>expansion</primary>
17257 <secondary>calling an acl</secondary>
17258 </indexterm>
17259 <indexterm role="concept">
17260 <primary><option>acl</option></primary>
17261 <secondary>expansion condition</secondary>
17262 </indexterm>
17263 The name and zero to nine argument strings are first expanded separately.  The expanded
17264 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
17265 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
17266 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
17267 and may use the variables; if another acl expansion is used the values
17268 are restored after it returns.  If the ACL sets
17269 a value using a "message =" modifier the variable $value becomes
17270 the result of the expansion, otherwise it is empty.
17271 If the ACL returns accept the condition is true; if deny, false.
17272 If the ACL returns defer the result is a forced-fail.
17273 </para>
17274 </listitem></varlistentry>
17275 <varlistentry>
17276 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17277 <listitem>
17278 <para>
17279 <indexterm role="concept">
17280 <primary>expansion</primary>
17281 <secondary>boolean parsing</secondary>
17282 </indexterm>
17283 <indexterm role="concept">
17284 <primary><option>bool</option> expansion condition</primary>
17285 </indexterm>
17286 This condition turns a string holding a true or false representation into
17287 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
17288 (case-insensitively); also integer numbers map to true if non-zero,
17289 false if zero.
17290 An empty string is treated as false.
17291 Leading and trailing whitespace is ignored;
17292 thus a string consisting only of whitespace is false.
17293 All other string values will result in expansion failure.
17294 </para>
17295 <para>
17296 When combined with ACL variables, this expansion condition will let you
17297 make decisions in one place and act on those decisions in another place.
17298 For example:
17299 </para>
17300 <literallayout class="monospaced">
17301 ${if bool{$acl_m_privileged_sender} ...
17302 </literallayout>
17303 </listitem></varlistentry>
17304 <varlistentry>
17305 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17306 <listitem>
17307 <para>
17308 <indexterm role="concept">
17309 <primary>expansion</primary>
17310 <secondary>boolean parsing</secondary>
17311 </indexterm>
17312 <indexterm role="concept">
17313 <primary><option>bool_lax</option> expansion condition</primary>
17314 </indexterm>
17315 Like <option>bool</option>, this condition turns a string into a boolean state.  But
17316 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
17317 loose definition that the Router <option>condition</option> option uses.  The empty string
17318 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
17319 true.  Leading and trailing whitespace is ignored.
17320 </para>
17321 <para>
17322 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
17323 </para>
17324 </listitem></varlistentry>
17325 <varlistentry>
17326 <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>
17327 <listitem>
17328 <para>
17329 <indexterm role="concept">
17330 <primary>expansion</primary>
17331 <secondary>encrypted comparison</secondary>
17332 </indexterm>
17333 <indexterm role="concept">
17334 <primary>encrypted strings, comparing</primary>
17335 </indexterm>
17336 <indexterm role="concept">
17337 <primary><option>crypteq</option> expansion condition</primary>
17338 </indexterm>
17339 This condition is included in the Exim binary if it is built to support any
17340 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
17341 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
17342 included in the binary.
17343 </para>
17344 <para>
17345 The <option>crypteq</option> condition has two arguments. The first is encrypted and
17346 compared against the second, which is already encrypted. The second string may
17347 be in the LDAP form for storing encrypted strings, which starts with the
17348 encryption type in curly brackets, followed by the data. If the second string
17349 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
17350 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
17351 Typically this will be a field from a password file. An example of an encrypted
17352 string in LDAP form is:
17353 </para>
17354 <literallayout class="monospaced">
17355 {md5}CY9rzUYh03PK3k6DJie09g==
17356 </literallayout>
17357 <para>
17358 If such a string appears directly in an expansion, the curly brackets have to
17359 be quoted, because they are part of the expansion syntax. For example:
17360 </para>
17361 <literallayout class="monospaced">
17362 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
17363 </literallayout>
17364 <para>
17365 The following encryption types (whose names are matched case-independently) are
17366 supported:
17367 </para>
17368 <itemizedlist>
17369 <listitem>
17370 <para>
17371 <indexterm role="concept">
17372 <primary>MD5 hash</primary>
17373 </indexterm>
17374 <indexterm role="concept">
17375 <primary>base64 encoding</primary>
17376 <secondary>in encrypted password</secondary>
17377 </indexterm>
17378 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
17379 printable characters to compare with the remainder of the second string. If the
17380 length of the comparison string is 24, Exim assumes that it is base64 encoded
17381 (as in the above example). If the length is 32, Exim assumes that it is a
17382 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
17383 comparison fails.
17384 </para>
17385 </listitem>
17386 <listitem>
17387 <para>
17388 <indexterm role="concept">
17389 <primary>SHA-1 hash</primary>
17390 </indexterm>
17391 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
17392 printable characters to compare with the remainder of the second string. If the
17393 length of the comparison string is 28, Exim assumes that it is base64 encoded.
17394 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
17395 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
17396 </para>
17397 </listitem>
17398 <listitem>
17399 <para>
17400 <indexterm role="concept">
17401 <primary><function>crypt()</function></primary>
17402 </indexterm>
17403 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
17404 only the first eight characters of the password. However, in modern operating
17405 systems this is no longer true, and in many cases the entire password is used,
17406 whatever its length.
17407 </para>
17408 </listitem>
17409 <listitem>
17410 <para>
17411 <indexterm role="concept">
17412 <primary><function>crypt16()</function></primary>
17413 </indexterm>
17414 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
17415 use up to 16 characters of the password in some operating systems. Again, in
17416 modern operating systems, more characters may be used.
17417 </para>
17418 </listitem>
17419 </itemizedlist>
17420 <para>
17421 Exim has its own version of <function>crypt16()</function>, which is just a double call to
17422 <function>crypt()</function>. For operating systems that have their own version, setting
17423 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
17424 operating system version instead of its own. This option is set by default in
17425 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
17426 support <function>crypt16()</function>.
17427 </para>
17428 <para>
17429 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
17430 it was not using the same algorithm as some operating systems&#x2019; versions. It
17431 turns out that as well as <function>crypt16()</function> there is a function called
17432 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
17433 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
17434 </para>
17435 <para>
17436 However, since there is now a move away from the traditional <function>crypt()</function>
17437 functions towards using SHA1 and other algorithms, tidying up this area of
17438 Exim is seen as very low priority.
17439 </para>
17440 <para>
17441 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
17442 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
17443 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
17444 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
17445 function by specifying it explicitly in curly brackets.
17446 </para>
17447 </listitem></varlistentry>
17448 <varlistentry>
17449 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
17450 <listitem>
17451 <para>
17452 <indexterm role="concept">
17453 <primary>expansion</primary>
17454 <secondary>checking for empty variable</secondary>
17455 </indexterm>
17456 <indexterm role="concept">
17457 <primary><option>def</option> expansion condition</primary>
17458 </indexterm>
17459 The <option>def</option> condition must be followed by the name of one of the expansion
17460 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
17461 variable does not contain the empty string. For example:
17462 </para>
17463 <literallayout class="monospaced">
17464 ${if def:sender_ident {from $sender_ident}}
17465 </literallayout>
17466 <para>
17467 Note that the variable name is given without a leading <option>$</option> character. If the
17468 variable does not exist, the expansion fails.
17469 </para>
17470 </listitem></varlistentry>
17471 <varlistentry>
17472 <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>
17473 <listitem>
17474 <para>
17475 <indexterm role="concept">
17476 <primary>expansion</primary>
17477 <secondary>checking header line existence</secondary>
17478 </indexterm>
17479 This condition is true if a message is being processed and the named header
17480 exists in the message. For example,
17481 </para>
17482 <literallayout class="monospaced">
17483 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
17484 </literallayout>
17485 <para>
17486 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
17487 the header name must be terminated by a colon if white space does not follow.
17488 </para>
17489 </listitem></varlistentry>
17490 <varlistentry>
17491 <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>
17492 <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>
17493 <listitem>
17494 <para>
17495 <indexterm role="concept">
17496 <primary>string</primary>
17497 <secondary>comparison</secondary>
17498 </indexterm>
17499 <indexterm role="concept">
17500 <primary>expansion</primary>
17501 <secondary>string comparison</secondary>
17502 </indexterm>
17503 <indexterm role="concept">
17504 <primary><option>eq</option> expansion condition</primary>
17505 </indexterm>
17506 <indexterm role="concept">
17507 <primary><option>eqi</option> expansion condition</primary>
17508 </indexterm>
17509 The two substrings are first expanded. The condition is true if the two
17510 resulting strings are identical. For <option>eq</option> the comparison includes the case of
17511 letters, whereas for <option>eqi</option> the comparison is case-independent, where
17512 case is defined per the system C locale.
17513 </para>
17514 </listitem></varlistentry>
17515 <varlistentry>
17516 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17517 <listitem>
17518 <para>
17519 <indexterm role="concept">
17520 <primary>expansion</primary>
17521 <secondary>file existence test</secondary>
17522 </indexterm>
17523 <indexterm role="concept">
17524 <primary>file</primary>
17525 <secondary>existence test</secondary>
17526 </indexterm>
17527 <indexterm role="concept">
17528 <primary><option>exists</option>, expansion condition</primary>
17529 </indexterm>
17530 The substring is first expanded and then interpreted as an absolute path. The
17531 condition is true if the named file (or directory) exists. The existence test
17532 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
17533 users&#x2019; filter files may be locked out by the system administrator.
17534 </para>
17535 </listitem></varlistentry>
17536 <varlistentry>
17537 <term><emphasis role="bold">first_delivery</emphasis></term>
17538 <listitem>
17539 <para>
17540 <indexterm role="concept">
17541 <primary>delivery</primary>
17542 <secondary>first</secondary>
17543 </indexterm>
17544 <indexterm role="concept">
17545 <primary>first delivery</primary>
17546 </indexterm>
17547 <indexterm role="concept">
17548 <primary>expansion</primary>
17549 <secondary>first delivery test</secondary>
17550 </indexterm>
17551 <indexterm role="concept">
17552 <primary><option>first_delivery</option> expansion condition</primary>
17553 </indexterm>
17554 This condition, which has no data, is true during a message&#x2019;s first delivery
17555 attempt. It is false during any subsequent delivery attempts.
17556 </para>
17557 </listitem></varlistentry>
17558 <varlistentry>
17559 <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>
17560 <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>
17561 <listitem>
17562 <para>
17563 <indexterm role="concept">
17564 <primary>list</primary>
17565 <secondary>iterative conditions</secondary>
17566 </indexterm>
17567 <indexterm role="concept">
17568 <primary>expansion</primary>
17569 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
17570 </indexterm>
17571 <indexterm role="concept">
17572 <primary>expansion</primary>
17573 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
17574 </indexterm>
17575 <indexterm role="variable">
17576 <primary><varname>$item</varname></primary>
17577 </indexterm>
17578 These conditions iterate over a list. The first argument is expanded to form
17579 the list. By default, the list separator is a colon, but it can be changed by
17580 the normal method (<xref linkend="SECTlistsepchange"/>).
17581 The second argument is interpreted as a condition that is to
17582 be applied to each item in the list in turn. During the interpretation of the
17583 condition, the current list item is placed in a variable called <varname>$item</varname>.
17584 </para>
17585 <itemizedlist>
17586 <listitem>
17587 <para>
17588 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
17589 the result of the whole condition is true. If the condition is false for all
17590 items in the list, the overall condition is false.
17591 </para>
17592 </listitem>
17593 <listitem>
17594 <para>
17595 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
17596 and the result of the whole condition is false. If the condition is true for
17597 all items in the list, the overall condition is true.
17598 </para>
17599 </listitem>
17600 </itemizedlist>
17601 <para>
17602 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
17603 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
17604 that the condition must be false for at least one item. In this example, the
17605 list separator is changed to a comma:
17606 </para>
17607 <literallayout class="monospaced">
17608 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
17609 </literallayout>
17610 <para>
17611 The value of <varname>$item</varname> is saved and restored while <option>forany</option> or <option>forall</option> is
17612 being processed, to enable these expansion items to be nested.
17613 </para>
17614 <para>
17615 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
17616 </para>
17617 </listitem></varlistentry>
17618 <varlistentry>
17619 <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>
17620 <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>
17621 <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>
17622 <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>
17623 <listitem>
17624 <para>
17625 <indexterm role="concept">
17626 <primary>JSON</primary>
17627 <secondary>iterative conditions</secondary>
17628 </indexterm>
17629 <indexterm role="concept">
17630 <primary>JSON</primary>
17631 <secondary>expansions</secondary>
17632 </indexterm>
17633 <indexterm role="concept">
17634 <primary>expansion</primary>
17635 <secondary><emphasis role="bold">forall_json</emphasis> condition</secondary>
17636 </indexterm>
17637 <indexterm role="concept">
17638 <primary>expansion</primary>
17639 <secondary><emphasis role="bold">forany_json</emphasis> condition</secondary>
17640 </indexterm>
17641 <indexterm role="concept">
17642 <primary>expansion</primary>
17643 <secondary><emphasis role="bold">forall_jsons</emphasis> condition</secondary>
17644 </indexterm>
17645 <indexterm role="concept">
17646 <primary>expansion</primary>
17647 <secondary><emphasis role="bold">forany_jsons</emphasis> condition</secondary>
17648 </indexterm>
17649 As for the above, except that the first argument must, after expansion,
17650 be a JSON array.
17651 The array separator is not changeable.
17652 For the <quote>jsons</quote> variants the elements are expected to be JSON strings
17653 and have their quotes removed before the evaluation of the condition.
17654 </para>
17655 </listitem></varlistentry>
17656 <varlistentry>
17657 <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>
17658 <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>
17659 <listitem>
17660 <para>
17661 <indexterm role="concept">
17662 <primary>string</primary>
17663 <secondary>comparison</secondary>
17664 </indexterm>
17665 <indexterm role="concept">
17666 <primary>expansion</primary>
17667 <secondary>string comparison</secondary>
17668 </indexterm>
17669 <indexterm role="concept">
17670 <primary><option>ge</option> expansion condition</primary>
17671 </indexterm>
17672 <indexterm role="concept">
17673 <primary><option>gei</option> expansion condition</primary>
17674 </indexterm>
17675 The two substrings are first expanded. The condition is true if the first
17676 string is lexically greater than or equal to the second string. For <option>ge</option> the
17677 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
17678 case-independent.
17679 Case and collation order are defined per the system C locale.
17680 </para>
17681 </listitem></varlistentry>
17682 <varlistentry>
17683 <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>
17684 <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>
17685 <listitem>
17686 <para>
17687 <indexterm role="concept">
17688 <primary>string</primary>
17689 <secondary>comparison</secondary>
17690 </indexterm>
17691 <indexterm role="concept">
17692 <primary>expansion</primary>
17693 <secondary>string comparison</secondary>
17694 </indexterm>
17695 <indexterm role="concept">
17696 <primary><option>gt</option> expansion condition</primary>
17697 </indexterm>
17698 <indexterm role="concept">
17699 <primary><option>gti</option> expansion condition</primary>
17700 </indexterm>
17701 The two substrings are first expanded. The condition is true if the first
17702 string is lexically greater than the second string. For <option>gt</option> the comparison
17703 includes the case of letters, whereas for <option>gti</option> the comparison is
17704 case-independent.
17705 Case and collation order are defined per the system C locale.
17706 </para>
17707 </listitem></varlistentry>
17708 <varlistentry>
17709 <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>
17710 <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>
17711 <listitem>
17712 <para>
17713 <indexterm role="concept">
17714 <primary>string</primary>
17715 <secondary>comparison</secondary>
17716 </indexterm>
17717 <indexterm role="concept">
17718 <primary>list</primary>
17719 <secondary>iterative conditions</secondary>
17720 </indexterm>
17721 Both strings are expanded; the second string is treated as a list of simple
17722 strings; if the first string is a member of the second, then the condition
17723 is true.
17724 For the case-independent <option>inlisti</option> condition, case is defined per the system C locale.
17725 </para>
17726 <para>
17727 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
17728 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
17729 </para>
17730 <literallayout class="monospaced">
17731 ${if inlist{needle}{foo:needle:bar}}
17732   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
17733 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
17734   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
17735 </literallayout>
17736 </listitem></varlistentry>
17737 <varlistentry>
17738 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17739 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17740 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17741 <listitem>
17742 <para>
17743 <indexterm role="concept">
17744 <primary>IP address</primary>
17745 <secondary>testing string format</secondary>
17746 </indexterm>
17747 <indexterm role="concept">
17748 <primary>string</primary>
17749 <secondary>testing for IP address</secondary>
17750 </indexterm>
17751 <indexterm role="concept">
17752 <primary><option>isip</option> expansion condition</primary>
17753 </indexterm>
17754 <indexterm role="concept">
17755 <primary><option>isip4</option> expansion condition</primary>
17756 </indexterm>
17757 <indexterm role="concept">
17758 <primary><option>isip6</option> expansion condition</primary>
17759 </indexterm>
17760 The substring is first expanded, and then tested to see if it has the form of
17761 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
17762 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
17763 </para>
17764 <para>
17765 For an IPv4 address, the test is for four dot-separated components, each of
17766 which consists of from one to three digits. For an IPv6 address, up to eight
17767 colon-separated components are permitted, each containing from one to four
17768 hexadecimal digits. There may be fewer than eight components if an empty
17769 component (adjacent colons) is present. Only one empty component is permitted.
17770 </para>
17771 <para>
17772 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
17773 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
17774 check.
17775 This is no longer the case.
17776 </para>
17777 <para>
17778 The main use of these tests is to distinguish between IP addresses and
17779 host names, or between IPv4 and IPv6 addresses. For example, you could use
17780 </para>
17781 <literallayout class="monospaced">
17782 ${if isip4{$sender_host_address}...
17783 </literallayout>
17784 <para>
17785 to test which IP version an incoming SMTP connection is using.
17786 </para>
17787 </listitem></varlistentry>
17788 <varlistentry>
17789 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17790 <listitem>
17791 <para>
17792 <indexterm role="concept">
17793 <primary>LDAP</primary>
17794 <secondary>use for authentication</secondary>
17795 </indexterm>
17796 <indexterm role="concept">
17797 <primary>expansion</primary>
17798 <secondary>LDAP authentication test</secondary>
17799 </indexterm>
17800 <indexterm role="concept">
17801 <primary><option>ldapauth</option> expansion condition</primary>
17802 </indexterm>
17803 This condition supports user authentication using LDAP. See section
17804 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
17805 queries. For this use, the query must contain a user name and password. The
17806 query itself is not used, and can be empty. The condition is true if the
17807 password is not empty, and the user name and password are accepted by the LDAP
17808 server. An empty password is rejected without calling LDAP because LDAP binds
17809 with an empty password are considered anonymous regardless of the username, and
17810 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
17811 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
17812 this can be used.
17813 </para>
17814 </listitem></varlistentry>
17815 <varlistentry>
17816 <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>
17817 <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>
17818 <listitem>
17819 <para>
17820 <indexterm role="concept">
17821 <primary>string</primary>
17822 <secondary>comparison</secondary>
17823 </indexterm>
17824 <indexterm role="concept">
17825 <primary>expansion</primary>
17826 <secondary>string comparison</secondary>
17827 </indexterm>
17828 <indexterm role="concept">
17829 <primary><option>le</option> expansion condition</primary>
17830 </indexterm>
17831 <indexterm role="concept">
17832 <primary><option>lei</option> expansion condition</primary>
17833 </indexterm>
17834 The two substrings are first expanded. The condition is true if the first
17835 string is lexically less than or equal to the second string. For <option>le</option> the
17836 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
17837 case-independent.
17838 Case and collation order are defined per the system C locale.
17839 </para>
17840 </listitem></varlistentry>
17841 <varlistentry>
17842 <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>
17843 <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>
17844 <listitem>
17845 <para>
17846 <indexterm role="concept">
17847 <primary>string</primary>
17848 <secondary>comparison</secondary>
17849 </indexterm>
17850 <indexterm role="concept">
17851 <primary>expansion</primary>
17852 <secondary>string comparison</secondary>
17853 </indexterm>
17854 <indexterm role="concept">
17855 <primary><option>lt</option> expansion condition</primary>
17856 </indexterm>
17857 <indexterm role="concept">
17858 <primary><option>lti</option> expansion condition</primary>
17859 </indexterm>
17860 The two substrings are first expanded. The condition is true if the first
17861 string is lexically less than the second string. For <option>lt</option> the comparison
17862 includes the case of letters, whereas for <option>lti</option> the comparison is
17863 case-independent.
17864 Case and collation order are defined per the system C locale.
17865 </para>
17866 </listitem></varlistentry>
17867 <varlistentry>
17868 <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>
17869 <listitem>
17870 <para>
17871 <indexterm role="concept">
17872 <primary>expansion</primary>
17873 <secondary>regular expression comparison</secondary>
17874 </indexterm>
17875 <indexterm role="concept">
17876 <primary>regular expressions</primary>
17877 <secondary>match in expanded string</secondary>
17878 </indexterm>
17879 <indexterm role="concept">
17880 <primary><option>match</option> expansion condition</primary>
17881 </indexterm>
17882 The two substrings are first expanded. The second is then treated as a regular
17883 expression and applied to the first. Because of the pre-expansion, if the
17884 regular expression contains dollar, or backslash characters, they must be
17885 escaped. Care must also be taken if the regular expression contains braces
17886 (curly brackets). A closing brace must be escaped so that it is not taken as a
17887 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
17888 <literal>\N</literal> feature to disable expansion of the regular expression.
17889 For example,
17890 </para>
17891 <literallayout class="monospaced">
17892 ${if match {$local_part}{\N^\d{3}\N} ...
17893 </literallayout>
17894 <para>
17895 If the whole expansion string is in double quotes, further escaping of
17896 backslashes is also required.
17897 </para>
17898 <para>
17899 The condition is true if the regular expression match succeeds.
17900 The regular expression is not required to begin with a circumflex
17901 metacharacter, but if there is no circumflex, the expression is not anchored,
17902 and it may match anywhere in the subject, not just at the start. If you want
17903 the pattern to match at the end of the subject, you must include the <literal>$</literal>
17904 metacharacter at an appropriate point.
17905 All character handling is done in bytes and is not UTF-8 aware,
17906 but we might change this in a future Exim release.
17907 </para>
17908 <para>
17909 <indexterm role="concept">
17910 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17911 <secondary>in <option>if</option> expansion</secondary>
17912 </indexterm>
17913 At the start of an <option>if</option> expansion the values of the numeric variable
17914 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
17915 succeeds causes them to be reset to the substrings of that condition and they
17916 will have these values during the expansion of the success string. At the end
17917 of the <option>if</option> expansion, the previous values are restored. After testing a
17918 combination of conditions using <option>or</option>, the subsequent values of the numeric
17919 variables are those of the condition that succeeded.
17920 </para>
17921 </listitem></varlistentry>
17922 <varlistentry>
17923 <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>
17924 <listitem>
17925 <para>
17926 <indexterm role="concept">
17927 <primary><option>match_address</option> expansion condition</primary>
17928 </indexterm>
17929 See <emphasis role="bold">match_local_part</emphasis>.
17930 </para>
17931 </listitem></varlistentry>
17932 <varlistentry>
17933 <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>
17934 <listitem>
17935 <para>
17936 <indexterm role="concept">
17937 <primary><option>match_domain</option> expansion condition</primary>
17938 </indexterm>
17939 See <emphasis role="bold">match_local_part</emphasis>.
17940 </para>
17941 </listitem></varlistentry>
17942 <varlistentry>
17943 <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>
17944 <listitem>
17945 <para>
17946 <indexterm role="concept">
17947 <primary><option>match_ip</option> expansion condition</primary>
17948 </indexterm>
17949 This condition matches an IP address to a list of IP address patterns. It must
17950 be followed by two argument strings. The first (after expansion) must be an IP
17951 address or an empty string. The second (not expanded) is a restricted host
17952 list that can match only an IP address, not a host name. For example:
17953 </para>
17954 <literallayout class="monospaced">
17955 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
17956 </literallayout>
17957 <para>
17958 The specific types of host list item that are permitted in the list are:
17959 </para>
17960 <itemizedlist>
17961 <listitem>
17962 <para>
17963 An IP address, optionally with a CIDR mask.
17964 </para>
17965 </listitem>
17966 <listitem>
17967 <para>
17968 A single asterisk, which matches any IP address.
17969 </para>
17970 </listitem>
17971 <listitem>
17972 <para>
17973 An empty item, which matches only if the IP address is empty. This could be
17974 useful for testing for a locally submitted message or one from specific hosts
17975 in a single test such as
17976 </para>
17977 <literallayout class="monospaced">
17978   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17979 </literallayout>
17980 <para>
17981 where the first item in the list is the empty string.
17982 </para>
17983 </listitem>
17984 <listitem>
17985 <para>
17986 The item @[] matches any of the local host&#x2019;s interface addresses.
17987 </para>
17988 </listitem>
17989 <listitem>
17990 <para>
17991 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17992 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17993 address into a host name. The most common type of linear search for
17994 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17995 masks. For example:
17996 </para>
17997 <literallayout class="monospaced">
17998   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17999 </literallayout>
18000 <para>
18001 It is of course possible to use other kinds of lookup, and in such a case, you
18002 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
18003 address mask, for example:
18004 </para>
18005 <literallayout class="monospaced">
18006   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
18007 </literallayout>
18008 <para>
18009 However, unless you are combining a <option>match_ip</option> condition with others, it is
18010 just as easy to use the fact that a lookup is itself a condition, and write:
18011 </para>
18012 <literallayout class="monospaced">
18013   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
18014 </literallayout>
18015 </listitem>
18016 </itemizedlist>
18017 <para>
18018 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18019 Exim was built with the EXPAND_LISTMATCH_RHS option.
18020 </para>
18021 <para>
18022 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
18023 </para>
18024 </listitem></varlistentry>
18025 <varlistentry>
18026 <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>
18027 <listitem>
18028 <para>
18029 <indexterm role="concept">
18030 <primary>domain list</primary>
18031 <secondary>in expansion condition</secondary>
18032 </indexterm>
18033 <indexterm role="concept">
18034 <primary>address list</primary>
18035 <secondary>in expansion condition</secondary>
18036 </indexterm>
18037 <indexterm role="concept">
18038 <primary>local part</primary>
18039 <secondary>list, in expansion condition</secondary>
18040 </indexterm>
18041 <indexterm role="concept">
18042 <primary><option>match_local_part</option> expansion condition</primary>
18043 </indexterm>
18044 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
18045 possible to test domain, address, and local part lists within expansions. Each
18046 condition requires two arguments: an item and a list to match. A trivial
18047 example is:
18048 </para>
18049 <literallayout class="monospaced">
18050 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
18051 </literallayout>
18052 <para>
18053 In each case, the second argument may contain any of the allowable items for a
18054 list of the appropriate type. Also, because the second argument
18055 is a standard form of list, it is possible to refer to a named list.
18056 Thus, you can use conditions like this:
18057 </para>
18058 <literallayout class="monospaced">
18059 ${if match_domain{$domain}{+local_domains}{...
18060 </literallayout>
18061 <para>
18062 <indexterm role="concept">
18063 <primary><literal>+caseful</literal></primary>
18064 </indexterm>
18065 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
18066 item can be used, as in all address lists, to cause subsequent items to
18067 have their local parts matched casefully. Domains are always matched
18068 caselessly.
18069 </para>
18070 <para>
18071 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18072 Exim was built with the EXPAND_LISTMATCH_RHS option.
18073 </para>
18074 <para>
18075 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
18076 hosts have two identities: a name and an IP address, and it is not clear
18077 how to specify cleanly how such a test would work. However, IP addresses can be
18078 matched using <option>match_ip</option>.
18079 </para>
18080 </listitem></varlistentry>
18081 <varlistentry>
18082 <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>
18083 <listitem>
18084 <para>
18085 <indexterm role="concept">
18086 <primary>PAM authentication</primary>
18087 </indexterm>
18088 <indexterm role="concept">
18089 <primary>AUTH</primary>
18090 <secondary>with PAM</secondary>
18091 </indexterm>
18092 <indexterm role="concept">
18093 <primary>Solaris</primary>
18094 <secondary>PAM support</secondary>
18095 </indexterm>
18096 <indexterm role="concept">
18097 <primary>expansion</primary>
18098 <secondary>PAM authentication test</secondary>
18099 </indexterm>
18100 <indexterm role="concept">
18101 <primary><option>pam</option> expansion condition</primary>
18102 </indexterm>
18103 <emphasis>Pluggable Authentication Modules</emphasis>
18104 (<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
18105 available in the latest releases of Solaris and in some GNU/Linux
18106 distributions. The Exim support, which is intended for use in conjunction with
18107 the SMTP AUTH command, is available only if Exim is compiled with
18108 </para>
18109 <literallayout class="monospaced">
18110 SUPPORT_PAM=yes
18111 </literallayout>
18112 <para>
18113 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
18114 in some releases of GNU/Linux <option>-ldl</option> is also needed.
18115 </para>
18116 <para>
18117 The argument string is first expanded, and the result must be a
18118 colon-separated list of strings. Leading and trailing white space is ignored.
18119 The PAM module is initialized with the service name <quote>exim</quote> and the user name
18120 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
18121 The remaining items in the data string are passed over in response to requests
18122 from the authentication function. In the simple case there will only be one
18123 request, for a password, so the data consists of just two strings.
18124 </para>
18125 <para>
18126 There can be problems if any of the strings are permitted to contain colon
18127 characters. In the usual way, these have to be doubled to avoid being taken as
18128 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
18129 item can be used to double any existing colons. For example, the configuration
18130 of a LOGIN authenticator might contain this setting:
18131 </para>
18132 <literallayout class="monospaced">
18133 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
18134 </literallayout>
18135 <para>
18136 For a PLAIN authenticator you could use:
18137 </para>
18138 <literallayout class="monospaced">
18139 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
18140 </literallayout>
18141 <para>
18142 In some operating systems, PAM authentication can be done only from a process
18143 running as root. Since Exim is running as the Exim user when receiving
18144 messages, this means that PAM cannot be used directly in those systems.
18145 </para>
18146 </listitem></varlistentry>
18147 <varlistentry>
18148 <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>
18149 <listitem>
18150 <para>
18151 <indexterm role="concept">
18152 <primary><emphasis>pwcheck</emphasis> daemon</primary>
18153 </indexterm>
18154 <indexterm role="concept">
18155 <primary>Cyrus</primary>
18156 </indexterm>
18157 <indexterm role="concept">
18158 <primary>expansion</primary>
18159 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
18160 </indexterm>
18161 <indexterm role="concept">
18162 <primary><option>pwcheck</option> expansion condition</primary>
18163 </indexterm>
18164 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
18165 This is one way of making it possible for passwords to be checked by a process
18166 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
18167 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
18168 </para>
18169 <para>
18170 The pwcheck support is not included in Exim by default. You need to specify
18171 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18172 building Exim. For example:
18173 </para>
18174 <literallayout class="monospaced">
18175 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
18176 </literallayout>
18177 <para>
18178 You do not need to install the full Cyrus software suite in order to use
18179 the pwcheck daemon. You can compile and install just the daemon alone
18180 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
18181 access to the <filename>/var/pwcheck</filename> directory.
18182 </para>
18183 <para>
18184 The <option>pwcheck</option> condition takes one argument, which must be the user name and
18185 password, separated by a colon. For example, in a LOGIN authenticator
18186 configuration, you might have this:
18187 </para>
18188 <literallayout class="monospaced">
18189 server_condition = ${if pwcheck{$auth1:$auth2}}
18190 </literallayout>
18191 <para>
18192 Again, for a PLAIN authenticator configuration, this would be:
18193 </para>
18194 <literallayout class="monospaced">
18195 server_condition = ${if pwcheck{$auth2:$auth3}}
18196 </literallayout>
18197 </listitem></varlistentry>
18198 <varlistentry>
18199 <term><emphasis role="bold">queue_running</emphasis></term>
18200 <listitem>
18201 <para>
18202 <indexterm role="concept">
18203 <primary>queue runner</primary>
18204 <secondary>detecting when delivering from</secondary>
18205 </indexterm>
18206 <indexterm role="concept">
18207 <primary>expansion</primary>
18208 <secondary>queue runner test</secondary>
18209 </indexterm>
18210 <indexterm role="concept">
18211 <primary><option>queue_running</option> expansion condition</primary>
18212 </indexterm>
18213 This condition, which has no data, is true during delivery attempts that are
18214 initiated by queue runner processes, and false otherwise.
18215 </para>
18216 </listitem></varlistentry>
18217 <varlistentry>
18218 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18219 <listitem>
18220 <para>
18221 <indexterm role="concept">
18222 <primary>Radius</primary>
18223 </indexterm>
18224 <indexterm role="concept">
18225 <primary>expansion</primary>
18226 <secondary>Radius authentication</secondary>
18227 </indexterm>
18228 <indexterm role="concept">
18229 <primary><option>radius</option> expansion condition</primary>
18230 </indexterm>
18231 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
18232 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
18233 the Radius client configuration file in order to build Exim with Radius
18234 support.
18235 </para>
18236 <para>
18237 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
18238 library, using the original API. If you are using release 0.4.0 or later of
18239 this library, you need to set
18240 </para>
18241 <literallayout class="monospaced">
18242 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
18243 </literallayout>
18244 <para>
18245 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
18246 <option>libradius</option> library that comes with FreeBSD. To do this, set
18247 </para>
18248 <literallayout class="monospaced">
18249 RADIUS_LIB_TYPE=RADLIB
18250 </literallayout>
18251 <para>
18252 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
18253 You may also have to supply a suitable setting in EXTRALIBS so that the
18254 Radius library can be found when Exim is linked.
18255 </para>
18256 <para>
18257 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
18258 Radius client library, which calls the Radius server. The condition is true if
18259 the authentication is successful. For example:
18260 </para>
18261 <literallayout class="monospaced">
18262 server_condition = ${if radius{&lt;arguments&gt;}}
18263 </literallayout>
18264 </listitem></varlistentry>
18265 <varlistentry>
18266 <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>
18267 <listitem>
18268 <para>
18269 <indexterm role="concept">
18270 <primary><emphasis>saslauthd</emphasis> daemon</primary>
18271 </indexterm>
18272 <indexterm role="concept">
18273 <primary>Cyrus</primary>
18274 </indexterm>
18275 <indexterm role="concept">
18276 <primary>expansion</primary>
18277 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
18278 </indexterm>
18279 <indexterm role="concept">
18280 <primary><option>saslauthd</option> expansion condition</primary>
18281 </indexterm>
18282 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
18283 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
18284 Using this daemon is one way of making it possible for passwords to be checked
18285 by a process that is not running as root.
18286 </para>
18287 <para>
18288 The saslauthd support is not included in Exim by default. You need to specify
18289 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18290 building Exim. For example:
18291 </para>
18292 <literallayout class="monospaced">
18293 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
18294 </literallayout>
18295 <para>
18296 You do not need to install the full Cyrus software suite in order to use
18297 the saslauthd daemon. You can compile and install just the daemon alone
18298 from the Cyrus SASL library.
18299 </para>
18300 <para>
18301 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
18302 two are mandatory. For example:
18303 </para>
18304 <literallayout class="monospaced">
18305 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
18306 </literallayout>
18307 <para>
18308 The service and the realm are optional (which is why the arguments are enclosed
18309 in their own set of braces). For details of the meaning of the service and
18310 realm, and how to run the daemon, consult the Cyrus documentation.
18311 </para>
18312 </listitem></varlistentry>
18313 </variablelist>
18314 </section>
18315 <section id="SECID84">
18316 <title>Combining expansion conditions</title>
18317 <para>
18318 <indexterm role="concept">
18319 <primary>expansion</primary>
18320 <secondary>combining conditions</secondary>
18321 </indexterm>
18322 Several conditions can be tested at once by combining them using the <option>and</option>
18323 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
18324 conditions on their own, and precede their lists of sub-conditions. Each
18325 sub-condition must be enclosed in braces within the overall braces that contain
18326 the list. No repetition of <option>if</option> is used.
18327 </para>
18328 <variablelist>
18329 <varlistentry>
18330 <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>
18331 <listitem>
18332 <para>
18333 <indexterm role="concept">
18334 <primary><quote>or</quote> expansion condition</primary>
18335 </indexterm>
18336 <indexterm role="concept">
18337 <primary>expansion</primary>
18338 <secondary><quote>or</quote> of conditions</secondary>
18339 </indexterm>
18340 The sub-conditions are evaluated from left to right. The condition is true if
18341 any one of the sub-conditions is true.
18342 For example,
18343 </para>
18344 <literallayout class="monospaced">
18345 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
18346 </literallayout>
18347 <para>
18348 When a true sub-condition is found, the following ones are parsed but not
18349 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
18350 numeric variables afterwards are taken from the first one that succeeds.
18351 </para>
18352 </listitem></varlistentry>
18353 <varlistentry>
18354 <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>
18355 <listitem>
18356 <para>
18357 <indexterm role="concept">
18358 <primary><quote>and</quote> expansion condition</primary>
18359 </indexterm>
18360 <indexterm role="concept">
18361 <primary>expansion</primary>
18362 <secondary><quote>and</quote> of conditions</secondary>
18363 </indexterm>
18364 The sub-conditions are evaluated from left to right. The condition is true if
18365 all of the sub-conditions are true. If there are several <quote>match</quote>
18366 sub-conditions, the values of the numeric variables afterwards are taken from
18367 the last one. When a false sub-condition is found, the following ones are
18368 parsed but not evaluated.
18369 </para>
18370 </listitem></varlistentry>
18371 </variablelist>
18372 <para>
18373 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
18374 </para>
18375 </section>
18376 <section id="SECTexpvar">
18377 <title>Expansion variables</title>
18378 <para>
18379 <indexterm role="concept">
18380 <primary>expansion</primary>
18381 <secondary>variables, list of</secondary>
18382 </indexterm>
18383 This section contains an alphabetical list of all the expansion variables. Some
18384 of them are available only when Exim is compiled with specific options such as
18385 support for TLS or the content scanning extension.
18386 </para>
18387 <variablelist>
18388 <varlistentry>
18389 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
18390 <listitem>
18391 <para>
18392 <indexterm role="concept">
18393 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
18394 </indexterm>
18395 When a <option>match</option> expansion condition succeeds, these variables contain the
18396 captured substrings identified by the regular expression during subsequent
18397 processing of the success string of the containing <option>if</option> expansion item.
18398 In the expansion condition case
18399 they do not retain their values afterwards; in fact, their previous
18400 values are restored at the end of processing an <option>if</option> item. The numerical
18401 variables may also be set externally by some other matching process which
18402 precedes the expansion of the string. For example, the commands available in
18403 Exim filter files include an <option>if</option> command with its own regular expression
18404 matching condition.
18405 </para>
18406 </listitem></varlistentry>
18407 <varlistentry>
18408 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
18409 <listitem>
18410 <para>
18411 Within an acl condition, expansion condition or expansion item
18412 any arguments are copied to these variables,
18413 any unused variables being made empty.
18414 </para>
18415 </listitem></varlistentry>
18416 <varlistentry>
18417 <term><varname>$acl_c...</varname></term>
18418 <listitem>
18419 <para>
18420 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
18421 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
18422 long, but the sixth character must be either a digit or an underscore. For
18423 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
18424 variables persist throughout the lifetime of an SMTP connection. They can be
18425 used to pass information between ACLs and between different invocations of the
18426 same ACL. When a message is received, the values of these variables are saved
18427 with the message, and can be accessed by filters, routers, and transports
18428 during subsequent delivery.
18429 </para>
18430 </listitem></varlistentry>
18431 <varlistentry>
18432 <term><varname>$acl_m...</varname></term>
18433 <listitem>
18434 <para>
18435 These variables are like the <varname>$acl_c...</varname> variables, except that their values
18436 are reset after a message has been received. Thus, if several messages are
18437 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
18438 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
18439 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
18440 message is received, the values of these variables are saved with the message,
18441 and can be accessed by filters, routers, and transports during subsequent
18442 delivery.
18443 </para>
18444 </listitem></varlistentry>
18445 <varlistentry>
18446 <term><varname>$acl_narg</varname></term>
18447 <listitem>
18448 <para>
18449 Within an acl condition, expansion condition or expansion item
18450 this variable has the number of arguments.
18451 </para>
18452 </listitem></varlistentry>
18453 <varlistentry>
18454 <term><varname>$acl_verify_message</varname></term>
18455 <listitem>
18456 <para>
18457 <indexterm role="variable">
18458 <primary><varname>$acl_verify_message</varname></primary>
18459 </indexterm>
18460 After an address verification has failed, this variable contains the failure
18461 message. It retains its value for use in subsequent modifiers. The message can
18462 be preserved by coding like this:
18463 </para>
18464 <literallayout class="monospaced">
18465 warn !verify = sender
18466      set acl_m0 = $acl_verify_message
18467 </literallayout>
18468 <para>
18469 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
18470 <option>log_message</option> modifiers, to include information about the verification
18471 failure.
18472 </para>
18473 </listitem></varlistentry>
18474 <varlistentry>
18475 <term><varname>$address_data</varname></term>
18476 <listitem>
18477 <para>
18478 <indexterm role="variable">
18479 <primary><varname>$address_data</varname></primary>
18480 </indexterm>
18481 This variable is set by means of the <option>address_data</option> option in routers. The
18482 value then remains with the address while it is processed by subsequent routers
18483 and eventually a transport. If the transport is handling multiple addresses,
18484 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
18485 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
18486 user filter files.
18487 </para>
18488 <para>
18489 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
18490 a recipient address, the final value is still in the variable for subsequent
18491 conditions and modifiers of the ACL statement. If routing the address caused it
18492 to be redirected to just one address, the child address is also routed as part
18493 of the verification, and in this case the final value of <varname>$address_data</varname> is
18494 from the child&#x2019;s routing.
18495 </para>
18496 <para>
18497 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18498 sender address, the final value is also preserved, but this time in
18499 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
18500 address.
18501 </para>
18502 <para>
18503 In both cases (recipient and sender verification), the value does not persist
18504 after the end of the current ACL statement. If you want to preserve
18505 these values for longer, you can save them in ACL variables.
18506 </para>
18507 </listitem></varlistentry>
18508 <varlistentry>
18509 <term><varname>$address_file</varname></term>
18510 <listitem>
18511 <para>
18512 <indexterm role="variable">
18513 <primary><varname>$address_file</varname></primary>
18514 </indexterm>
18515 When, as a result of aliasing, forwarding, or filtering, a message is directed
18516 to a specific file, this variable holds the name of the file when the transport
18517 is running. At other times, the variable is empty. For example, using the
18518 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
18519 </para>
18520 <literallayout class="monospaced">
18521 /home/r2d2/savemail
18522 </literallayout>
18523 <para>
18524 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
18525 contains the text string <literal>/home/r2d2/savemail</literal>.
18526 <indexterm role="concept">
18527 <primary>Sieve filter</primary>
18528 <secondary>value of <varname>$address_file</varname></secondary>
18529 </indexterm>
18530 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
18531 then up to the transport configuration to generate an appropriate absolute path
18532 to the relevant file.
18533 </para>
18534 </listitem></varlistentry>
18535 <varlistentry>
18536 <term><varname>$address_pipe</varname></term>
18537 <listitem>
18538 <para>
18539 <indexterm role="variable">
18540 <primary><varname>$address_pipe</varname></primary>
18541 </indexterm>
18542 When, as a result of aliasing or forwarding, a message is directed to a pipe,
18543 this variable holds the pipe command when the transport is running.
18544 </para>
18545 </listitem></varlistentry>
18546 <varlistentry>
18547 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
18548 <listitem>
18549 <para>
18550 <indexterm role="variable">
18551 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
18552 </indexterm>
18553 These variables are used in SMTP authenticators (see chapters
18554 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
18555 </para>
18556 </listitem></varlistentry>
18557 <varlistentry>
18558 <term><varname>$authenticated_id</varname></term>
18559 <listitem>
18560 <para>
18561 <indexterm role="concept">
18562 <primary>authentication</primary>
18563 <secondary>id</secondary>
18564 </indexterm>
18565 <indexterm role="variable">
18566 <primary><varname>$authenticated_id</varname></primary>
18567 </indexterm>
18568 When a server successfully authenticates a client it may be configured to
18569 preserve some of the authentication information in the variable
18570 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
18571 user/password authenticator configuration might preserve the user name for use
18572 in the routers. Note that this is not the same information that is saved in
18573 <varname>$sender_host_authenticated</varname>.
18574 </para>
18575 <para>
18576 When a message is submitted locally (that is, not over a TCP connection)
18577 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
18578 process. However, a trusted user can override this by means of the <option>-oMai</option>
18579 command line option.
18580 This second case also sets up information used by the
18581 <varname>$authresults</varname> expansion item.
18582 </para>
18583 </listitem></varlistentry>
18584 <varlistentry>
18585 <term><varname>$authenticated_fail_id</varname></term>
18586 <listitem>
18587 <para>
18588 <indexterm role="concept">
18589 <primary>authentication</primary>
18590 <secondary>fail</secondary>
18591 </indexterm>
18592 <indexterm role="variable">
18593 <primary><varname>$authenticated_fail_id</varname></primary>
18594 </indexterm>
18595 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
18596 will contain the failed authentication id. If more than one authentication
18597 id is attempted, it will contain only the last one. The variable is
18598 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
18599 A message to a local recipient could still be accepted without requiring
18600 authentication, which means this variable could also be visible in all of
18601 the ACL&#x2019;s as well.
18602 </para>
18603 </listitem></varlistentry>
18604 <varlistentry>
18605 <term><varname>$authenticated_sender</varname></term>
18606 <listitem>
18607 <para>
18608 <indexterm role="concept">
18609 <primary>sender</primary>
18610 <secondary>authenticated</secondary>
18611 </indexterm>
18612 <indexterm role="concept">
18613 <primary>authentication</primary>
18614 <secondary>sender</secondary>
18615 </indexterm>
18616 <indexterm role="concept">
18617 <primary>AUTH</primary>
18618 <secondary>on MAIL command</secondary>
18619 </indexterm>
18620 <indexterm role="variable">
18621 <primary><varname>$authenticated_sender</varname></primary>
18622 </indexterm>
18623 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
18624 SMTP MAIL command if it believes the sender is sufficiently trusted, as
18625 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
18626 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
18627 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
18628 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
18629 </para>
18630 <para>
18631 <indexterm role="variable">
18632 <primary><varname>$qualify_domain</varname></primary>
18633 </indexterm>
18634 When a message is submitted locally (that is, not over a TCP connection), the
18635 value of <varname>$authenticated_sender</varname> is an address constructed from the login
18636 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
18637 can override this by means of the <option>-oMas</option> command line option.
18638 </para>
18639 </listitem></varlistentry>
18640 <varlistentry>
18641 <term><varname>$authentication_failed</varname></term>
18642 <listitem>
18643 <para>
18644 <indexterm role="concept">
18645 <primary>authentication</primary>
18646 <secondary>failure</secondary>
18647 </indexterm>
18648 <indexterm role="variable">
18649 <primary><varname>$authentication_failed</varname></primary>
18650 </indexterm>
18651 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
18652 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
18653 possible to distinguish between <quote>did not try to authenticate</quote>
18654 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
18655 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
18656 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
18657 negative response to an AUTH command, including (for example) an attempt to use
18658 an undefined mechanism.
18659 </para>
18660 </listitem></varlistentry>
18661 <varlistentry>
18662 <term><varname>$av_failed</varname></term>
18663 <listitem>
18664 <para>
18665 <indexterm role="concept">
18666 <primary>content scanning</primary>
18667 <secondary>AV scanner failure</secondary>
18668 </indexterm>
18669 This variable is available when Exim is compiled with the content-scanning
18670 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
18671 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
18672 the ACL malware condition.
18673 </para>
18674 </listitem></varlistentry>
18675 <varlistentry>
18676 <term><varname>$body_linecount</varname></term>
18677 <listitem>
18678 <para>
18679 <indexterm role="concept">
18680 <primary>message body</primary>
18681 <secondary>line count</secondary>
18682 </indexterm>
18683 <indexterm role="concept">
18684 <primary>body of message</primary>
18685 <secondary>line count</secondary>
18686 </indexterm>
18687 <indexterm role="variable">
18688 <primary><varname>$body_linecount</varname></primary>
18689 </indexterm>
18690 When a message is being received or delivered, this variable contains the
18691 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
18692 </para>
18693 </listitem></varlistentry>
18694 <varlistentry>
18695 <term><varname>$body_zerocount</varname></term>
18696 <listitem>
18697 <para>
18698 <indexterm role="concept">
18699 <primary>message body</primary>
18700 <secondary>binary zero count</secondary>
18701 </indexterm>
18702 <indexterm role="concept">
18703 <primary>body of message</primary>
18704 <secondary>binary zero count</secondary>
18705 </indexterm>
18706 <indexterm role="concept">
18707 <primary>binary zero</primary>
18708 <secondary>in message body</secondary>
18709 </indexterm>
18710 <indexterm role="variable">
18711 <primary><varname>$body_zerocount</varname></primary>
18712 </indexterm>
18713 When a message is being received or delivered, this variable contains the
18714 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
18715 </para>
18716 </listitem></varlistentry>
18717 <varlistentry>
18718 <term><varname>$bounce_recipient</varname></term>
18719 <listitem>
18720 <para>
18721 <indexterm role="variable">
18722 <primary><varname>$bounce_recipient</varname></primary>
18723 </indexterm>
18724 This is set to the recipient address of a bounce message while Exim is creating
18725 it. It is useful if a customized bounce message text file is in use (see
18726 chapter <xref linkend="CHAPemsgcust"/>).
18727 </para>
18728 </listitem></varlistentry>
18729 <varlistentry>
18730 <term><varname>$bounce_return_size_limit</varname></term>
18731 <listitem>
18732 <para>
18733 <indexterm role="variable">
18734 <primary><varname>$bounce_return_size_limit</varname></primary>
18735 </indexterm>
18736 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
18737 up to a multiple of 1000. It is useful when a customized error message text
18738 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
18739 </para>
18740 </listitem></varlistentry>
18741 <varlistentry>
18742 <term><varname>$caller_gid</varname></term>
18743 <listitem>
18744 <para>
18745 <indexterm role="concept">
18746 <primary>gid (group id)</primary>
18747 <secondary>caller</secondary>
18748 </indexterm>
18749 <indexterm role="variable">
18750 <primary><varname>$caller_gid</varname></primary>
18751 </indexterm>
18752 The real group id under which the process that called Exim was running. This is
18753 not the same as the group id of the originator of a message (see
18754 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
18755 incarnation normally contains the Exim gid.
18756 </para>
18757 </listitem></varlistentry>
18758 <varlistentry>
18759 <term><varname>$caller_uid</varname></term>
18760 <listitem>
18761 <para>
18762 <indexterm role="concept">
18763 <primary>uid (user id)</primary>
18764 <secondary>caller</secondary>
18765 </indexterm>
18766 <indexterm role="variable">
18767 <primary><varname>$caller_uid</varname></primary>
18768 </indexterm>
18769 The real user id under which the process that called Exim was running. This is
18770 not the same as the user id of the originator of a message (see
18771 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
18772 incarnation normally contains the Exim uid.
18773 </para>
18774 </listitem></varlistentry>
18775 <varlistentry>
18776 <term><varname>$callout_address</varname></term>
18777 <listitem>
18778 <para>
18779 <indexterm role="variable">
18780 <primary><varname>$callout_address</varname></primary>
18781 </indexterm>
18782 After a callout for verification, spamd or malware daemon service, the
18783 address that was connected to.
18784 </para>
18785 </listitem></varlistentry>
18786 <varlistentry>
18787 <term><varname>$compile_number</varname></term>
18788 <listitem>
18789 <para>
18790 <indexterm role="variable">
18791 <primary><varname>$compile_number</varname></primary>
18792 </indexterm>
18793 The building process for Exim keeps a count of the number
18794 of times it has been compiled. This serves to distinguish different
18795 compilations of the same version of Exim.
18796 </para>
18797 </listitem></varlistentry>
18798 <varlistentry>
18799 <term><varname>$config_dir</varname></term>
18800 <listitem>
18801 <para>
18802 <indexterm role="variable">
18803 <primary><varname>$config_dir</varname></primary>
18804 </indexterm>
18805 The directory name of the main configuration file. That is, the content of
18806 <varname>$config_file</varname> with the last component stripped. The value does not
18807 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
18808 <varname>$config_dir</varname> is ".".
18809 </para>
18810 </listitem></varlistentry>
18811 <varlistentry>
18812 <term><varname>$config_file</varname></term>
18813 <listitem>
18814 <para>
18815 <indexterm role="variable">
18816 <primary><varname>$config_file</varname></primary>
18817 </indexterm>
18818 The name of the main configuration file Exim is using.
18819 </para>
18820 </listitem></varlistentry>
18821 <varlistentry>
18822 <term><varname>$dkim_verify_status</varname></term>
18823 <listitem>
18824 <para>
18825 Results of DKIM verification.
18826 For details see section <xref linkend="SECDKIMVFY"/>.
18827 </para>
18828 </listitem></varlistentry>
18829 <varlistentry>
18830 <term><varname>$dkim_cur_signer</varname></term>
18831 <term><varname>$dkim_verify_reason</varname></term>
18832 <term><varname>$dkim_domain</varname></term>
18833 <term><varname>$dkim_identity</varname></term>
18834 <term><varname>$dkim_selector</varname></term>
18835 <term><varname>$dkim_algo</varname></term>
18836 <term><varname>$dkim_canon_body</varname></term>
18837 <term><varname>$dkim_canon_headers</varname></term>
18838 <term><varname>$dkim_copiedheaders</varname></term>
18839 <term><varname>$dkim_bodylength</varname></term>
18840 <term><varname>$dkim_created</varname></term>
18841 <term><varname>$dkim_expires</varname></term>
18842 <term><varname>$dkim_headernames</varname></term>
18843 <term><varname>$dkim_key_testing</varname></term>
18844 <term><varname>$dkim_key_nosubdomains</varname></term>
18845 <term><varname>$dkim_key_srvtype</varname></term>
18846 <term><varname>$dkim_key_granularity</varname></term>
18847 <term><varname>$dkim_key_notes</varname></term>
18848 <term><varname>$dkim_key_length</varname></term>
18849 <listitem>
18850 <para>
18851 These variables are only available within the DKIM ACL.
18852 For details see section <xref linkend="SECDKIMVFY"/>.
18853 </para>
18854 </listitem></varlistentry>
18855 <varlistentry>
18856 <term><varname>$dkim_signers</varname></term>
18857 <listitem>
18858 <para>
18859 <indexterm role="variable">
18860 <primary><varname>$dkim_signers</varname></primary>
18861 </indexterm>
18862 When a message has been received this variable contains
18863 a colon-separated list of signer domains and identities for the message.
18864 For details see section <xref linkend="SECDKIMVFY"/>.
18865 </para>
18866 </listitem></varlistentry>
18867 <varlistentry>
18868 <term><varname>$dmarc_domain_policy</varname></term>
18869 <term><varname>$dmarc_status</varname></term>
18870 <term><varname>$dmarc_status_text</varname></term>
18871 <term><varname>$dmarc_used_domains</varname></term>
18872 <listitem>
18873 <para>
18874 Results of DMARC verification.
18875 For details see section <xref linkend="SECDMARC"/>.
18876 </para>
18877 </listitem></varlistentry>
18878 <varlistentry>
18879 <term><varname>$dnslist_domain</varname></term>
18880 <term><varname>$dnslist_matched</varname></term>
18881 <term><varname>$dnslist_text</varname></term>
18882 <term><varname>$dnslist_value</varname></term>
18883 <listitem>
18884 <para>
18885 <indexterm role="variable">
18886 <primary><varname>$dnslist_domain</varname></primary>
18887 </indexterm>
18888 <indexterm role="variable">
18889 <primary><varname>$dnslist_matched</varname></primary>
18890 </indexterm>
18891 <indexterm role="variable">
18892 <primary><varname>$dnslist_text</varname></primary>
18893 </indexterm>
18894 <indexterm role="variable">
18895 <primary><varname>$dnslist_value</varname></primary>
18896 </indexterm>
18897 <indexterm role="concept">
18898 <primary>black list (DNS)</primary>
18899 </indexterm>
18900 When a DNS (black) list lookup succeeds, these variables are set to contain
18901 the following data from the lookup: the list&#x2019;s domain name, the key that was
18902 looked up, the contents of any associated TXT record, and the value from the
18903 main A record. See section <xref linkend="SECID204"/> for more details.
18904 </para>
18905 </listitem></varlistentry>
18906 <varlistentry>
18907 <term><varname>$domain</varname></term>
18908 <listitem>
18909 <para>
18910 <indexterm role="variable">
18911 <primary><varname>$domain</varname></primary>
18912 </indexterm>
18913 When an address is being routed, or delivered on its own, this variable
18914 contains the domain. Uppercase letters in the domain are converted into lower
18915 case for <varname>$domain</varname>.
18916 </para>
18917 <para>
18918 Global address rewriting happens when a message is received, so the value of
18919 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
18920 is set during user filtering, but not during system filtering, because a
18921 message may have many recipients and the system filter is called just once.
18922 </para>
18923 <para>
18924 When more than one address is being delivered at once (for example, several
18925 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
18926 have the same domain. Transports can be restricted to handling only one domain
18927 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
18928 the default for local transports. For further details of the environment in
18929 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
18930 </para>
18931 <para>
18932 <indexterm role="option">
18933 <primary><option>delay_warning_condition</option></primary>
18934 </indexterm>
18935 At the end of a delivery, if all deferred addresses have the same domain, it is
18936 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
18937 </para>
18938 <para>
18939 The <varname>$domain</varname> variable is also used in some other circumstances:
18940 </para>
18941 <itemizedlist>
18942 <listitem>
18943 <para>
18944 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
18945 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
18946 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
18947 normally set during the running of the MAIL ACL. However, if the sender address
18948 is verified with a callout during the MAIL ACL, the sender domain is placed in
18949 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
18950 the <command>smtp</command> transport.
18951 </para>
18952 </listitem>
18953 <listitem>
18954 <para>
18955 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18956 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
18957 it can be used in the expansion of the replacement address, for example, to
18958 rewrite domains by file lookup.
18959 </para>
18960 </listitem>
18961 <listitem>
18962 <para>
18963 With one important exception, whenever a domain list is being scanned,
18964 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
18965 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
18966 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
18967 that, in a RCPT ACL, the sender domain list can be dependent on the
18968 recipient domain (which is what is in <varname>$domain</varname> at this time).
18969 </para>
18970 </listitem>
18971 <listitem>
18972 <para>
18973 <indexterm role="concept">
18974 <primary>ETRN</primary>
18975 <secondary>value of <varname>$domain</varname></secondary>
18976 </indexterm>
18977 <indexterm role="option">
18978 <primary><option>smtp_etrn_command</option></primary>
18979 </indexterm>
18980 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
18981 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
18982 </para>
18983 </listitem>
18984 </itemizedlist>
18985 <para revisionflag="changed">
18986 <indexterm role="concept">
18987 <primary>tainted data</primary>
18988 </indexterm>
18989 If the origin of the data is an incoming message,
18990 the result of expanding this variable is tainted.
18991 When un untainted version is needed, one should be obtained from
18992 looking up the value in a local (therefore trusted) database.
18993 Often <varname>$domain_data</varname> is usable in this role.
18994 </para>
18995 </listitem></varlistentry>
18996 <varlistentry>
18997 <term><varname>$domain_data</varname></term>
18998 <listitem>
18999 <para>
19000 <indexterm role="variable">
19001 <primary><varname>$domain_data</varname></primary>
19002 </indexterm>
19003 When the <option>domains</option> option on a router matches a domain by
19004 means of a lookup, the data read by the lookup is available during the running
19005 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
19006 address to a transport, the value is available in that transport. If the
19007 transport is handling multiple addresses, the value from the first address is
19008 used.
19009 </para>
19010 <para>
19011 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
19012 domain by means of a lookup. The data read by the lookup is available during
19013 the rest of the ACL statement. In all other situations, this variable expands
19014 to nothing.
19015 </para>
19016 </listitem></varlistentry>
19017 <varlistentry>
19018 <term><varname>$exim_gid</varname></term>
19019 <listitem>
19020 <para>
19021 <indexterm role="variable">
19022 <primary><varname>$exim_gid</varname></primary>
19023 </indexterm>
19024 This variable contains the numerical value of the Exim group id.
19025 </para>
19026 </listitem></varlistentry>
19027 <varlistentry>
19028 <term><varname>$exim_path</varname></term>
19029 <listitem>
19030 <para>
19031 <indexterm role="variable">
19032 <primary><varname>$exim_path</varname></primary>
19033 </indexterm>
19034 This variable contains the path to the Exim binary.
19035 </para>
19036 </listitem></varlistentry>
19037 <varlistentry>
19038 <term><varname>$exim_uid</varname></term>
19039 <listitem>
19040 <para>
19041 <indexterm role="variable">
19042 <primary><varname>$exim_uid</varname></primary>
19043 </indexterm>
19044 This variable contains the numerical value of the Exim user id.
19045 </para>
19046 </listitem></varlistentry>
19047 <varlistentry>
19048 <term><varname>$exim_version</varname></term>
19049 <listitem>
19050 <para>
19051 <indexterm role="variable">
19052 <primary><varname>$exim_version</varname></primary>
19053 </indexterm>
19054 This variable contains the version string of the Exim build.
19055 The first character is a major version number, currently 4.
19056 Then after a dot, the next group of digits is a minor version number.
19057 There may be other characters following the minor version.
19058 This value may be overridden by the <option>exim_version</option> main config option.
19059 </para>
19060 </listitem></varlistentry>
19061 <varlistentry>
19062 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
19063 <listitem>
19064 <para>
19065 This is not strictly an expansion variable. It is expansion syntax for
19066 inserting the message header line with the given name. Note that the name must
19067 be terminated by colon or white space, because it may contain a wide variety of
19068 characters. Note also that braces must <emphasis>not</emphasis> be used.
19069 See the full description in section <xref linkend="SECTexpansionitems"/> above.
19070 </para>
19071 </listitem></varlistentry>
19072 <varlistentry>
19073 <term><varname>$headers_added</varname></term>
19074 <listitem>
19075 <para>
19076 <indexterm role="variable">
19077 <primary><varname>$headers_added</varname></primary>
19078 </indexterm>
19079 Within an ACL this variable contains the headers added so far by
19080 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
19081 The headers are a newline-separated list.
19082 </para>
19083 </listitem></varlistentry>
19084 <varlistentry>
19085 <term><varname>$home</varname></term>
19086 <listitem>
19087 <para>
19088 <indexterm role="variable">
19089 <primary><varname>$home</varname></primary>
19090 </indexterm>
19091 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
19092 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
19093 means it is set during the running of users&#x2019; filter files. A router may also
19094 explicitly set a home directory for use by a transport; this can be overridden
19095 by a setting on the transport itself.
19096 </para>
19097 <para>
19098 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
19099 of the environment variable HOME, which is subject to the
19100 <option>keep_environment</option> and <option>add_environment</option> main config options.
19101 </para>
19102 </listitem></varlistentry>
19103 <varlistentry>
19104 <term><varname>$host</varname></term>
19105 <listitem>
19106 <para>
19107 <indexterm role="variable">
19108 <primary><varname>$host</varname></primary>
19109 </indexterm>
19110 If a router assigns an address to a transport (any transport), and passes a
19111 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
19112 to run is the name of the first host on the list. Note that this applies both
19113 to local and remote transports.
19114 </para>
19115 <para>
19116 <indexterm role="concept">
19117 <primary>transport</primary>
19118 <secondary>filter</secondary>
19119 </indexterm>
19120 <indexterm role="concept">
19121 <primary>filter</primary>
19122 <secondary>transport filter</secondary>
19123 </indexterm>
19124 For the <command>smtp</command> transport, if there is more than one host, the value of
19125 <varname>$host</varname> changes as the transport works its way through the list. In
19126 particular, when the <command>smtp</command> transport is expanding its options for encryption
19127 using TLS, or for specifying a transport filter (see chapter
19128 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
19129 is connected.
19130 </para>
19131 <para>
19132 When used in the client part of an authenticator configuration (see chapter
19133 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
19134 client is connected.
19135 </para>
19136 </listitem></varlistentry>
19137 <varlistentry>
19138 <term><varname>$host_address</varname></term>
19139 <listitem>
19140 <para>
19141 <indexterm role="variable">
19142 <primary><varname>$host_address</varname></primary>
19143 </indexterm>
19144 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
19145 for a remote connection. It is also set to the IP address that is being checked
19146 when the <option>ignore_target_hosts</option> option is being processed.
19147 </para>
19148 </listitem></varlistentry>
19149 <varlistentry>
19150 <term><varname>$host_data</varname></term>
19151 <listitem>
19152 <para>
19153 <indexterm role="variable">
19154 <primary><varname>$host_data</varname></primary>
19155 </indexterm>
19156 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
19157 result of the lookup is made available in the <varname>$host_data</varname> variable. This
19158 allows you, for example, to do things like this:
19159 </para>
19160 <literallayout class="monospaced">
19161 deny  hosts = net-lsearch;/some/file
19162       message = $host_data
19163 </literallayout>
19164 </listitem></varlistentry>
19165 <varlistentry>
19166 <term><varname>$host_lookup_deferred</varname></term>
19167 <listitem>
19168 <para>
19169 <indexterm role="concept">
19170 <primary>host name</primary>
19171 <secondary>lookup, failure of</secondary>
19172 </indexterm>
19173 <indexterm role="variable">
19174 <primary><varname>$host_lookup_deferred</varname></primary>
19175 </indexterm>
19176 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
19177 message comes from a remote host and there is an attempt to look up the host&#x2019;s
19178 name from its IP address, and the attempt is not successful, one of these
19179 variables is set to <quote>1</quote>.
19180 </para>
19181 <itemizedlist>
19182 <listitem>
19183 <para>
19184 If the lookup receives a definite negative response (for example, a DNS lookup
19185 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19186 </para>
19187 </listitem>
19188 <listitem>
19189 <para>
19190 If there is any kind of problem during the lookup, such that Exim cannot
19191 tell whether or not the host name is defined (for example, a timeout for a DNS
19192 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
19193 </para>
19194 </listitem>
19195 </itemizedlist>
19196 <para>
19197 Looking up a host&#x2019;s name from its IP address consists of more than just a
19198 single reverse lookup. Exim checks that a forward lookup of at least one of the
19199 names it receives from a reverse lookup yields the original IP address. If this
19200 is not the case, Exim does not accept the looked up name(s), and
19201 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
19202 IP address (for example, the existence of a PTR record in the DNS) is not
19203 sufficient on its own for the success of a host name lookup. If the reverse
19204 lookup succeeds, but there is a lookup problem such as a timeout when checking
19205 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
19206 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
19207 </para>
19208 <para>
19209 <indexterm role="concept">
19210 <primary>authentication</primary>
19211 <secondary>expansion item</secondary>
19212 </indexterm>
19213 Performing these checks sets up information used by the
19214 <option>authresults</option> expansion item.
19215 </para>
19216 </listitem></varlistentry>
19217 <varlistentry>
19218 <term><varname>$host_lookup_failed</varname></term>
19219 <listitem>
19220 <para>
19221 <indexterm role="variable">
19222 <primary><varname>$host_lookup_failed</varname></primary>
19223 </indexterm>
19224 See <varname>$host_lookup_deferred</varname>.
19225 </para>
19226 </listitem></varlistentry>
19227 <varlistentry>
19228 <term><varname>$host_port</varname></term>
19229 <listitem>
19230 <para>
19231 <indexterm role="variable">
19232 <primary><varname>$host_port</varname></primary>
19233 </indexterm>
19234 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
19235 for an outbound connection.
19236 </para>
19237 </listitem></varlistentry>
19238 <varlistentry>
19239 <term><varname>$initial_cwd</varname></term>
19240 <listitem>
19241 <para>
19242 <indexterm role="variable">
19243 <primary><varname>$initial_cwd</varname></primary>
19244 </indexterm>
19245 This variable contains the full path name of the initial working
19246 directory of the current Exim process. This may differ from the current
19247 working directory, as Exim changes this to "/" during early startup, and
19248 to <varname>$spool_directory</varname> later.
19249 </para>
19250 </listitem></varlistentry>
19251 <varlistentry>
19252 <term><varname>$inode</varname></term>
19253 <listitem>
19254 <para>
19255 <indexterm role="variable">
19256 <primary><varname>$inode</varname></primary>
19257 </indexterm>
19258 The only time this variable is set is while expanding the <option>directory_file</option>
19259 option in the <command>appendfile</command> transport. The variable contains the inode number
19260 of the temporary file which is about to be renamed. It can be used to construct
19261 a unique name for the file.
19262 </para>
19263 </listitem></varlistentry>
19264 <varlistentry>
19265 <term><varname>$interface_address</varname></term>
19266 <listitem>
19267 <para>
19268 <indexterm role="variable">
19269 <primary><varname>$interface_address</varname></primary>
19270 </indexterm>
19271 This is an obsolete name for <varname>$received_ip_address</varname>.
19272 </para>
19273 </listitem></varlistentry>
19274 <varlistentry>
19275 <term><varname>$interface_port</varname></term>
19276 <listitem>
19277 <para>
19278 <indexterm role="variable">
19279 <primary><varname>$interface_port</varname></primary>
19280 </indexterm>
19281 This is an obsolete name for <varname>$received_port</varname>.
19282 </para>
19283 </listitem></varlistentry>
19284 <varlistentry>
19285 <term><varname>$item</varname></term>
19286 <listitem>
19287 <para>
19288 <indexterm role="variable">
19289 <primary><varname>$item</varname></primary>
19290 </indexterm>
19291 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
19292 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
19293 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
19294 empty.
19295 </para>
19296 </listitem></varlistentry>
19297 <varlistentry>
19298 <term><varname>$ldap_dn</varname></term>
19299 <listitem>
19300 <para>
19301 <indexterm role="variable">
19302 <primary><varname>$ldap_dn</varname></primary>
19303 </indexterm>
19304 This variable, which is available only when Exim is compiled with LDAP support,
19305 contains the DN from the last entry in the most recently successful LDAP
19306 lookup.
19307 </para>
19308 </listitem></varlistentry>
19309 <varlistentry>
19310 <term><varname>$load_average</varname></term>
19311 <listitem>
19312 <para>
19313 <indexterm role="variable">
19314 <primary><varname>$load_average</varname></primary>
19315 </indexterm>
19316 This variable contains the system load average, multiplied by 1000 so that it
19317 is an integer. For example, if the load average is 0.21, the value of the
19318 variable is 210. The value is recomputed every time the variable is referenced.
19319 </para>
19320 </listitem></varlistentry>
19321 <varlistentry>
19322 <term><varname>$local_part</varname></term>
19323 <listitem>
19324 <para>
19325 <indexterm role="variable">
19326 <primary><varname>$local_part</varname></primary>
19327 </indexterm>
19328 When an address is being routed, or delivered on its own, this
19329 variable contains the local part. When a number of addresses are being
19330 delivered together (for example, multiple RCPT commands in an SMTP
19331 session), <varname>$local_part</varname> is not set.
19332 </para>
19333 <para>
19334 Global address rewriting happens when a message is received, so the value of
19335 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
19336 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
19337 because a message may have many recipients and the system filter is called just
19338 once.
19339 </para>
19340 <para revisionflag="changed">
19341 <indexterm role="concept">
19342 <primary>tainted data</primary>
19343 </indexterm>
19344 If the origin of the data is an incoming message,
19345 the result of expanding this variable is tainted.
19346 </para>
19347 <para revisionflag="changed">
19348 <emphasis role="bold">Warning</emphasis>: the content of this variable is usually provided by a potential
19349 attacker.
19350 Consider carefully the implications of using it unvalidated as a name
19351 for file access.
19352 This presents issues for users&#x2019; <filename>.forward</filename> and filter files.
19353 For traditional full user accounts, use <option>check_local_users</option> and the
19354 <varname>$local_part_data</varname> variable rather than this one.
19355 For virtual users, store a suitable pathname component in the database
19356 which is used for account name validation, and use that retrieved value
19357 rather than this variable.
19358 Often <varname>$local_part_data</varname> is usable in this role.
19359 If needed, use a router <option>address_data</option> or <option>set</option> option for
19360 the retrieved data.
19361 </para>
19362 <para>
19363 When a message is being delivered to a file, pipe, or autoreply transport as a
19364 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
19365 the parent address, not to the filename or command (see <varname>$address_file</varname> and
19366 <varname>$address_pipe</varname>).
19367 </para>
19368 <para>
19369 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
19370 local part of the recipient address.
19371 </para>
19372 <para>
19373 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
19374 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
19375 it can be used in the expansion of the replacement address, for example.
19376 </para>
19377 <para>
19378 In all cases, all quoting is removed from the local part. For example, for both
19379 the addresses
19380 </para>
19381 <literallayout class="monospaced">
19382 "abc:xyz"@test.example
19383 abc\:xyz@test.example
19384 </literallayout>
19385 <para>
19386 the value of <varname>$local_part</varname> is
19387 </para>
19388 <literallayout class="monospaced">
19389 abc:xyz
19390 </literallayout>
19391 <para>
19392 If you use <varname>$local_part</varname> to create another address, you should always wrap it
19393 inside a quoting operator. For example, in a <command>redirect</command> router you could
19394 have:
19395 </para>
19396 <literallayout class="monospaced">
19397 data = ${quote_local_part:$local_part}@new.domain.example
19398 </literallayout>
19399 <para>
19400 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
19401 to process local parts in a case-dependent manner in a router, you can set the
19402 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
19403 </para>
19404 </listitem></varlistentry>
19405 <varlistentry>
19406 <term><varname>$local_part_data</varname></term>
19407 <listitem>
19408 <para>
19409 <indexterm role="variable">
19410 <primary><varname>$local_part_data</varname></primary>
19411 </indexterm>
19412 When the <option>local_parts</option> option on a router matches a local part by means of a
19413 lookup, the data read by the lookup is available during the running of the
19414 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
19415 to a transport, the value is available in that transport. If the transport is
19416 handling multiple addresses, the value from the first address is used.
19417 </para>
19418 <para revisionflag="changed">
19419 The <option>check_local_user</option> router option also sets this variable.
19420 </para>
19421 <para>
19422 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
19423 matches a local part by means of a lookup. The data read by the lookup is
19424 available during the rest of the ACL statement. In all other situations, this
19425 variable expands to nothing.
19426 </para>
19427 <para>
19428 <indexterm role="variable">
19429 <primary><varname>$local_part_prefix</varname></primary>
19430 <secondary><varname>$local_part_prefix_v</varname></secondary>
19431 </indexterm>
19432 <indexterm role="concept">
19433 <primary>affix</primary>
19434 <secondary>variables</secondary>
19435 </indexterm>
19436 If a local part prefix or suffix has been recognized, it is not included in the
19437 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
19438 any prefix or suffix are in <varname>$local_part_prefix</varname> and
19439 <varname>$local_part_suffix</varname>, respectively.
19440 </para>
19441 <para revisionflag="changed">
19442 <indexterm role="concept">
19443 <primary>tainted data</primary>
19444 </indexterm>
19445 If the specification did not include a wildcard then
19446 the affix variable value is not tainted.
19447 </para>
19448 <para revisionflag="changed">
19449 If the affix specification included a wildcard then the portion of
19450 the affix matched by the wildcard is in
19451 <varname>$local_part_prefix_v</varname> or <varname>$local_part_suffix_v</varname> as appropriate,
19452 and both the whole and varying values are tainted.
19453 </para>
19454 </listitem></varlistentry>
19455 <varlistentry>
19456 <term><varname>$local_scan_data</varname></term>
19457 <listitem>
19458 <para>
19459 <indexterm role="variable">
19460 <primary><varname>$local_scan_data</varname></primary>
19461 </indexterm>
19462 This variable contains the text returned by the <function>local_scan()</function> function when
19463 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
19464 </para>
19465 </listitem></varlistentry>
19466 <varlistentry>
19467 <term><varname>$local_user_gid</varname></term>
19468 <listitem>
19469 <para>
19470 <indexterm role="variable">
19471 <primary><varname>$local_user_gid</varname></primary>
19472 </indexterm>
19473 See <varname>$local_user_uid</varname>.
19474 </para>
19475 </listitem></varlistentry>
19476 <varlistentry>
19477 <term><varname>$local_user_uid</varname></term>
19478 <listitem>
19479 <para>
19480 <indexterm role="variable">
19481 <primary><varname>$local_user_uid</varname></primary>
19482 </indexterm>
19483 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
19484 <option>check_local_user</option> router precondition succeeds. This means that their values
19485 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
19486 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
19487 router-specific expansions. At all other times, the values in these variables
19488 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
19489 </para>
19490 </listitem></varlistentry>
19491 <varlistentry>
19492 <term><varname>$localhost_number</varname></term>
19493 <listitem>
19494 <para>
19495 <indexterm role="variable">
19496 <primary><varname>$localhost_number</varname></primary>
19497 </indexterm>
19498 This contains the expanded value of the
19499 <option>localhost_number</option> option. The expansion happens after the main options have
19500 been read.
19501 </para>
19502 </listitem></varlistentry>
19503 <varlistentry>
19504 <term><varname>$log_inodes</varname></term>
19505 <listitem>
19506 <para>
19507 <indexterm role="variable">
19508 <primary><varname>$log_inodes</varname></primary>
19509 </indexterm>
19510 The number of free inodes in the disk partition where Exim&#x2019;s
19511 log files are being written. The value is recalculated whenever the variable is
19512 referenced. If the relevant file system does not have the concept of inodes,
19513 the value of is -1. See also the <option>check_log_inodes</option> option.
19514 </para>
19515 </listitem></varlistentry>
19516 <varlistentry>
19517 <term><varname>$log_space</varname></term>
19518 <listitem>
19519 <para>
19520 <indexterm role="variable">
19521 <primary><varname>$log_space</varname></primary>
19522 </indexterm>
19523 The amount of free space (as a number of kilobytes) in the disk
19524 partition where Exim&#x2019;s log files are being written. The value is recalculated
19525 whenever the variable is referenced. If the operating system does not have the
19526 ability to find the amount of free space (only true for experimental systems),
19527 the space value is -1. See also the <option>check_log_space</option> option.
19528 </para>
19529 </listitem></varlistentry>
19530 <varlistentry>
19531 <term><varname>$lookup_dnssec_authenticated</varname></term>
19532 <listitem>
19533 <para>
19534 <indexterm role="variable">
19535 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
19536 </indexterm>
19537 This variable is set after a DNS lookup done by
19538 a dnsdb lookup expansion, dnslookup router or smtp transport.
19539 <indexterm role="concept">
19540 <primary>DNS</primary>
19541 <secondary>DNSSEC</secondary>
19542 </indexterm>
19543 It will be empty if <command>DNSSEC</command> was not requested,
19544 <quote>no</quote> if the result was not labelled as authenticated data
19545 and <quote>yes</quote> if it was.
19546 Results that are labelled as authoritative answer that match
19547 the <option>dns_trust_aa</option> configuration variable count also
19548 as authenticated data.
19549 </para>
19550 </listitem></varlistentry>
19551 <varlistentry>
19552 <term><varname>$mailstore_basename</varname></term>
19553 <listitem>
19554 <para>
19555 <indexterm role="variable">
19556 <primary><varname>$mailstore_basename</varname></primary>
19557 </indexterm>
19558 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
19559 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
19560 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
19561 contains the basename of the files that are being written, that is, the name
19562 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
19563 variable is empty.
19564 </para>
19565 </listitem></varlistentry>
19566 <varlistentry>
19567 <term><varname>$malware_name</varname></term>
19568 <listitem>
19569 <para>
19570 <indexterm role="variable">
19571 <primary><varname>$malware_name</varname></primary>
19572 </indexterm>
19573 This variable is available when Exim is compiled with the
19574 content-scanning extension. It is set to the name of the virus that was found
19575 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
19576 </para>
19577 </listitem></varlistentry>
19578 <varlistentry>
19579 <term><varname>$max_received_linelength</varname></term>
19580 <listitem>
19581 <para>
19582 <indexterm role="variable">
19583 <primary><varname>$max_received_linelength</varname></primary>
19584 </indexterm>
19585 <indexterm role="concept">
19586 <primary>maximum</primary>
19587 <secondary>line length</secondary>
19588 </indexterm>
19589 <indexterm role="concept">
19590 <primary>line length</primary>
19591 <secondary>maximum</secondary>
19592 </indexterm>
19593 This variable contains the number of bytes in the longest line that was
19594 received as part of the message, not counting the line termination
19595 character(s).
19596 It is not valid if the <option>spool_files_wireformat</option> option is used.
19597 </para>
19598 </listitem></varlistentry>
19599 <varlistentry>
19600 <term><varname>$message_age</varname></term>
19601 <listitem>
19602 <para>
19603 <indexterm role="concept">
19604 <primary>message</primary>
19605 <secondary>age of</secondary>
19606 </indexterm>
19607 <indexterm role="variable">
19608 <primary><varname>$message_age</varname></primary>
19609 </indexterm>
19610 This variable is set at the start of a delivery attempt to contain the number
19611 of seconds since the message was received. It does not change during a single
19612 delivery attempt.
19613 </para>
19614 </listitem></varlistentry>
19615 <varlistentry>
19616 <term><varname>$message_body</varname></term>
19617 <listitem>
19618 <para>
19619 <indexterm role="concept">
19620 <primary>body of message</primary>
19621 <secondary>expansion variable</secondary>
19622 </indexterm>
19623 <indexterm role="concept">
19624 <primary>message body</primary>
19625 <secondary>in expansion</secondary>
19626 </indexterm>
19627 <indexterm role="concept">
19628 <primary>binary zero</primary>
19629 <secondary>in message body</secondary>
19630 </indexterm>
19631 <indexterm role="variable">
19632 <primary><varname>$message_body</varname></primary>
19633 </indexterm>
19634 <indexterm role="option">
19635 <primary><option>message_body_visible</option></primary>
19636 </indexterm>
19637 This variable contains the initial portion of a message&#x2019;s body while it is
19638 being delivered, and is intended mainly for use in filter files. The maximum
19639 number of characters of the body that are put into the variable is set by the
19640 <option>message_body_visible</option> configuration option; the default is 500.
19641 </para>
19642 <para>
19643 <indexterm role="option">
19644 <primary><option>message_body_newlines</option></primary>
19645 </indexterm>
19646 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
19647 easier to search for phrases that might be split over a line break. However,
19648 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
19649 zeros are always converted into spaces.
19650 </para>
19651 </listitem></varlistentry>
19652 <varlistentry>
19653 <term><varname>$message_body_end</varname></term>
19654 <listitem>
19655 <para>
19656 <indexterm role="concept">
19657 <primary>body of message</primary>
19658 <secondary>expansion variable</secondary>
19659 </indexterm>
19660 <indexterm role="concept">
19661 <primary>message body</primary>
19662 <secondary>in expansion</secondary>
19663 </indexterm>
19664 <indexterm role="variable">
19665 <primary><varname>$message_body_end</varname></primary>
19666 </indexterm>
19667 This variable contains the final portion of a message&#x2019;s
19668 body while it is being delivered. The format and maximum size are as for
19669 <varname>$message_body</varname>.
19670 </para>
19671 </listitem></varlistentry>
19672 <varlistentry>
19673 <term><varname>$message_body_size</varname></term>
19674 <listitem>
19675 <para>
19676 <indexterm role="concept">
19677 <primary>body of message</primary>
19678 <secondary>size</secondary>
19679 </indexterm>
19680 <indexterm role="concept">
19681 <primary>message body</primary>
19682 <secondary>size</secondary>
19683 </indexterm>
19684 <indexterm role="variable">
19685 <primary><varname>$message_body_size</varname></primary>
19686 </indexterm>
19687 When a message is being delivered, this variable contains the size of the body
19688 in bytes. The count starts from the character after the blank line that
19689 separates the body from the header. Newlines are included in the count. See
19690 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19691 </para>
19692 <para>
19693 If the spool file is wireformat
19694 (see the <option>spool_files_wireformat</option> main option)
19695 the CRLF line-terminators are included in the count.
19696 </para>
19697 </listitem></varlistentry>
19698 <varlistentry>
19699 <term><varname>$message_exim_id</varname></term>
19700 <listitem>
19701 <para>
19702 <indexterm role="variable">
19703 <primary><varname>$message_exim_id</varname></primary>
19704 </indexterm>
19705 When a message is being received or delivered, this variable contains the
19706 unique message id that is generated and used by Exim to identify the message.
19707 An id is not created for a message until after its header has been successfully
19708 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
19709 line; it is the local id that Exim assigns to the message, for example:
19710 <literal>1BXTIK-0001yO-VA</literal>.
19711 </para>
19712 </listitem></varlistentry>
19713 <varlistentry>
19714 <term><varname>$message_headers</varname></term>
19715 <listitem>
19716 <para>
19717 <indexterm role="variable">
19718 <primary><varname>$message_headers</varname></primary>
19719 </indexterm>
19720 This variable contains a concatenation of all the header lines when a message
19721 is being processed, except for lines added by routers or transports. The header
19722 lines are separated by newline characters. Their contents are decoded in the
19723 same way as a header line that is inserted by <option>bheader</option>.
19724 </para>
19725 </listitem></varlistentry>
19726 <varlistentry>
19727 <term><varname>$message_headers_raw</varname></term>
19728 <listitem>
19729 <para>
19730 <indexterm role="variable">
19731 <primary><varname>$message_headers_raw</varname></primary>
19732 </indexterm>
19733 This variable is like <varname>$message_headers</varname> except that no processing of the
19734 contents of header lines is done.
19735 </para>
19736 </listitem></varlistentry>
19737 <varlistentry>
19738 <term><varname>$message_id</varname></term>
19739 <listitem>
19740 <para>
19741 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
19742 </para>
19743 </listitem></varlistentry>
19744 <varlistentry>
19745 <term><varname>$message_linecount</varname></term>
19746 <listitem>
19747 <para>
19748 <indexterm role="variable">
19749 <primary><varname>$message_linecount</varname></primary>
19750 </indexterm>
19751 This variable contains the total number of lines in the header and body of the
19752 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
19753 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
19754 number of lines received. Before delivery happens (that is, before filters,
19755 routers, and transports run) the count is increased to include the
19756 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
19757 lines that are added by ACLs. The blank line that separates the message header
19758 from the body is not counted.
19759 </para>
19760 <para>
19761 As with the special case of <varname>$message_size</varname>, during the expansion of the
19762 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
19763 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
19764 file that has been written (minus one for the blank line between the
19765 header and the body).
19766 </para>
19767 <para>
19768 Here is an example of the use of this variable in a DATA ACL:
19769 </para>
19770 <literallayout class="monospaced">
19771 deny condition = \
19772       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
19773      message   = Too many lines in message header
19774 </literallayout>
19775 <para>
19776 In the MAIL and RCPT ACLs, the value is zero because at that stage the
19777 message has not yet been received.
19778 </para>
19779 <para>
19780 This variable is not valid if the <option>spool_files_wireformat</option> option is used.
19781 </para>
19782 </listitem></varlistentry>
19783 <varlistentry>
19784 <term><varname>$message_size</varname></term>
19785 <listitem>
19786 <para>
19787 <indexterm role="concept">
19788 <primary>size</primary>
19789 <secondary>of message</secondary>
19790 </indexterm>
19791 <indexterm role="concept">
19792 <primary>message</primary>
19793 <secondary>size</secondary>
19794 </indexterm>
19795 <indexterm role="variable">
19796 <primary><varname>$message_size</varname></primary>
19797 </indexterm>
19798 When a message is being processed, this variable contains its size in bytes. In
19799 most cases, the size includes those headers that were received with the
19800 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
19801 deliveries as they are written. However, there is one special case: during the
19802 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
19803 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
19804 precise size of the file that has been written. See also
19805 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19806 </para>
19807 <para>
19808 <indexterm role="concept">
19809 <primary>RCPT</primary>
19810 <secondary>value of <varname>$message_size</varname></secondary>
19811 </indexterm>
19812 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
19813 contains the size supplied on the MAIL command, or -1 if no size was given. The
19814 value may not, of course, be truthful.
19815 </para>
19816 </listitem></varlistentry>
19817 <varlistentry>
19818 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
19819 <listitem>
19820 <para>
19821 A number of variables whose names start with <varname>$mime</varname> are
19822 available when Exim is compiled with the content-scanning extension. For
19823 details, see section <xref linkend="SECTscanmimepart"/>.
19824 </para>
19825 </listitem></varlistentry>
19826 <varlistentry>
19827 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
19828 <listitem>
19829 <para>
19830 These variables are counters that can be incremented by means
19831 of the <option>add</option> command in filter files.
19832 </para>
19833 </listitem></varlistentry>
19834 <varlistentry>
19835 <term><varname>$original_domain</varname></term>
19836 <listitem>
19837 <para>
19838 <indexterm role="variable">
19839 <primary><varname>$domain</varname></primary>
19840 </indexterm>
19841 <indexterm role="variable">
19842 <primary><varname>$original_domain</varname></primary>
19843 </indexterm>
19844 When a top-level address is being processed for delivery, this contains the
19845 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
19846 generated by an alias, forward, or filter file) is being processed, this
19847 variable contains the domain of the original address (lower cased). This
19848 differs from <varname>$parent_domain</varname> only when there is more than one level of
19849 aliasing or forwarding. When more than one address is being delivered in a
19850 single transport run, <varname>$original_domain</varname> is not set.
19851 </para>
19852 <para>
19853 If a new address is created by means of a <option>deliver</option> command in a system
19854 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19855 part <emphasis>system-filter</emphasis> and the default qualify domain.
19856 </para>
19857 </listitem></varlistentry>
19858 <varlistentry>
19859 <term><varname>$original_local_part</varname></term>
19860 <listitem>
19861 <para>
19862 <indexterm role="variable">
19863 <primary><varname>$local_part</varname></primary>
19864 </indexterm>
19865 <indexterm role="variable">
19866 <primary><varname>$original_local_part</varname></primary>
19867 </indexterm>
19868 When a top-level address is being processed for delivery, this contains the
19869 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
19870 local part, because <varname>$original_local_part</varname> always contains the full local
19871 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
19872 filter file) is being processed, this variable contains the full local part of
19873 the original address.
19874 </para>
19875 <para>
19876 If the router that did the redirection processed the local part
19877 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
19878 This variable differs from <varname>$parent_local_part</varname> only when there is more than
19879 one level of aliasing or forwarding. When more than one address is being
19880 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
19881 </para>
19882 <para>
19883 If a new address is created by means of a <option>deliver</option> command in a system
19884 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19885 part <emphasis>system-filter</emphasis> and the default qualify domain.
19886 </para>
19887 </listitem></varlistentry>
19888 <varlistentry>
19889 <term><varname>$originator_gid</varname></term>
19890 <listitem>
19891 <para>
19892 <indexterm role="concept">
19893 <primary>gid (group id)</primary>
19894 <secondary>of originating user</secondary>
19895 </indexterm>
19896 <indexterm role="concept">
19897 <primary>sender</primary>
19898 <secondary>gid</secondary>
19899 </indexterm>
19900 <indexterm role="variable">
19901 <primary><varname>$caller_gid</varname></primary>
19902 </indexterm>
19903 <indexterm role="variable">
19904 <primary><varname>$originator_gid</varname></primary>
19905 </indexterm>
19906 This variable contains the value of <varname>$caller_gid</varname> that was set when the
19907 message was received. For messages received via the command line, this is the
19908 gid of the sending user. For messages received by SMTP over TCP/IP, this is
19909 normally the gid of the Exim user.
19910 </para>
19911 </listitem></varlistentry>
19912 <varlistentry>
19913 <term><varname>$originator_uid</varname></term>
19914 <listitem>
19915 <para>
19916 <indexterm role="concept">
19917 <primary>uid (user id)</primary>
19918 <secondary>of originating user</secondary>
19919 </indexterm>
19920 <indexterm role="concept">
19921 <primary>sender</primary>
19922 <secondary>uid</secondary>
19923 </indexterm>
19924 <indexterm role="variable">
19925 <primary><varname>$caller_uid</varname></primary>
19926 </indexterm>
19927 <indexterm role="variable">
19928 <primary><varname>$originator_uid</varname></primary>
19929 </indexterm>
19930 The value of <varname>$caller_uid</varname> that was set when the message was received. For
19931 messages received via the command line, this is the uid of the sending user.
19932 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
19933 user.
19934 </para>
19935 </listitem></varlistentry>
19936 <varlistentry>
19937 <term><varname>$parent_domain</varname></term>
19938 <listitem>
19939 <para>
19940 <indexterm role="variable">
19941 <primary><varname>$parent_domain</varname></primary>
19942 </indexterm>
19943 This variable is similar to <varname>$original_domain</varname> (see
19944 above), except that it refers to the immediately preceding parent address.
19945 </para>
19946 </listitem></varlistentry>
19947 <varlistentry>
19948 <term><varname>$parent_local_part</varname></term>
19949 <listitem>
19950 <para>
19951 <indexterm role="variable">
19952 <primary><varname>$parent_local_part</varname></primary>
19953 </indexterm>
19954 This variable is similar to <varname>$original_local_part</varname>
19955 (see above), except that it refers to the immediately preceding parent address.
19956 </para>
19957 </listitem></varlistentry>
19958 <varlistentry>
19959 <term><varname>$pid</varname></term>
19960 <listitem>
19961 <para>
19962 <indexterm role="concept">
19963 <primary>pid (process id)</primary>
19964 <secondary>of current process</secondary>
19965 </indexterm>
19966 <indexterm role="variable">
19967 <primary><varname>$pid</varname></primary>
19968 </indexterm>
19969 This variable contains the current process id.
19970 </para>
19971 </listitem></varlistentry>
19972 <varlistentry>
19973 <term><varname>$pipe_addresses</varname></term>
19974 <listitem>
19975 <para>
19976 <indexterm role="concept">
19977 <primary>filter</primary>
19978 <secondary>transport filter</secondary>
19979 </indexterm>
19980 <indexterm role="concept">
19981 <primary>transport</primary>
19982 <secondary>filter</secondary>
19983 </indexterm>
19984 <indexterm role="variable">
19985 <primary><varname>$pipe_addresses</varname></primary>
19986 </indexterm>
19987 This is not an expansion variable, but is mentioned here because the string
19988 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
19989 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
19990 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
19991 It cannot be used in general expansion strings, and provokes an <quote>unknown
19992 variable</quote> error if encountered.
19993 </para>
19994 </listitem></varlistentry>
19995 <varlistentry>
19996 <term><varname>$primary_hostname</varname></term>
19997 <listitem>
19998 <para>
19999 <indexterm role="variable">
20000 <primary><varname>$primary_hostname</varname></primary>
20001 </indexterm>
20002 This variable contains the value set by <option>primary_hostname</option> in the
20003 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
20004 a single-component name, Exim calls <function>gethostbyname()</function> (or
20005 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
20006 qualified host name. See also <varname>$smtp_active_hostname</varname>.
20007 </para>
20008 </listitem></varlistentry>
20009 <varlistentry>
20010 <term><varname>$proxy_external_address</varname></term>
20011 <term><varname>$proxy_external_port</varname></term>
20012 <term><varname>$proxy_local_address</varname></term>
20013 <term><varname>$proxy_local_port</varname></term>
20014 <term><varname>$proxy_session</varname></term>
20015 <listitem>
20016 <para>
20017 These variables are only available when built with Proxy Protocol
20018 or SOCKS5 support.
20019 For details see chapter <xref linkend="SECTproxyInbound"/>.
20020 </para>
20021 </listitem></varlistentry>
20022 <varlistentry>
20023 <term><varname>$prdr_requested</varname></term>
20024 <listitem>
20025 <para>
20026 <indexterm role="concept">
20027 <primary>PRDR</primary>
20028 <secondary>variable for</secondary>
20029 </indexterm>
20030 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
20031 current message, otherwise <quote>no</quote>.
20032 </para>
20033 </listitem></varlistentry>
20034 <varlistentry>
20035 <term><varname>$prvscheck_address</varname></term>
20036 <listitem>
20037 <para>
20038 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20039 which is described in sections <xref linkend="SECTexpansionitems"/> and
20040 <xref linkend="SECTverifyPRVS"/>.
20041 </para>
20042 </listitem></varlistentry>
20043 <varlistentry>
20044 <term><varname>$prvscheck_keynum</varname></term>
20045 <listitem>
20046 <para>
20047 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20048 which is described in sections <xref linkend="SECTexpansionitems"/> and
20049 <xref linkend="SECTverifyPRVS"/>.
20050 </para>
20051 </listitem></varlistentry>
20052 <varlistentry>
20053 <term><varname>$prvscheck_result</varname></term>
20054 <listitem>
20055 <para>
20056 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20057 which is described in sections <xref linkend="SECTexpansionitems"/> and
20058 <xref linkend="SECTverifyPRVS"/>.
20059 </para>
20060 </listitem></varlistentry>
20061 <varlistentry>
20062 <term><varname>$qualify_domain</varname></term>
20063 <listitem>
20064 <para>
20065 <indexterm role="variable">
20066 <primary><varname>$qualify_domain</varname></primary>
20067 </indexterm>
20068 The value set for the <option>qualify_domain</option> option in the configuration file.
20069 </para>
20070 </listitem></varlistentry>
20071 <varlistentry>
20072 <term><varname>$qualify_recipient</varname></term>
20073 <listitem>
20074 <para>
20075 <indexterm role="variable">
20076 <primary><varname>$qualify_recipient</varname></primary>
20077 </indexterm>
20078 The value set for the <option>qualify_recipient</option> option in the configuration file,
20079 or if not set, the value of <varname>$qualify_domain</varname>.
20080 </para>
20081 </listitem></varlistentry>
20082 <varlistentry>
20083 <term><varname>$queue_name</varname></term>
20084 <listitem>
20085 <para>
20086 <indexterm role="variable">
20087 <primary><varname>$queue_name</varname></primary>
20088 </indexterm>
20089 <indexterm role="concept">
20090 <primary>named queues</primary>
20091 <secondary>variable</secondary>
20092 </indexterm>
20093 <indexterm role="concept">
20094 <primary>queues</primary>
20095 <secondary>named</secondary>
20096 </indexterm>
20097 The name of the spool queue in use; empty for the default queue.
20098 </para>
20099 </listitem></varlistentry>
20100 <varlistentry>
20101 <term><varname>$queue_size</varname></term>
20102 <listitem>
20103 <para>
20104 <indexterm role="variable">
20105 <primary><varname>$queue_size</varname></primary>
20106 </indexterm>
20107 <indexterm role="concept">
20108 <primary>queue</primary>
20109 <secondary>size of</secondary>
20110 </indexterm>
20111 <indexterm role="concept">
20112 <primary>spool</primary>
20113 <secondary>number of messages</secondary>
20114 </indexterm>
20115 This variable contains the number of messages queued.
20116 It is evaluated on demand, but no more often than once every minute.
20117 </para>
20118 </listitem></varlistentry>
20119 <varlistentry>
20120 <term><varname>$r_...</varname></term>
20121 <listitem>
20122 <para>
20123 <indexterm role="variable">
20124 <primary><varname>$r_...</varname></primary>
20125 </indexterm>
20126 <indexterm role="concept">
20127 <primary>router</primary>
20128 <secondary>variables</secondary>
20129 </indexterm>
20130 Values can be placed in these variables by the <option>set</option> option of a router.
20131 They can be given any name that starts with <varname>$r_</varname>.
20132 The values persist for the address being handled through subsequent routers
20133 and the eventual transport.
20134 </para>
20135 </listitem></varlistentry>
20136 <varlistentry>
20137 <term><varname>$rcpt_count</varname></term>
20138 <listitem>
20139 <para>
20140 <indexterm role="variable">
20141 <primary><varname>$rcpt_count</varname></primary>
20142 </indexterm>
20143 When a message is being received by SMTP, this variable contains the number of
20144 RCPT commands received for the current message. If this variable is used in a
20145 RCPT ACL, its value includes the current command.
20146 </para>
20147 </listitem></varlistentry>
20148 <varlistentry>
20149 <term><varname>$rcpt_defer_count</varname></term>
20150 <listitem>
20151 <para>
20152 <indexterm role="variable">
20153 <primary><varname>$rcpt_defer_count</varname></primary>
20154 </indexterm>
20155 <indexterm role="concept">
20156 <primary>4<emphasis>xx</emphasis> responses</primary>
20157 <secondary>count of</secondary>
20158 </indexterm>
20159 When a message is being received by SMTP, this variable contains the number of
20160 RCPT commands in the current message that have previously been rejected with a
20161 temporary (4<emphasis>xx</emphasis>) response.
20162 </para>
20163 </listitem></varlistentry>
20164 <varlistentry>
20165 <term><varname>$rcpt_fail_count</varname></term>
20166 <listitem>
20167 <para>
20168 <indexterm role="variable">
20169 <primary><varname>$rcpt_fail_count</varname></primary>
20170 </indexterm>
20171 When a message is being received by SMTP, this variable contains the number of
20172 RCPT commands in the current message that have previously been rejected with a
20173 permanent (5<emphasis>xx</emphasis>) response.
20174 </para>
20175 </listitem></varlistentry>
20176 <varlistentry>
20177 <term><varname>$received_count</varname></term>
20178 <listitem>
20179 <para>
20180 <indexterm role="variable">
20181 <primary><varname>$received_count</varname></primary>
20182 </indexterm>
20183 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
20184 including the one added by Exim (so its value is always greater than zero). It
20185 is available in the DATA ACL, the non-SMTP ACL, and while routing and
20186 delivering.
20187 </para>
20188 </listitem></varlistentry>
20189 <varlistentry>
20190 <term><varname>$received_for</varname></term>
20191 <listitem>
20192 <para>
20193 <indexterm role="variable">
20194 <primary><varname>$received_for</varname></primary>
20195 </indexterm>
20196 If there is only a single recipient address in an incoming message, this
20197 variable contains that address when the <emphasis>Received:</emphasis> header line is being
20198 built. The value is copied after recipient rewriting has happened, but before
20199 the <function>local_scan()</function> function is run.
20200 </para>
20201 </listitem></varlistentry>
20202 <varlistentry>
20203 <term><varname>$received_ip_address</varname></term>
20204 <listitem>
20205 <para>
20206 <indexterm role="variable">
20207 <primary><varname>$received_ip_address</varname></primary>
20208 </indexterm>
20209 As soon as an Exim server starts processing an incoming TCP/IP connection, this
20210 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
20211 is set to the local port number. (The remote IP address and port are in
20212 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
20213 the port value is -1 unless it has been set using the <option>-oMi</option> command line
20214 option.
20215 </para>
20216 <para>
20217 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
20218 could be used, for example, to make the filename for a TLS certificate depend
20219 on which interface and/or port is being used for the incoming connection. The
20220 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
20221 messages that are received, thus making these variables available at delivery
20222 time.
20223 For outbound connections see <varname>$sending_ip_address</varname>.
20224 </para>
20225 </listitem></varlistentry>
20226 <varlistentry>
20227 <term><varname>$received_port</varname></term>
20228 <listitem>
20229 <para>
20230 <indexterm role="variable">
20231 <primary><varname>$received_port</varname></primary>
20232 </indexterm>
20233 See <varname>$received_ip_address</varname>.
20234 </para>
20235 </listitem></varlistentry>
20236 <varlistentry>
20237 <term><varname>$received_protocol</varname></term>
20238 <listitem>
20239 <para>
20240 <indexterm role="variable">
20241 <primary><varname>$received_protocol</varname></primary>
20242 </indexterm>
20243 When a message is being processed, this variable contains the name of the
20244 protocol by which it was received. Most of the names used by Exim are defined
20245 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
20246 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
20247 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
20248 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
20249 connection and the client was successfully authenticated.
20250 </para>
20251 <para>
20252 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
20253 automatically set up on connection without the use of STARTTLS (see
20254 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
20255 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
20256 where the client initially uses EHLO, sets up an encrypted connection using
20257 STARTTLS, and then uses HELO afterwards.
20258 </para>
20259 <para>
20260 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
20261 messages that are injected locally by trusted callers. This is commonly used to
20262 identify messages that are being re-injected after some kind of scanning.
20263 </para>
20264 </listitem></varlistentry>
20265 <varlistentry>
20266 <term><varname>$received_time</varname></term>
20267 <listitem>
20268 <para>
20269 <indexterm role="variable">
20270 <primary><varname>$received_time</varname></primary>
20271 </indexterm>
20272 This variable contains the date and time when the current message was received,
20273 as a number of seconds since the start of the Unix epoch.
20274 </para>
20275 </listitem></varlistentry>
20276 <varlistentry>
20277 <term><varname>$recipient_data</varname></term>
20278 <listitem>
20279 <para>
20280 <indexterm role="variable">
20281 <primary><varname>$recipient_data</varname></primary>
20282 </indexterm>
20283 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
20284 condition. It contains the data from the lookup, and the value remains set
20285 until the next <option>recipients</option> test. Thus, you can do things like this:
20286 </para>
20287 <literallayout>
20288 <literal>require recipients  = cdb*@;/some/file</literal>
20289 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
20290 </literallayout>
20291 <para>
20292 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
20293 method in the address list, using the semicolon syntax as in the example above.
20294 The variable is not set for a lookup that is used as part of the string
20295 expansion that all such lists undergo before being interpreted.
20296 </para>
20297 </listitem></varlistentry>
20298 <varlistentry>
20299 <term><varname>$recipient_verify_failure</varname></term>
20300 <listitem>
20301 <para>
20302 <indexterm role="variable">
20303 <primary><varname>$recipient_verify_failure</varname></primary>
20304 </indexterm>
20305 In an ACL, when a recipient verification fails, this variable contains
20306 information about the failure. It is set to one of the following words:
20307 </para>
20308 <itemizedlist>
20309 <listitem>
20310 <para>
20311 <quote>qualify</quote>: The address was unqualified (no domain), and the message
20312 was neither local nor came from an exempted host.
20313 </para>
20314 </listitem>
20315 <listitem>
20316 <para>
20317 <quote>route</quote>: Routing failed.
20318 </para>
20319 </listitem>
20320 <listitem>
20321 <para>
20322 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
20323 or before the MAIL command (that is, on initial connection, HELO, or
20324 MAIL).
20325 </para>
20326 </listitem>
20327 <listitem>
20328 <para>
20329 <quote>recipient</quote>: The RCPT command in a callout was rejected.
20330 </para>
20331 </listitem>
20332 <listitem>
20333 <para>
20334 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
20335 </para>
20336 </listitem>
20337 </itemizedlist>
20338 <para>
20339 The main use of this variable is expected to be to distinguish between
20340 rejections of MAIL and rejections of RCPT.
20341 </para>
20342 </listitem></varlistentry>
20343 <varlistentry>
20344 <term><varname>$recipients</varname></term>
20345 <listitem>
20346 <para>
20347 <indexterm role="variable">
20348 <primary><varname>$recipients</varname></primary>
20349 </indexterm>
20350 This variable contains a list of envelope recipients for a message. A comma and
20351 a space separate the addresses in the replacement text. However, the variable
20352 is not generally available, to prevent exposure of Bcc recipients in
20353 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
20354 cases:
20355 </para>
20356 <orderedlist numeration="arabic">
20357 <listitem>
20358 <para>
20359 In a system filter file.
20360 </para>
20361 </listitem>
20362 <listitem>
20363 <para>
20364 In the ACLs associated with the DATA command and with non-SMTP messages, that
20365 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
20366 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
20367 <option>acl_not_smtp_mime</option>.
20368 </para>
20369 </listitem>
20370 <listitem>
20371 <para>
20372 From within a <function>local_scan()</function> function.
20373 </para>
20374 </listitem>
20375 </orderedlist>
20376 </listitem></varlistentry>
20377 <varlistentry>
20378 <term><varname>$recipients_count</varname></term>
20379 <listitem>
20380 <para>
20381 <indexterm role="variable">
20382 <primary><varname>$recipients_count</varname></primary>
20383 </indexterm>
20384 When a message is being processed, this variable contains the number of
20385 envelope recipients that came with the message. Duplicates are not excluded
20386 from the count. While a message is being received over SMTP, the number
20387 increases for each accepted recipient. It can be referenced in an ACL.
20388 </para>
20389 </listitem></varlistentry>
20390 <varlistentry>
20391 <term><varname>$regex_match_string</varname></term>
20392 <listitem>
20393 <para>
20394 <indexterm role="variable">
20395 <primary><varname>$regex_match_string</varname></primary>
20396 </indexterm>
20397 This variable is set to contain the matching regular expression after a
20398 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
20399 </para>
20400 </listitem></varlistentry>
20401 <varlistentry>
20402 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
20403 <listitem>
20404 <para>
20405 <indexterm role="concept">
20406 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
20407 </indexterm>
20408 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
20409 these variables contain the
20410 captured substrings identified by the regular expression.
20411 </para>
20412 </listitem></varlistentry>
20413 <varlistentry>
20414 <term><varname>$reply_address</varname></term>
20415 <listitem>
20416 <para>
20417 <indexterm role="variable">
20418 <primary><varname>$reply_address</varname></primary>
20419 </indexterm>
20420 When a message is being processed, this variable contains the contents of the
20421 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
20422 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
20423 white space, the value is not processed in any way. In particular, no RFC 2047
20424 decoding or character code translation takes place.
20425 </para>
20426 </listitem></varlistentry>
20427 <varlistentry>
20428 <term><varname>$return_path</varname></term>
20429 <listitem>
20430 <para>
20431 <indexterm role="variable">
20432 <primary><varname>$return_path</varname></primary>
20433 </indexterm>
20434 When a message is being delivered, this variable contains the return path &ndash;
20435 the sender field that will be sent as part of the envelope. It is not enclosed
20436 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
20437 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
20438 mailing list has been expanded by a router which specifies a different address
20439 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
20440 address, whereas <varname>$sender_address</varname> always contains the original sender address
20441 that was received with the message. In other words, <varname>$sender_address</varname> contains
20442 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
20443 envelope sender.
20444 </para>
20445 </listitem></varlistentry>
20446 <varlistentry>
20447 <term><varname>$return_size_limit</varname></term>
20448 <listitem>
20449 <para>
20450 <indexterm role="variable">
20451 <primary><varname>$return_size_limit</varname></primary>
20452 </indexterm>
20453 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
20454 </para>
20455 </listitem></varlistentry>
20456 <varlistentry>
20457 <term><varname>$router_name</varname></term>
20458 <listitem>
20459 <para>
20460 <indexterm role="concept">
20461 <primary>router</primary>
20462 <secondary>name</secondary>
20463 </indexterm>
20464 <indexterm role="concept">
20465 <primary>name</primary>
20466 <secondary>of router</secondary>
20467 </indexterm>
20468 <indexterm role="variable">
20469 <primary><varname>$router_name</varname></primary>
20470 </indexterm>
20471 During the running of a router this variable contains its name.
20472 </para>
20473 </listitem></varlistentry>
20474 <varlistentry>
20475 <term><varname>$runrc</varname></term>
20476 <listitem>
20477 <para>
20478 <indexterm role="concept">
20479 <primary>return code</primary>
20480 <secondary>from <option>run</option> expansion</secondary>
20481 </indexterm>
20482 <indexterm role="variable">
20483 <primary><varname>$runrc</varname></primary>
20484 </indexterm>
20485 This variable contains the return code from a command that is run by the
20486 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
20487 assume the order in which option values are expanded, except for those
20488 preconditions whose order of testing is documented. Therefore, you cannot
20489 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
20490 another.
20491 </para>
20492 </listitem></varlistentry>
20493 <varlistentry>
20494 <term><varname>$self_hostname</varname></term>
20495 <listitem>
20496 <para>
20497 <indexterm role="option">
20498 <primary><option>self</option></primary>
20499 <secondary>value of host name</secondary>
20500 </indexterm>
20501 <indexterm role="variable">
20502 <primary><varname>$self_hostname</varname></primary>
20503 </indexterm>
20504 When an address is routed to a supposedly remote host that turns out to be the
20505 local host, what happens is controlled by the <option>self</option> generic router option.
20506 One of its values causes the address to be passed to another router. When this
20507 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
20508 original router encountered. In other circumstances its contents are null.
20509 </para>
20510 </listitem></varlistentry>
20511 <varlistentry>
20512 <term><varname>$sender_address</varname></term>
20513 <listitem>
20514 <para>
20515 <indexterm role="variable">
20516 <primary><varname>$sender_address</varname></primary>
20517 </indexterm>
20518 When a message is being processed, this variable contains the sender&#x2019;s address
20519 that was received in the message&#x2019;s envelope. The case of letters in the address
20520 is retained, in both the local part and the domain. For bounce messages, the
20521 value of this variable is the empty string. See also <varname>$return_path</varname>.
20522 </para>
20523 </listitem></varlistentry>
20524 <varlistentry>
20525 <term><varname>$sender_address_data</varname></term>
20526 <listitem>
20527 <para>
20528 <indexterm role="variable">
20529 <primary><varname>$address_data</varname></primary>
20530 </indexterm>
20531 <indexterm role="variable">
20532 <primary><varname>$sender_address_data</varname></primary>
20533 </indexterm>
20534 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
20535 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
20536 distinguish it from data from a recipient address. The value does not persist
20537 after the end of the current ACL statement. If you want to preserve it for
20538 longer, you can save it in an ACL variable.
20539 </para>
20540 </listitem></varlistentry>
20541 <varlistentry>
20542 <term><varname>$sender_address_domain</varname></term>
20543 <listitem>
20544 <para>
20545 <indexterm role="variable">
20546 <primary><varname>$sender_address_domain</varname></primary>
20547 </indexterm>
20548 The domain portion of <varname>$sender_address</varname>.
20549 </para>
20550 </listitem></varlistentry>
20551 <varlistentry>
20552 <term><varname>$sender_address_local_part</varname></term>
20553 <listitem>
20554 <para>
20555 <indexterm role="variable">
20556 <primary><varname>$sender_address_local_part</varname></primary>
20557 </indexterm>
20558 The local part portion of <varname>$sender_address</varname>.
20559 </para>
20560 </listitem></varlistentry>
20561 <varlistentry>
20562 <term><varname>$sender_data</varname></term>
20563 <listitem>
20564 <para>
20565 <indexterm role="variable">
20566 <primary><varname>$sender_data</varname></primary>
20567 </indexterm>
20568 This variable is set after a lookup success in an ACL <option>senders</option> condition or
20569 in a router <option>senders</option> option. It contains the data from the lookup, and the
20570 value remains set until the next <option>senders</option> test. Thus, you can do things like
20571 this:
20572 </para>
20573 <literallayout>
20574 <literal>require senders      = cdb*@;/some/file</literal>
20575 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
20576 </literallayout>
20577 <para>
20578 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
20579 method in the address list, using the semicolon syntax as in the example above.
20580 The variable is not set for a lookup that is used as part of the string
20581 expansion that all such lists undergo before being interpreted.
20582 </para>
20583 </listitem></varlistentry>
20584 <varlistentry>
20585 <term><varname>$sender_fullhost</varname></term>
20586 <listitem>
20587 <para>
20588 <indexterm role="variable">
20589 <primary><varname>$sender_fullhost</varname></primary>
20590 </indexterm>
20591 When a message is received from a remote host, this variable contains the host
20592 name and IP address in a single string. It ends with the IP address in square
20593 brackets, followed by a colon and a port number if the logging of ports is
20594 enabled. The format of the rest of the string depends on whether the host
20595 issued a HELO or EHLO SMTP command, and whether the host name was verified by
20596 looking up its IP address. (Looking up the IP address can be forced by the
20597 <option>host_lookup</option> option, independent of verification.) A plain host name at the
20598 start of the string is a verified host name; if this is not present,
20599 verification either failed or was not requested. A host name in parentheses is
20600 the argument of a HELO or EHLO command. This is omitted if it is identical to
20601 the verified host name or to the host&#x2019;s IP address in square brackets.
20602 </para>
20603 </listitem></varlistentry>
20604 <varlistentry>
20605 <term><varname>$sender_helo_dnssec</varname></term>
20606 <listitem>
20607 <para>
20608 <indexterm role="variable">
20609 <primary><varname>$sender_helo_dnssec</varname></primary>
20610 </indexterm>
20611 This boolean variable is true if a successful HELO verification was
20612 <indexterm role="concept">
20613 <primary>DNS</primary>
20614 <secondary>DNSSEC</secondary>
20615 </indexterm>
20616 done using DNS information the resolver library stated was authenticated data.
20617 </para>
20618 </listitem></varlistentry>
20619 <varlistentry>
20620 <term><varname>$sender_helo_name</varname></term>
20621 <listitem>
20622 <para>
20623 <indexterm role="variable">
20624 <primary><varname>$sender_helo_name</varname></primary>
20625 </indexterm>
20626 When a message is received from a remote host that has issued a HELO or EHLO
20627 command, the argument of that command is placed in this variable. It is also
20628 set if HELO or EHLO is used when a message is received using SMTP locally via
20629 the <option>-bs</option> or <option>-bS</option> options.
20630 </para>
20631 </listitem></varlistentry>
20632 <varlistentry>
20633 <term><varname>$sender_host_address</varname></term>
20634 <listitem>
20635 <para>
20636 <indexterm role="variable">
20637 <primary><varname>$sender_host_address</varname></primary>
20638 </indexterm>
20639 When a message is received from a remote host using SMTP,
20640 this variable contains that
20641 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
20642 </para>
20643 </listitem></varlistentry>
20644 <varlistentry>
20645 <term><varname>$sender_host_authenticated</varname></term>
20646 <listitem>
20647 <para>
20648 <indexterm role="variable">
20649 <primary><varname>$sender_host_authenticated</varname></primary>
20650 </indexterm>
20651 This variable contains the name (not the public name) of the authenticator
20652 driver that successfully authenticated the client from which the message was
20653 received. It is empty if there was no successful authentication. See also
20654 <varname>$authenticated_id</varname>.
20655 </para>
20656 </listitem></varlistentry>
20657 <varlistentry>
20658 <term><varname>$sender_host_dnssec</varname></term>
20659 <listitem>
20660 <para>
20661 <indexterm role="variable">
20662 <primary><varname>$sender_host_dnssec</varname></primary>
20663 </indexterm>
20664 If an attempt to populate <varname>$sender_host_name</varname> has been made
20665 (by reference, <option>hosts_lookup</option> or
20666 otherwise) then this boolean will have been set true if, and only if, the
20667 resolver library states that both
20668 the reverse and forward DNS were authenticated data.  At all
20669 other times, this variable is false.
20670 </para>
20671 <para>
20672 <indexterm role="concept">
20673 <primary>DNS</primary>
20674 <secondary>DNSSEC</secondary>
20675 </indexterm>
20676 It is likely that you will need to coerce DNSSEC support on in the resolver
20677 library, by setting:
20678 </para>
20679 <literallayout class="monospaced">
20680 dns_dnssec_ok = 1
20681 </literallayout>
20682 <para revisionflag="changed">
20683 In addition, on Linux with glibc 2.31 or newer the resolver library will
20684 default to stripping out a successful validation status.
20685 This will break a previously working Exim installation.
20686 Provided that you do trust the resolver (ie, is on localhost) you can tell
20687 glibc to pass through any successful validation with a new option in
20688 <filename>/etc/resolv.conf</filename>:
20689 </para>
20690 <literallayout class="monospaced" revisionflag="changed">
20691 options trust-ad
20692 </literallayout>
20693 <para>
20694 Exim does not perform DNSSEC validation itself, instead leaving that to a
20695 validating resolver (e.g. unbound, or bind with suitable configuration).
20696 </para>
20697 <para>
20698 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
20699 mechanism in the list, then this variable will be false.
20700 </para>
20701 <para>
20702 This requires that your system resolver library support EDNS0 (and that
20703 DNSSEC flags exist in the system headers).  If the resolver silently drops
20704 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
20705 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
20706 </para>
20707 </listitem></varlistentry>
20708 <varlistentry>
20709 <term><varname>$sender_host_name</varname></term>
20710 <listitem>
20711 <para>
20712 <indexterm role="variable">
20713 <primary><varname>$sender_host_name</varname></primary>
20714 </indexterm>
20715 When a message is received from a remote host, this variable contains the
20716 host&#x2019;s name as obtained by looking up its IP address. For messages received by
20717 other means, this variable is empty.
20718 </para>
20719 <para>
20720 <indexterm role="variable">
20721 <primary><varname>$host_lookup_failed</varname></primary>
20722 </indexterm>
20723 If the host name has not previously been looked up, a reference to
20724 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
20725 A looked up name is accepted only if it leads back to the original IP address
20726 via a forward lookup. If either the reverse or the forward lookup fails to find
20727 any data, or if the forward lookup does not yield the original IP address,
20728 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
20729 </para>
20730 <para>
20731 <indexterm role="variable">
20732 <primary><varname>$host_lookup_deferred</varname></primary>
20733 </indexterm>
20734 However, if either of the lookups cannot be completed (for example, there is a
20735 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
20736 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
20737 </para>
20738 <para>
20739 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
20740 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
20741 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
20742 is set to <quote>1</quote>.
20743 </para>
20744 <para>
20745 Exim does not automatically look up every calling host&#x2019;s name. If you want
20746 maximum efficiency, you should arrange your configuration so that it avoids
20747 these lookups altogether. The lookup happens only if one or more of the
20748 following are true:
20749 </para>
20750 <itemizedlist>
20751 <listitem>
20752 <para>
20753 A string containing <varname>$sender_host_name</varname> is expanded.
20754 </para>
20755 </listitem>
20756 <listitem>
20757 <para>
20758 The calling host matches the list in <option>host_lookup</option>. In the default
20759 configuration, this option is set to *, so it must be changed if lookups are
20760 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
20761 </para>
20762 </listitem>
20763 <listitem>
20764 <para>
20765 Exim needs the host name in order to test an item in a host list. The items
20766 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
20767 <xref linkend="SECThoslispatnamsk"/>.
20768 </para>
20769 </listitem>
20770 <listitem>
20771 <para>
20772 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
20773 In this case, the host name is required to compare with the name quoted in any
20774 EHLO or HELO commands that the client issues.
20775 </para>
20776 </listitem>
20777 <listitem>
20778 <para>
20779 The remote host issues a EHLO or HELO command that quotes one of the
20780 domains in <option>helo_lookup_domains</option>. The default value of this option is
20781 </para>
20782 <literallayout class="monospaced">
20783   helo_lookup_domains = @ : @[]
20784 </literallayout>
20785 <para>
20786 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
20787 IP address in an EHLO or HELO command.
20788 </para>
20789 </listitem>
20790 </itemizedlist>
20791 </listitem></varlistentry>
20792 <varlistentry>
20793 <term><varname>$sender_host_port</varname></term>
20794 <listitem>
20795 <para>
20796 <indexterm role="variable">
20797 <primary><varname>$sender_host_port</varname></primary>
20798 </indexterm>
20799 When a message is received from a remote host, this variable contains the port
20800 number that was used on the remote host.
20801 </para>
20802 </listitem></varlistentry>
20803 <varlistentry>
20804 <term><varname>$sender_ident</varname></term>
20805 <listitem>
20806 <para>
20807 <indexterm role="variable">
20808 <primary><varname>$sender_ident</varname></primary>
20809 </indexterm>
20810 When a message is received from a remote host, this variable contains the
20811 identification received in response to an RFC 1413 request. When a message has
20812 been received locally, this variable contains the login name of the user that
20813 called Exim.
20814 </para>
20815 </listitem></varlistentry>
20816 <varlistentry>
20817 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
20818 <listitem>
20819 <para>
20820 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
20821 <option>ratelimit</option> ACL condition. Details are given in section
20822 <xref linkend="SECTratelimiting"/>.
20823 </para>
20824 </listitem></varlistentry>
20825 <varlistentry>
20826 <term><varname>$sender_rcvhost</varname></term>
20827 <listitem>
20828 <para>
20829 <indexterm role="concept">
20830 <primary>DNS</primary>
20831 <secondary>reverse lookup</secondary>
20832 </indexterm>
20833 <indexterm role="concept">
20834 <primary>reverse DNS lookup</primary>
20835 </indexterm>
20836 <indexterm role="variable">
20837 <primary><varname>$sender_rcvhost</varname></primary>
20838 </indexterm>
20839 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
20840 either the verified host name (as obtained from a reverse DNS lookup) or, if
20841 there is no verified host name, the IP address in square brackets. After that
20842 there may be text in parentheses. When the first item is a verified host name,
20843 the first thing in the parentheses is the IP address in square brackets,
20844 followed by a colon and a port number if port logging is enabled. When the
20845 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
20846 the parentheses.
20847 </para>
20848 <para>
20849 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
20850 was used and its argument was not identical to the real host name or IP
20851 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
20852 all three items are present in the parentheses, a newline and tab are inserted
20853 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
20854 </para>
20855 </listitem></varlistentry>
20856 <varlistentry>
20857 <term><varname>$sender_verify_failure</varname></term>
20858 <listitem>
20859 <para>
20860 <indexterm role="variable">
20861 <primary><varname>$sender_verify_failure</varname></primary>
20862 </indexterm>
20863 In an ACL, when a sender verification fails, this variable contains information
20864 about the failure. The details are the same as for
20865 <varname>$recipient_verify_failure</varname>.
20866 </para>
20867 </listitem></varlistentry>
20868 <varlistentry>
20869 <term><varname>$sending_ip_address</varname></term>
20870 <listitem>
20871 <para>
20872 <indexterm role="variable">
20873 <primary><varname>$sending_ip_address</varname></primary>
20874 </indexterm>
20875 This variable is set whenever an outgoing SMTP connection to another host has
20876 been set up. It contains the IP address of the local interface that is being
20877 used. This is useful if a host that has more than one IP address wants to take
20878 on different personalities depending on which one is being used. For incoming
20879 connections, see <varname>$received_ip_address</varname>.
20880 </para>
20881 </listitem></varlistentry>
20882 <varlistentry>
20883 <term><varname>$sending_port</varname></term>
20884 <listitem>
20885 <para>
20886 <indexterm role="variable">
20887 <primary><varname>$sending_port</varname></primary>
20888 </indexterm>
20889 This variable is set whenever an outgoing SMTP connection to another host has
20890 been set up. It contains the local port that is being used. For incoming
20891 connections, see <varname>$received_port</varname>.
20892 </para>
20893 </listitem></varlistentry>
20894 <varlistentry>
20895 <term><varname>$smtp_active_hostname</varname></term>
20896 <listitem>
20897 <para>
20898 <indexterm role="variable">
20899 <primary><varname>$smtp_active_hostname</varname></primary>
20900 </indexterm>
20901 During an incoming SMTP session, this variable contains the value of the active
20902 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
20903 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
20904 value can be consulted during routing and delivery.
20905 </para>
20906 </listitem></varlistentry>
20907 <varlistentry>
20908 <term><varname>$smtp_command</varname></term>
20909 <listitem>
20910 <para>
20911 <indexterm role="variable">
20912 <primary><varname>$smtp_command</varname></primary>
20913 </indexterm>
20914 During the processing of an incoming SMTP command, this variable contains the
20915 entire command. This makes it possible to distinguish between HELO and EHLO in
20916 the HELO ACL, and also to distinguish between commands such as these:
20917 </para>
20918 <literallayout class="monospaced">
20919 MAIL FROM:&lt;&gt;
20920 MAIL FROM: &lt;&gt;
20921 </literallayout>
20922 <para>
20923 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
20924 command, the address in <varname>$smtp_command</varname> is the original address before any
20925 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
20926 the address after SMTP-time rewriting.
20927 </para>
20928 </listitem></varlistentry>
20929 <varlistentry>
20930 <term><varname>$smtp_command_argument</varname></term>
20931 <listitem>
20932 <para>
20933 <indexterm role="concept">
20934 <primary>SMTP</primary>
20935 <secondary>command, argument for</secondary>
20936 </indexterm>
20937 <indexterm role="variable">
20938 <primary><varname>$smtp_command_argument</varname></primary>
20939 </indexterm>
20940 While an ACL is running to check an SMTP command, this variable contains the
20941 argument, that is, the text that follows the command name, with leading white
20942 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
20943 somewhat redundant, but is retained for backwards compatibility.
20944 </para>
20945 </listitem></varlistentry>
20946 <varlistentry>
20947 <term><varname>$smtp_command_history</varname></term>
20948 <listitem>
20949 <para>
20950 <indexterm role="concept">
20951 <primary>SMTP</primary>
20952 <secondary>command history</secondary>
20953 </indexterm>
20954 <indexterm role="variable">
20955 <primary><varname>$smtp_command_history</varname></primary>
20956 </indexterm>
20957 A comma-separated list (with no whitespace) of the most-recent SMTP commands
20958 received, in time-order left to right.  Only a limited number of commands
20959 are remembered.
20960 </para>
20961 </listitem></varlistentry>
20962 <varlistentry>
20963 <term><varname>$smtp_count_at_connection_start</varname></term>
20964 <listitem>
20965 <para>
20966 <indexterm role="variable">
20967 <primary><varname>$smtp_count_at_connection_start</varname></primary>
20968 </indexterm>
20969 This variable is set greater than zero only in processes spawned by the Exim
20970 daemon for handling incoming SMTP connections. The name is deliberately long,
20971 in order to emphasize what the contents are. When the daemon accepts a new
20972 connection, it increments this variable. A copy of the variable is passed to
20973 the child process that handles the connection, but its value is fixed, and
20974 never changes. It is only an approximation of how many incoming connections
20975 there actually are, because many other connections may come and go while a
20976 single connection is being processed. When a child process terminates, the
20977 daemon decrements its copy of the variable.
20978 </para>
20979 </listitem></varlistentry>
20980 <varlistentry>
20981 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
20982 <listitem>
20983 <para>
20984 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
20985 that were current at the end of the system filter file. This allows a system
20986 filter file to set values that can be tested in users&#x2019; filter files. For
20987 example, a system filter could set a value indicating how likely it is that a
20988 message is junk mail.
20989 </para>
20990 </listitem></varlistentry>
20991 <varlistentry>
20992 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
20993 <listitem>
20994 <para>
20995 A number of variables whose names start with <varname>$spam</varname> are available when Exim
20996 is compiled with the content-scanning extension. For details, see section
20997 <xref linkend="SECTscanspamass"/>.
20998 </para>
20999 </listitem></varlistentry>
21000 <varlistentry>
21001 <term><varname>$spf_header_comment</varname></term>
21002 <term><varname>$spf_received</varname></term>
21003 <term><varname>$spf_result</varname></term>
21004 <term><varname>$spf_result_guessed</varname></term>
21005 <term><varname>$spf_smtp_comment</varname></term>
21006 <listitem>
21007 <para>
21008 These variables are only available if Exim is built with SPF support.
21009 For details see section <xref linkend="SECSPF"/>.
21010 </para>
21011 </listitem></varlistentry>
21012 <varlistentry>
21013 <term><varname>$spool_directory</varname></term>
21014 <listitem>
21015 <para>
21016 <indexterm role="variable">
21017 <primary><varname>$spool_directory</varname></primary>
21018 </indexterm>
21019 The name of Exim&#x2019;s spool directory.
21020 </para>
21021 </listitem></varlistentry>
21022 <varlistentry>
21023 <term><varname>$spool_inodes</varname></term>
21024 <listitem>
21025 <para>
21026 <indexterm role="variable">
21027 <primary><varname>$spool_inodes</varname></primary>
21028 </indexterm>
21029 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
21030 being written. The value is recalculated whenever the variable is referenced.
21031 If the relevant file system does not have the concept of inodes, the value of
21032 is -1. See also the <option>check_spool_inodes</option> option.
21033 </para>
21034 </listitem></varlistentry>
21035 <varlistentry>
21036 <term><varname>$spool_space</varname></term>
21037 <listitem>
21038 <para>
21039 <indexterm role="variable">
21040 <primary><varname>$spool_space</varname></primary>
21041 </indexterm>
21042 The amount of free space (as a number of kilobytes) in the disk partition where
21043 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
21044 variable is referenced. If the operating system does not have the ability to
21045 find the amount of free space (only true for experimental systems), the space
21046 value is -1. For example, to check in an ACL that there is at least 50
21047 megabytes free on the spool, you could write:
21048 </para>
21049 <literallayout class="monospaced">
21050 condition = ${if &gt; {$spool_space}{50000}}
21051 </literallayout>
21052 <para>
21053 See also the <option>check_spool_space</option> option.
21054 </para>
21055 </listitem></varlistentry>
21056 <varlistentry>
21057 <term><varname>$thisaddress</varname></term>
21058 <listitem>
21059 <para>
21060 <indexterm role="variable">
21061 <primary><varname>$thisaddress</varname></primary>
21062 </indexterm>
21063 This variable is set only during the processing of the <option>foranyaddress</option>
21064 command in a filter file. Its use is explained in the description of that
21065 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
21066 interfaces to mail filtering</emphasis>.
21067 </para>
21068 </listitem></varlistentry>
21069 <varlistentry>
21070 <term><varname>$tls_in_bits</varname></term>
21071 <listitem>
21072 <para>
21073 <indexterm role="variable">
21074 <primary><varname>$tls_in_bits</varname></primary>
21075 </indexterm>
21076 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21077 on the inbound connection; the meaning of
21078 this depends upon the TLS implementation used.
21079 If TLS has not been negotiated, the value will be 0.
21080 The value of this is automatically fed into the Cyrus SASL authenticator
21081 when acting as a server, to specify the "external SSF" (a SASL term).
21082 </para>
21083 <para>
21084 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
21085 except when used in the context of an outbound SMTP delivery, when it refers to
21086 the outbound.
21087 </para>
21088 </listitem></varlistentry>
21089 <varlistentry>
21090 <term><varname>$tls_out_bits</varname></term>
21091 <listitem>
21092 <para>
21093 <indexterm role="variable">
21094 <primary><varname>$tls_out_bits</varname></primary>
21095 </indexterm>
21096 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21097 on an outbound SMTP connection; the meaning of
21098 this depends upon the TLS implementation used.
21099 If TLS has not been negotiated, the value will be 0.
21100 </para>
21101 </listitem></varlistentry>
21102 <varlistentry>
21103 <term><varname>$tls_in_ourcert</varname></term>
21104 <listitem>
21105 <para>
21106 <indexterm role="variable">
21107 <primary><varname>$tls_in_ourcert</varname></primary>
21108 </indexterm>
21109 <indexterm role="concept">
21110 <primary>certificate</primary>
21111 <secondary>variables</secondary>
21112 </indexterm>
21113 This variable refers to the certificate presented to the peer of an
21114 inbound connection when the message was received.
21115 It is only useful as the argument of a
21116 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21117 or a <option>def</option> condition.
21118 </para>
21119 <para>
21120 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
21121 when a list of more than one
21122 file is used for <option>tls_certificate</option>, this variable is not reliable.
21123 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
21124 </para>
21125 </listitem></varlistentry>
21126 <varlistentry>
21127 <term><varname>$tls_in_peercert</varname></term>
21128 <listitem>
21129 <para>
21130 <indexterm role="variable">
21131 <primary><varname>$tls_in_peercert</varname></primary>
21132 </indexterm>
21133 This variable refers to the certificate presented by the peer of an
21134 inbound connection when the message was received.
21135 It is only useful as the argument of a
21136 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21137 or a <option>def</option> condition.
21138 If certificate verification fails it may refer to a failing chain element
21139 which is not the leaf.
21140 </para>
21141 </listitem></varlistentry>
21142 <varlistentry>
21143 <term><varname>$tls_out_ourcert</varname></term>
21144 <listitem>
21145 <para>
21146 <indexterm role="variable">
21147 <primary><varname>$tls_out_ourcert</varname></primary>
21148 </indexterm>
21149 This variable refers to the certificate presented to the peer of an
21150 outbound connection.  It is only useful as the argument of a
21151 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21152 or a <option>def</option> condition.
21153 </para>
21154 </listitem></varlistentry>
21155 <varlistentry>
21156 <term><varname>$tls_out_peercert</varname></term>
21157 <listitem>
21158 <para>
21159 <indexterm role="variable">
21160 <primary><varname>$tls_out_peercert</varname></primary>
21161 </indexterm>
21162 This variable refers to the certificate presented by the peer of an
21163 outbound connection.  It is only useful as the argument of a
21164 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21165 or a <option>def</option> condition.
21166 If certificate verification fails it may refer to a failing chain element
21167 which is not the leaf.
21168 </para>
21169 </listitem></varlistentry>
21170 <varlistentry>
21171 <term><varname>$tls_in_certificate_verified</varname></term>
21172 <listitem>
21173 <para>
21174 <indexterm role="variable">
21175 <primary><varname>$tls_in_certificate_verified</varname></primary>
21176 </indexterm>
21177 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
21178 message was received, and <quote>0</quote> otherwise.
21179 </para>
21180 <para>
21181 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
21182 except when used in the context of an outbound SMTP delivery, when it refers to
21183 the outbound.
21184 </para>
21185 </listitem></varlistentry>
21186 <varlistentry>
21187 <term><varname>$tls_out_certificate_verified</varname></term>
21188 <listitem>
21189 <para>
21190 <indexterm role="variable">
21191 <primary><varname>$tls_out_certificate_verified</varname></primary>
21192 </indexterm>
21193 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
21194 outbound SMTP connection was made,
21195 and <quote>0</quote> otherwise.
21196 </para>
21197 </listitem></varlistentry>
21198 <varlistentry>
21199 <term><varname>$tls_in_cipher</varname></term>
21200 <listitem>
21201 <para>
21202 <indexterm role="variable">
21203 <primary><varname>$tls_in_cipher</varname></primary>
21204 </indexterm>
21205 <indexterm role="variable">
21206 <primary><varname>$tls_cipher</varname></primary>
21207 </indexterm>
21208 When a message is received from a remote host over an encrypted SMTP
21209 connection, this variable is set to the cipher suite that was negotiated, for
21210 example DES-CBC3-SHA. In other circumstances, in particular, for message
21211 received over unencrypted connections, the variable is empty. Testing
21212 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
21213 non-encrypted connections during ACL processing.
21214 </para>
21215 <para>
21216 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
21217 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
21218 becomes the same as <varname>$tls_out_cipher</varname>.
21219 </para>
21220 </listitem></varlistentry>
21221 <varlistentry>
21222 <term><varname>$tls_in_cipher_std</varname></term>
21223 <listitem>
21224 <para>
21225 <indexterm role="variable">
21226 <primary><varname>$tls_in_cipher_std</varname></primary>
21227 </indexterm>
21228 As above, but returning the RFC standard name for the cipher suite.
21229 </para>
21230 </listitem></varlistentry>
21231 <varlistentry>
21232 <term><varname>$tls_out_cipher</varname></term>
21233 <listitem>
21234 <para>
21235 <indexterm role="variable">
21236 <primary><varname>$tls_out_cipher</varname></primary>
21237 </indexterm>
21238 This variable is
21239 cleared before any outgoing SMTP connection is made,
21240 and then set to the outgoing cipher suite if one is negotiated. See chapter
21241 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
21242 details of the <command>smtp</command> transport.
21243 </para>
21244 </listitem></varlistentry>
21245 <varlistentry>
21246 <term><varname>$tls_out_cipher_std</varname></term>
21247 <listitem>
21248 <para>
21249 <indexterm role="variable">
21250 <primary><varname>$tls_out_cipher_std</varname></primary>
21251 </indexterm>
21252 As above, but returning the RFC standard name for the cipher suite.
21253 </para>
21254 </listitem></varlistentry>
21255 <varlistentry>
21256 <term><varname>$tls_out_dane</varname></term>
21257 <listitem>
21258 <para>
21259 <indexterm role="variable">
21260 <primary><varname>$tls_out_dane</varname></primary>
21261 </indexterm>
21262 DANE active status.  See section <xref linkend="SECDANE"/>.
21263 </para>
21264 </listitem></varlistentry>
21265 <varlistentry>
21266 <term><varname>$tls_in_ocsp</varname></term>
21267 <listitem>
21268 <para>
21269 <indexterm role="variable">
21270 <primary><varname>$tls_in_ocsp</varname></primary>
21271 </indexterm>
21272 When a message is received from a remote client connection
21273 the result of any OCSP request from the client is encoded in this variable:
21274 </para>
21275 <literallayout class="monospaced">
21276 0 OCSP proof was not requested (default value)
21277 1 No response to request
21278 2 Response not verified
21279 3 Verification failed
21280 4 Verification succeeded
21281 </literallayout>
21282 </listitem></varlistentry>
21283 <varlistentry>
21284 <term><varname>$tls_out_ocsp</varname></term>
21285 <listitem>
21286 <para>
21287 <indexterm role="variable">
21288 <primary><varname>$tls_out_ocsp</varname></primary>
21289 </indexterm>
21290 When a message is sent to a remote host connection
21291 the result of any OCSP request made is encoded in this variable.
21292 See <varname>$tls_in_ocsp</varname> for values.
21293 </para>
21294 </listitem></varlistentry>
21295 <varlistentry>
21296 <term><varname>$tls_in_peerdn</varname></term>
21297 <listitem>
21298 <para>
21299 <indexterm role="variable">
21300 <primary><varname>$tls_in_peerdn</varname></primary>
21301 </indexterm>
21302 <indexterm role="variable">
21303 <primary><varname>$tls_peerdn</varname></primary>
21304 </indexterm>
21305 <indexterm role="concept">
21306 <primary>certificate</primary>
21307 <secondary>extracting fields</secondary>
21308 </indexterm>
21309 When a message is received from a remote host over an encrypted SMTP
21310 connection, and Exim is configured to request a certificate from the client,
21311 the value of the Distinguished Name of the certificate is made available in the
21312 <varname>$tls_in_peerdn</varname> during subsequent processing.
21313 If certificate verification fails it may refer to a failing chain element
21314 which is not the leaf.
21315 </para>
21316 <para>
21317 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
21318 except when used in the context of an outbound SMTP delivery, when it refers to
21319 the outbound.
21320 </para>
21321 </listitem></varlistentry>
21322 <varlistentry>
21323 <term><varname>$tls_out_peerdn</varname></term>
21324 <listitem>
21325 <para>
21326 <indexterm role="variable">
21327 <primary><varname>$tls_out_peerdn</varname></primary>
21328 </indexterm>
21329 When a message is being delivered to a remote host over an encrypted SMTP
21330 connection, and Exim is configured to request a certificate from the server,
21331 the value of the Distinguished Name of the certificate is made available in the
21332 <varname>$tls_out_peerdn</varname> during subsequent processing.
21333 If certificate verification fails it may refer to a failing chain element
21334 which is not the leaf.
21335 </para>
21336 </listitem></varlistentry>
21337 <varlistentry>
21338 <term><varname>$tls_in_sni</varname></term>
21339 <listitem>
21340 <para>
21341 <indexterm role="variable">
21342 <primary><varname>$tls_in_sni</varname></primary>
21343 </indexterm>
21344 <indexterm role="variable">
21345 <primary><varname>$tls_sni</varname></primary>
21346 </indexterm>
21347 <indexterm role="concept">
21348 <primary>TLS</primary>
21349 <secondary>Server Name Indication</secondary>
21350 </indexterm>
21351 When a TLS session is being established, if the client sends the Server
21352 Name Indication extension, the value will be placed in this variable.
21353 If the variable appears in <option>tls_certificate</option> then this option and
21354 some others, described in <xref linkend="SECTtlssni"/>,
21355 will be re-expanded early in the TLS session, to permit
21356 a different certificate to be presented (and optionally a different key to be
21357 used) to the client, based upon the value of the SNI extension.
21358 </para>
21359 <para>
21360 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
21361 except when used in the context of an outbound SMTP delivery, when it refers to
21362 the outbound.
21363 </para>
21364 </listitem></varlistentry>
21365 <varlistentry>
21366 <term><varname>$tls_out_sni</varname></term>
21367 <listitem>
21368 <para>
21369 <indexterm role="variable">
21370 <primary><varname>$tls_out_sni</varname></primary>
21371 </indexterm>
21372 <indexterm role="concept">
21373 <primary>TLS</primary>
21374 <secondary>Server Name Indication</secondary>
21375 </indexterm>
21376 During outbound
21377 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
21378 the transport.
21379 </para>
21380 </listitem></varlistentry>
21381 <varlistentry>
21382 <term><varname>$tls_out_tlsa_usage</varname></term>
21383 <listitem>
21384 <para>
21385 <indexterm role="variable">
21386 <primary><varname>$tls_out_tlsa_usage</varname></primary>
21387 </indexterm>
21388 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
21389 </para>
21390 </listitem></varlistentry>
21391 <varlistentry>
21392 <term><varname>$tls_in_ver</varname></term>
21393 <listitem>
21394 <para>
21395 <indexterm role="variable">
21396 <primary><varname>$tls_in_ver</varname></primary>
21397 </indexterm>
21398 When a message is received from a remote host over an encrypted SMTP connection
21399 this variable is set to the protocol version, eg <emphasis>TLS1.2</emphasis>.
21400 </para>
21401 </listitem></varlistentry>
21402 <varlistentry>
21403 <term><varname>$tls_out_ver</varname></term>
21404 <listitem>
21405 <para>
21406 <indexterm role="variable">
21407 <primary><varname>$tls_out_ver</varname></primary>
21408 </indexterm>
21409 When a message is being delivered to a remote host over an encrypted SMTP connection
21410 this variable is set to the protocol version.
21411 </para>
21412 </listitem></varlistentry>
21413 <varlistentry>
21414 <term><varname>$tod_bsdinbox</varname></term>
21415 <listitem>
21416 <para>
21417 <indexterm role="variable">
21418 <primary><varname>$tod_bsdinbox</varname></primary>
21419 </indexterm>
21420 The time of day and the date, in the format required for BSD-style mailbox
21421 files, for example: Thu Oct 17 17:14:09 1995.
21422 </para>
21423 </listitem></varlistentry>
21424 <varlistentry>
21425 <term><varname>$tod_epoch</varname></term>
21426 <listitem>
21427 <para>
21428 <indexterm role="variable">
21429 <primary><varname>$tod_epoch</varname></primary>
21430 </indexterm>
21431 The time and date as a number of seconds since the start of the Unix epoch.
21432 </para>
21433 </listitem></varlistentry>
21434 <varlistentry>
21435 <term><varname>$tod_epoch_l</varname></term>
21436 <listitem>
21437 <para>
21438 <indexterm role="variable">
21439 <primary><varname>$tod_epoch_l</varname></primary>
21440 </indexterm>
21441 The time and date as a number of microseconds since the start of the Unix epoch.
21442 </para>
21443 </listitem></varlistentry>
21444 <varlistentry>
21445 <term><varname>$tod_full</varname></term>
21446 <listitem>
21447 <para>
21448 <indexterm role="variable">
21449 <primary><varname>$tod_full</varname></primary>
21450 </indexterm>
21451 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
21452 +0100. The timezone is always given as a numerical offset from UTC, with
21453 positive values used for timezones that are ahead (east) of UTC, and negative
21454 values for those that are behind (west).
21455 </para>
21456 </listitem></varlistentry>
21457 <varlistentry>
21458 <term><varname>$tod_log</varname></term>
21459 <listitem>
21460 <para>
21461 <indexterm role="variable">
21462 <primary><varname>$tod_log</varname></primary>
21463 </indexterm>
21464 The time and date in the format used for writing Exim&#x2019;s log files, for example:
21465 1995-10-12 15:32:29, but without a timezone.
21466 </para>
21467 </listitem></varlistentry>
21468 <varlistentry>
21469 <term><varname>$tod_logfile</varname></term>
21470 <listitem>
21471 <para>
21472 <indexterm role="variable">
21473 <primary><varname>$tod_logfile</varname></primary>
21474 </indexterm>
21475 This variable contains the date in the format yyyymmdd. This is the format that
21476 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
21477 flag.
21478 </para>
21479 </listitem></varlistentry>
21480 <varlistentry>
21481 <term><varname>$tod_zone</varname></term>
21482 <listitem>
21483 <para>
21484 <indexterm role="variable">
21485 <primary><varname>$tod_zone</varname></primary>
21486 </indexterm>
21487 This variable contains the numerical value of the local timezone, for example:
21488 -0500.
21489 </para>
21490 </listitem></varlistentry>
21491 <varlistentry>
21492 <term><varname>$tod_zulu</varname></term>
21493 <listitem>
21494 <para>
21495 <indexterm role="variable">
21496 <primary><varname>$tod_zulu</varname></primary>
21497 </indexterm>
21498 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
21499 by ISO 8601, for example: 20030221154023Z.
21500 </para>
21501 </listitem></varlistentry>
21502 <varlistentry>
21503 <term><varname>$transport_name</varname></term>
21504 <listitem>
21505 <para>
21506 <indexterm role="concept">
21507 <primary>transport</primary>
21508 <secondary>name</secondary>
21509 </indexterm>
21510 <indexterm role="concept">
21511 <primary>name</primary>
21512 <secondary>of transport</secondary>
21513 </indexterm>
21514 <indexterm role="variable">
21515 <primary><varname>$transport_name</varname></primary>
21516 </indexterm>
21517 During the running of a transport, this variable contains its name.
21518 </para>
21519 </listitem></varlistentry>
21520 <varlistentry>
21521 <term><varname>$value</varname></term>
21522 <listitem>
21523 <para>
21524 <indexterm role="variable">
21525 <primary><varname>$value</varname></primary>
21526 </indexterm>
21527 This variable contains the result of an expansion lookup, extraction operation,
21528 or external command, as described above. It is also used during a
21529 <emphasis role="bold">reduce</emphasis> expansion.
21530 </para>
21531 </listitem></varlistentry>
21532 <varlistentry>
21533 <term><varname>$verify_mode</varname></term>
21534 <listitem>
21535 <para>
21536 <indexterm role="variable">
21537 <primary><varname>$verify_mode</varname></primary>
21538 </indexterm>
21539 While a router or transport is being run in verify mode or for cutthrough delivery,
21540 contains "S" for sender-verification or "R" for recipient-verification.
21541 Otherwise, empty.
21542 </para>
21543 </listitem></varlistentry>
21544 <varlistentry>
21545 <term><varname>$version_number</varname></term>
21546 <listitem>
21547 <para>
21548 <indexterm role="variable">
21549 <primary><varname>$version_number</varname></primary>
21550 </indexterm>
21551 The version number of Exim. Same as <varname>$exim_version</varname>, may be overridden
21552 by the <option>exim_version</option> main config option.
21553 </para>
21554 </listitem></varlistentry>
21555 <varlistentry>
21556 <term><varname>$warn_message_delay</varname></term>
21557 <listitem>
21558 <para>
21559 <indexterm role="variable">
21560 <primary><varname>$warn_message_delay</varname></primary>
21561 </indexterm>
21562 This variable is set only during the creation of a message warning about a
21563 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
21564 </para>
21565 </listitem></varlistentry>
21566 <varlistentry>
21567 <term><varname>$warn_message_recipients</varname></term>
21568 <listitem>
21569 <para>
21570 <indexterm role="variable">
21571 <primary><varname>$warn_message_recipients</varname></primary>
21572 </indexterm>
21573 This variable is set only during the creation of a message warning about a
21574 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
21575 </para>
21576 </listitem></varlistentry>
21577 </variablelist>
21578 <para>
21579 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
21580 </para>
21581 </section>
21582 </chapter>
21583
21584 <chapter id="CHAPperl">
21585 <title>Embedded Perl</title>
21586 <para>
21587 <indexterm role="concept" id="IIDperl" class="startofrange">
21588 <primary>Perl</primary>
21589 <secondary>calling from Exim</secondary>
21590 </indexterm>
21591 Exim can be built to include an embedded Perl interpreter. When this is done,
21592 Perl subroutines can be called as part of the string expansion process. To make
21593 use of the Perl support, you need version 5.004 or later of Perl installed on
21594 your system. To include the embedded interpreter in the Exim binary, include
21595 the line
21596 </para>
21597 <literallayout class="monospaced">
21598 EXIM_PERL = perl.o
21599 </literallayout>
21600 <para>
21601 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
21602 </para>
21603 <section id="SECID85">
21604 <title>Setting up so Perl can be used</title>
21605 <para>
21606 <indexterm role="option">
21607 <primary><option>perl_startup</option></primary>
21608 </indexterm>
21609 Access to Perl subroutines is via a global configuration option called
21610 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
21611 no <option>perl_startup</option> option in the Exim configuration file then no Perl
21612 interpreter is started and there is almost no overhead for Exim (since none of
21613 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
21614 option then the associated value is taken to be Perl code which is executed in
21615 a newly created Perl interpreter.
21616 </para>
21617 <para>
21618 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
21619 need backslashes before any characters to escape special meanings. The option
21620 should usually be something like
21621 </para>
21622 <literallayout class="monospaced">
21623 perl_startup = do '/etc/exim.pl'
21624 </literallayout>
21625 <para>
21626 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
21627 use from Exim. Exim can be configured either to start up a Perl interpreter as
21628 soon as it is entered, or to wait until the first time it is needed. Starting
21629 the interpreter at the beginning ensures that it is done while Exim still has
21630 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
21631 fact used in a particular run. Also, note that this does not mean that Exim is
21632 necessarily running as root when Perl is called at a later time. By default,
21633 the interpreter is started only when it is needed, but this can be changed in
21634 two ways:
21635 </para>
21636 <itemizedlist>
21637 <listitem>
21638 <para>
21639 <indexterm role="option">
21640 <primary><option>perl_at_start</option></primary>
21641 </indexterm>
21642 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
21643 a startup when Exim is entered.
21644 </para>
21645 </listitem>
21646 <listitem>
21647 <para>
21648 The command line option <option>-ps</option> also requests a startup when Exim is entered,
21649 overriding the setting of <option>perl_at_start</option>.
21650 </para>
21651 </listitem>
21652 </itemizedlist>
21653 <para>
21654 There is also a command line option <option>-pd</option> (for delay) which suppresses the
21655 initial startup, even if <option>perl_at_start</option> is set.
21656 </para>
21657 <itemizedlist>
21658 <listitem>
21659 <para>
21660 <indexterm role="option">
21661 <primary><option>perl_taintmode</option></primary>
21662 </indexterm>
21663 <indexterm role="concept">
21664 <primary>Perl</primary>
21665 <secondary>taintmode</secondary>
21666 </indexterm>
21667 To provide more security executing Perl code via the embedded Perl
21668 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
21669 taint mode of the Perl interpreter. You are encouraged to set this
21670 option to a true value. To avoid breaking existing installations, it
21671 defaults to false.
21672 </para>
21673 </listitem>
21674 </itemizedlist>
21675 </section>
21676 <section id="SECID86">
21677 <title>Calling Perl subroutines</title>
21678 <para>
21679 When the configuration file includes a <option>perl_startup</option> option you can make use
21680 of the string expansion item to call the Perl subroutines that are defined
21681 by the <option>perl_startup</option> code. The operator is used in any of the following
21682 forms:
21683 </para>
21684 <literallayout class="monospaced">
21685 ${perl{foo}}
21686 ${perl{foo}{argument}}
21687 ${perl{foo}{argument1}{argument2} ... }
21688 </literallayout>
21689 <para>
21690 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
21691 arguments may be passed. Passing more than this results in an expansion failure
21692 with an error message of the form
21693 </para>
21694 <literallayout class="monospaced">
21695 Too many arguments passed to Perl subroutine "foo" (max is 8)
21696 </literallayout>
21697 <para>
21698 The return value of the Perl subroutine is evaluated in a scalar context before
21699 it is passed back to Exim to be inserted into the expanded string. If the
21700 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
21701 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
21702 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
21703 that was passed to <option>die</option>.
21704 </para>
21705 </section>
21706 <section id="SECID87">
21707 <title>Calling Exim functions from Perl</title>
21708 <para>
21709 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
21710 is available to call back into Exim&#x2019;s string expansion function. For example,
21711 the Perl code
21712 </para>
21713 <literallayout class="monospaced">
21714 my $lp = Exim::expand_string('$local_part');
21715 </literallayout>
21716 <para>
21717 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
21718 Note those are single quotes and not double quotes to protect against
21719 <varname>$local_part</varname> being interpolated as a Perl variable.
21720 </para>
21721 <para>
21722 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
21723 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
21724 expansion string, the Perl call from the original expansion string fails with
21725 an appropriate error message, in the same way as if <option>die</option> were used.
21726 </para>
21727 <para>
21728 <indexterm role="concept">
21729 <primary>debugging</primary>
21730 <secondary>from embedded Perl</secondary>
21731 </indexterm>
21732 <indexterm role="concept">
21733 <primary>log</primary>
21734 <secondary>writing from embedded Perl</secondary>
21735 </indexterm>
21736 Two other Exim functions are available for use from within Perl code.
21737 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
21738 debugging is enabled. If you want a newline at the end, you must supply it.
21739 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
21740 timestamp. In this case, you should not supply a terminating newline.
21741 </para>
21742 </section>
21743 <section id="SECID88">
21744 <title>Use of standard output and error by Perl</title>
21745 <para>
21746 <indexterm role="concept">
21747 <primary>Perl</primary>
21748 <secondary>standard output and error</secondary>
21749 </indexterm>
21750 You should not write to the standard error or output streams from within your
21751 Perl code, as it is not defined how these are set up. In versions of Exim
21752 before 4.50, it is possible for the standard output or error to refer to the
21753 SMTP connection during message reception via the daemon. Writing to this stream
21754 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
21755 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
21756 avoided, but the output is lost.
21757 </para>
21758 <para>
21759 <indexterm role="concept">
21760 <primary>Perl</primary>
21761 <secondary>use of <option>warn</option></secondary>
21762 </indexterm>
21763 The Perl <option>warn</option> statement writes to the standard error stream by default.
21764 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
21765 you have no control. When Exim starts up the Perl interpreter, it arranges for
21766 output from the <option>warn</option> statement to be written to the Exim main log. You can
21767 change this by including appropriate Perl magic somewhere in your Perl code.
21768 For example, to discard <option>warn</option> output completely, you need this:
21769 </para>
21770 <literallayout class="monospaced">
21771 $SIG{__WARN__} = sub { };
21772 </literallayout>
21773 <para>
21774 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
21775 example, the code for the subroutine is empty, so it does nothing, but you can
21776 include any Perl code that you like. The text of the <option>warn</option> message is passed
21777 as the first subroutine argument.
21778 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
21779 </para>
21780 </section>
21781 </chapter>
21782
21783 <chapter id="CHAPinterfaces">
21784 <title>Starting the daemon and the use of network interfaces</title>
21785 <titleabbrev>Starting the daemon</titleabbrev>
21786 <para>
21787 <indexterm role="concept">
21788 <primary>daemon</primary>
21789 <secondary>starting</secondary>
21790 </indexterm>
21791 <indexterm role="concept">
21792 <primary>interface</primary>
21793 <secondary>listening</secondary>
21794 </indexterm>
21795 <indexterm role="concept">
21796 <primary>network interface</primary>
21797 </indexterm>
21798 <indexterm role="concept">
21799 <primary>interface</primary>
21800 <secondary>network</secondary>
21801 </indexterm>
21802 <indexterm role="concept">
21803 <primary>IP address</primary>
21804 <secondary>for listening</secondary>
21805 </indexterm>
21806 <indexterm role="concept">
21807 <primary>daemon</primary>
21808 <secondary>listening IP addresses</secondary>
21809 </indexterm>
21810 <indexterm role="concept">
21811 <primary>TCP/IP</primary>
21812 <secondary>setting listening interfaces</secondary>
21813 </indexterm>
21814 <indexterm role="concept">
21815 <primary>TCP/IP</primary>
21816 <secondary>setting listening ports</secondary>
21817 </indexterm>
21818 A host that is connected to a TCP/IP network may have one or more physical
21819 hardware network interfaces. Each of these interfaces may be configured as one
21820 or more <quote>logical</quote> interfaces, which are the entities that a program actually
21821 works with. Each of these logical interfaces is associated with an IP address.
21822 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
21823 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
21824 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
21825 </para>
21826 <orderedlist numeration="arabic">
21827 <listitem>
21828 <para>
21829 When a listening daemon is started, Exim needs to know which interfaces
21830 and ports to listen on.
21831 </para>
21832 </listitem>
21833 <listitem>
21834 <para>
21835 When Exim is routing an address, it needs to know which IP addresses
21836 are associated with local interfaces. This is required for the correct
21837 processing of MX lists by removing the local host and others with the
21838 same or higher priority values. Also, Exim needs to detect cases
21839 when an address is routed to an IP address that in fact belongs to the
21840 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
21841 option of the smtp transport is set (as appropriate), this is treated
21842 as an error situation.
21843 </para>
21844 </listitem>
21845 <listitem>
21846 <para>
21847 When Exim connects to a remote host, it may need to know which interface to use
21848 for the outgoing connection.
21849 </para>
21850 </listitem>
21851 </orderedlist>
21852 <para>
21853 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
21854 of cases. If your host has only one interface, and you want all its IP
21855 addresses to be treated in the same way, and you are using only the
21856 standard SMTP port, you should not need to take any special action. The
21857 rest of this chapter does not apply to you.
21858 </para>
21859 <para>
21860 In a more complicated situation you may want to listen only on certain
21861 interfaces, or on different ports, and for this reason there are a number of
21862 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
21863 chapter describes how they operate.
21864 </para>
21865 <para>
21866 When a message is received over TCP/IP, the interface and port that were
21867 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
21868 </para>
21869 <section id="SECID89">
21870 <title>Starting a listening daemon</title>
21871 <para>
21872 When a listening daemon is started (by means of the <option>-bd</option> command line
21873 option), the interfaces and ports on which it listens are controlled by the
21874 following options:
21875 </para>
21876 <itemizedlist>
21877 <listitem>
21878 <para>
21879 <option>daemon_smtp_ports</option> contains a list of default ports
21880 or service names.
21881 (For backward compatibility, this option can also be specified in the singular.)
21882 </para>
21883 </listitem>
21884 <listitem>
21885 <para>
21886 <option>local_interfaces</option> contains list of interface IP addresses on which to
21887 listen. Each item may optionally also specify a port.
21888 </para>
21889 </listitem>
21890 </itemizedlist>
21891 <para>
21892 The default list separator in both cases is a colon, but this can be changed as
21893 described in section <xref linkend="SECTlistsepchange"/>. When IPv6 addresses are involved,
21894 it is usually best to change the separator to avoid having to double all the
21895 colons. For example:
21896 </para>
21897 <literallayout class="monospaced">
21898 local_interfaces = &lt;; 127.0.0.1 ; \
21899                       192.168.23.65 ; \
21900                       ::1 ; \
21901                       3ffe:ffff:836f::fe86:a061
21902 </literallayout>
21903 <para>
21904 There are two different formats for specifying a port along with an IP address
21905 in <option>local_interfaces</option>:
21906 </para>
21907 <orderedlist numeration="arabic">
21908 <listitem>
21909 <para>
21910 The port is added onto the address with a dot separator. For example, to listen
21911 on port 1234 on two different IP addresses:
21912 </para>
21913 <literallayout class="monospaced">
21914 local_interfaces = &lt;; 192.168.23.65.1234 ; \
21915                       3ffe:ffff:836f::fe86:a061.1234
21916 </literallayout>
21917 </listitem>
21918 <listitem>
21919 <para>
21920 The IP address is enclosed in square brackets, and the port is added
21921 with a colon separator, for example:
21922 </para>
21923 <literallayout class="monospaced">
21924 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
21925                       [3ffe:ffff:836f::fe86:a061]:1234
21926 </literallayout>
21927 </listitem>
21928 </orderedlist>
21929 <para>
21930 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
21931 default setting contains just one port:
21932 </para>
21933 <literallayout class="monospaced">
21934 daemon_smtp_ports = smtp
21935 </literallayout>
21936 <para>
21937 If more than one port is listed, each interface that does not have its own port
21938 specified listens on all of them. Ports that are listed in
21939 <option>daemon_smtp_ports</option> can be identified either by name (defined in
21940 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
21941 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
21942 </para>
21943 </section>
21944 <section id="SECID90">
21945 <title>Special IP listening addresses</title>
21946 <para>
21947 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
21948 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
21949 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
21950 instead of setting up separate listening sockets for each interface. The
21951 default value of <option>local_interfaces</option> is
21952 </para>
21953 <literallayout class="monospaced">
21954 local_interfaces = 0.0.0.0
21955 </literallayout>
21956 <para>
21957 when Exim is built without IPv6 support; otherwise it is:
21958 </para>
21959 <literallayout class="monospaced">
21960 local_interfaces = &lt;; ::0 ; 0.0.0.0
21961 </literallayout>
21962 <para>
21963 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
21964 </para>
21965 </section>
21966 <section id="SECID91">
21967 <title>Overriding local_interfaces and daemon_smtp_ports</title>
21968 <para>
21969 The <option>-oX</option> command line option can be used to override the values of
21970 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
21971 instance. Another way of doing this would be to use macros and the <option>-D</option>
21972 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
21973 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
21974 exim.
21975 </para>
21976 <para>
21977 The value of <option>-oX</option> is a list of items. The default colon separator can be
21978 changed in the usual way (<xref linkend="SECTlistsepchange"/>) if required.
21979 If there are any items that do not
21980 contain dots or colons (that is, are not IP addresses), the value of
21981 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
21982 items that do contain dots or colons, the value of <option>local_interfaces</option> is
21983 replaced by those items. Thus, for example,
21984 </para>
21985 <literallayout class="monospaced">
21986 -oX 1225
21987 </literallayout>
21988 <para>
21989 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
21990 whereas
21991 </para>
21992 <literallayout class="monospaced">
21993 -oX 192.168.34.5.1125
21994 </literallayout>
21995 <para>
21996 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
21997 (However, since <option>local_interfaces</option> now contains no items without ports, the
21998 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
21999 </para>
22000 </section>
22001 <section id="SECTsupobssmt">
22002 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
22003 <para>
22004 <indexterm role="concept">
22005 <primary>submissions protocol</primary>
22006 </indexterm>
22007 <indexterm role="concept">
22008 <primary>ssmtp protocol</primary>
22009 </indexterm>
22010 <indexterm role="concept">
22011 <primary>smtps protocol</primary>
22012 </indexterm>
22013 <indexterm role="concept">
22014 <primary>SMTP</primary>
22015 <secondary>ssmtp protocol</secondary>
22016 </indexterm>
22017 <indexterm role="concept">
22018 <primary>SMTP</primary>
22019 <secondary>smtps protocol</secondary>
22020 </indexterm>
22021 Exim supports the use of TLS-on-connect, used by mail clients in the
22022 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
22023 For some years, IETF Standards Track documents only blessed the
22024 STARTTLS-based Submission service (port 587) while common practice was to support
22025 the same feature set on port 465, but using TLS-on-connect.
22026 If your installation needs to provide service to mail clients
22027 (Mail User Agents, MUAs) then you should provide service on both the 587 and
22028 the 465 TCP ports.
22029 </para>
22030 <para>
22031 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
22032 service names, connections to those ports must first establish TLS, before
22033 proceeding to the application layer use of the SMTP protocol.
22034 </para>
22035 <para>
22036 The common use of this option is expected to be
22037 </para>
22038 <literallayout class="monospaced">
22039 tls_on_connect_ports = 465
22040 </literallayout>
22041 <para>
22042 per RFC 8314.
22043 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
22044 to behave in this way when a daemon is started.
22045 </para>
22046 <para>
22047 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
22048 daemon to listen on those ports. You must still specify them in
22049 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
22050 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
22051 connections via the daemon.)
22052 </para>
22053 </section>
22054 <section id="SECID92">
22055 <title>IPv6 address scopes</title>
22056 <para>
22057 <indexterm role="concept">
22058 <primary>IPv6</primary>
22059 <secondary>address scopes</secondary>
22060 </indexterm>
22061 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
22062 can, in principle, have the same link-local IPv6 address on different
22063 interfaces. Thus, additional information is needed, over and above the IP
22064 address, to distinguish individual interfaces. A convention of using a
22065 percent sign followed by something (often the interface name) has been
22066 adopted in some cases, leading to addresses like this:
22067 </para>
22068 <literallayout class="monospaced">
22069 fe80::202:b3ff:fe03:45c1%eth0
22070 </literallayout>
22071 <para>
22072 To accommodate this usage, a percent sign followed by an arbitrary string is
22073 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
22074 to convert a textual IPv6 address for actual use. This function recognizes the
22075 percent convention in operating systems that support it, and it processes the
22076 address appropriately. Unfortunately, some older libraries have problems with
22077 <function>getaddrinfo()</function>. If
22078 </para>
22079 <literallayout class="monospaced">
22080 IPV6_USE_INET_PTON=yes
22081 </literallayout>
22082 <para>
22083 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
22084 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
22085 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
22086 function.) Of course, this means that the additional functionality of
22087 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
22088 </para>
22089 </section>
22090 <section id="SECID93">
22091 <title>Disabling IPv6</title>
22092 <para>
22093 <indexterm role="concept">
22094 <primary>IPv6</primary>
22095 <secondary>disabling</secondary>
22096 </indexterm>
22097 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
22098 run on a host whose kernel does not support IPv6. The binary will fall back to
22099 using IPv4, but it may waste resources looking up AAAA records, and trying to
22100 connect to IPv6 addresses, causing delays to mail delivery. If you set the
22101 <indexterm role="option">
22102 <primary><option>disable_ipv6</option></primary>
22103 </indexterm>
22104 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
22105 activities take place. AAAA records are never looked up, and any IPv6 addresses
22106 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
22107 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22108 to handle IPv6 literal addresses.
22109 </para>
22110 <para>
22111 On the other hand, when IPv6 is in use, there may be times when you want to
22112 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
22113 option to globally suppress the lookup of AAAA records for specified domains,
22114 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
22115 IPv6 addresses in an individual router.
22116 </para>
22117 </section>
22118 <section id="SECID94">
22119 <title>Examples of starting a listening daemon</title>
22120 <para>
22121 The default case in an IPv6 environment is
22122 </para>
22123 <literallayout class="monospaced">
22124 daemon_smtp_ports = smtp
22125 local_interfaces = &lt;; ::0 ; 0.0.0.0
22126 </literallayout>
22127 <para>
22128 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
22129 Either one or two sockets may be used, depending on the characteristics of
22130 the TCP/IP stack. (This is complicated and messy; for more information,
22131 read the comments in the <filename>daemon.c</filename> source file.)
22132 </para>
22133 <para>
22134 To specify listening on ports 25 and 26 on all interfaces:
22135 </para>
22136 <literallayout class="monospaced">
22137 daemon_smtp_ports = 25 : 26
22138 </literallayout>
22139 <para>
22140 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
22141 </para>
22142 <literallayout class="monospaced">
22143 local_interfaces = &lt;; ::0.25     ; ::0.26 \
22144                       0.0.0.0.25 ; 0.0.0.0.26
22145 </literallayout>
22146 <para>
22147 To listen on the default port on all IPv4 interfaces, and on port 26 on the
22148 IPv4 loopback address only:
22149 </para>
22150 <literallayout class="monospaced">
22151 local_interfaces = 0.0.0.0 : 127.0.0.1.26
22152 </literallayout>
22153 <para>
22154 To specify listening on the default port on specific interfaces only:
22155 </para>
22156 <literallayout class="monospaced">
22157 local_interfaces = 10.0.0.67 : 192.168.34.67
22158 </literallayout>
22159 <para>
22160 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
22161 </para>
22162 </section>
22163 <section id="SECTreclocipadd">
22164 <title>Recognizing the local host</title>
22165 <para>
22166 The <option>local_interfaces</option> option is also used when Exim needs to determine
22167 whether or not an IP address refers to the local host. That is, the IP
22168 addresses of all the interfaces on which a daemon is listening are always
22169 treated as local.
22170 </para>
22171 <para>
22172 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
22173 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
22174 available interfaces from the operating system, and extracts the relevant
22175 (that is, IPv4 or IPv6) addresses to use for checking.
22176 </para>
22177 <para>
22178 Some systems set up large numbers of virtual interfaces in order to provide
22179 many virtual web servers. In this situation, you may want to listen for
22180 email on only a few of the available interfaces, but nevertheless treat all
22181 interfaces as local when routing. You can do this by setting
22182 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
22183 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
22184 used for listening. Consider this example:
22185 </para>
22186 <literallayout class="monospaced">
22187 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
22188                       192.168.53.235 ; \
22189                       3ffe:2101:12:1:a00:20ff:fe86:a061
22190
22191 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
22192 </literallayout>
22193 <para>
22194 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
22195 address, but all available interface addresses are treated as local when
22196 Exim is routing.
22197 </para>
22198 <para>
22199 In some environments the local host name may be in an MX list, but with an IP
22200 address that is not assigned to any local interface. In other cases it may be
22201 desirable to treat other host names as if they referred to the local host. Both
22202 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
22203 This contains host names rather than IP addresses. When a host is referenced
22204 during routing, either via an MX record or directly, it is treated as the local
22205 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
22206 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
22207 </para>
22208 </section>
22209 <section id="SECID95">
22210 <title>Delivering to a remote host</title>
22211 <para>
22212 Delivery to a remote host is handled by the smtp transport. By default, it
22213 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
22214 there is more than one) when connecting to a remote host. However, the
22215 <option>interface</option> option can be set to specify which interface is used. See the
22216 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
22217 details.
22218 </para>
22219 </section>
22220 </chapter>
22221
22222 <chapter id="CHAPmainconfig">
22223 <title>Main configuration</title>
22224 <para>
22225 <indexterm role="concept" id="IIDconfima" class="startofrange">
22226 <primary>configuration file</primary>
22227 <secondary>main section</secondary>
22228 </indexterm>
22229 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
22230 <primary>main configuration</primary>
22231 </indexterm>
22232 The first part of the runtime configuration file contains three types of item:
22233 </para>
22234 <itemizedlist>
22235 <listitem>
22236 <para>
22237 Macro definitions: These lines start with an upper case letter. See section
22238 <xref linkend="SECTmacrodefs"/> for details of macro processing.
22239 </para>
22240 </listitem>
22241 <listitem>
22242 <para>
22243 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
22244 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
22245 section <xref linkend="SECTnamedlists"/>.
22246 </para>
22247 </listitem>
22248 <listitem>
22249 <para>
22250 Main configuration settings: Each setting occupies one line of the file
22251 (with possible continuations). If any setting is preceded by the word
22252 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
22253 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
22254 settings.
22255 </para>
22256 </listitem>
22257 </itemizedlist>
22258 <para>
22259 This chapter specifies all the main configuration options, along with their
22260 types and default values. For ease of finding a particular option, they appear
22261 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
22262 are now so many options, they are first listed briefly in functional groups, as
22263 an aid to finding the name of the option you are looking for. Some options are
22264 listed in more than one group.
22265 </para>
22266 <section id="SECID96">
22267 <title>Miscellaneous</title>
22268 <informaltable frame="none">
22269 <tgroup cols="2" colsep="0" rowsep="0">
22270 <colspec colwidth="196pt" align="left"/>
22271 <colspec colwidth="254pt" align="left"/>
22272 <tbody>
22273 <row>
22274 <entry><option>bi_command</option></entry>
22275 <entry>to run for <option>-bi</option> command line option</entry>
22276 </row>
22277 <row>
22278 <entry><option>debug_store</option></entry>
22279 <entry>do extra internal checks</entry>
22280 </row>
22281 <row>
22282 <entry><option>disable_ipv6</option></entry>
22283 <entry>do no IPv6 processing</entry>
22284 </row>
22285 <row>
22286 <entry><option>keep_malformed</option></entry>
22287 <entry>for broken files &ndash; should not happen</entry>
22288 </row>
22289 <row>
22290 <entry><option>localhost_number</option></entry>
22291 <entry>for unique message ids in clusters</entry>
22292 </row>
22293 <row>
22294 <entry><option>message_body_newlines</option></entry>
22295 <entry>retain newlines in <varname>$message_body</varname></entry>
22296 </row>
22297 <row>
22298 <entry><option>message_body_visible</option></entry>
22299 <entry>how much to show in <varname>$message_body</varname></entry>
22300 </row>
22301 <row>
22302 <entry><option>mua_wrapper</option></entry>
22303 <entry>run in <quote>MUA wrapper</quote> mode</entry>
22304 </row>
22305 <row>
22306 <entry><option>print_topbitchars</option></entry>
22307 <entry>top-bit characters are printing</entry>
22308 </row>
22309 <row>
22310 <entry><option>spool_wireformat</option></entry>
22311 <entry>use wire-format spool data files when possible</entry>
22312 </row>
22313 <row>
22314 <entry><option>timezone</option></entry>
22315 <entry>force time zone</entry>
22316 </row>
22317 </tbody>
22318 </tgroup>
22319 </informaltable>
22320 </section>
22321 <section id="SECID97">
22322 <title>Exim parameters</title>
22323 <informaltable frame="none">
22324 <tgroup cols="2" colsep="0" rowsep="0">
22325 <colspec colwidth="196pt" align="left"/>
22326 <colspec colwidth="254pt" align="left"/>
22327 <tbody>
22328 <row>
22329 <entry><option>exim_group</option></entry>
22330 <entry>override compiled-in value</entry>
22331 </row>
22332 <row>
22333 <entry><option>exim_path</option></entry>
22334 <entry>override compiled-in value</entry>
22335 </row>
22336 <row>
22337 <entry><option>exim_user</option></entry>
22338 <entry>override compiled-in value</entry>
22339 </row>
22340 <row>
22341 <entry><option>primary_hostname</option></entry>
22342 <entry>default from <function>uname()</function></entry>
22343 </row>
22344 <row>
22345 <entry><option>split_spool_directory</option></entry>
22346 <entry>use multiple directories</entry>
22347 </row>
22348 <row>
22349 <entry><option>spool_directory</option></entry>
22350 <entry>override compiled-in value</entry>
22351 </row>
22352 </tbody>
22353 </tgroup>
22354 </informaltable>
22355 </section>
22356 <section id="SECID98">
22357 <title>Privilege controls</title>
22358 <informaltable frame="none">
22359 <tgroup cols="2" colsep="0" rowsep="0">
22360 <colspec colwidth="196pt" align="left"/>
22361 <colspec colwidth="254pt" align="left"/>
22362 <tbody>
22363 <row>
22364 <entry><option>admin_groups</option></entry>
22365 <entry>groups that are Exim admin users</entry>
22366 </row>
22367 <row>
22368 <entry><option>commandline_checks_require_admin</option></entry>
22369 <entry>require admin for various checks</entry>
22370 </row>
22371 <row>
22372 <entry><option>deliver_drop_privilege</option></entry>
22373 <entry>drop root for delivery processes</entry>
22374 </row>
22375 <row>
22376 <entry><option>local_from_check</option></entry>
22377 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
22378 </row>
22379 <row>
22380 <entry><option>local_from_prefix</option></entry>
22381 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
22382 </row>
22383 <row>
22384 <entry><option>local_from_suffix</option></entry>
22385 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
22386 </row>
22387 <row>
22388 <entry><option>local_sender_retain</option></entry>
22389 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
22390 </row>
22391 <row>
22392 <entry><option>never_users</option></entry>
22393 <entry>do not run deliveries as these</entry>
22394 </row>
22395 <row>
22396 <entry><option>prod_requires_admin</option></entry>
22397 <entry>forced delivery requires admin user</entry>
22398 </row>
22399 <row>
22400 <entry><option>queue_list_requires_admin</option></entry>
22401 <entry>queue listing requires admin user</entry>
22402 </row>
22403 <row>
22404 <entry><option>trusted_groups</option></entry>
22405 <entry>groups that are trusted</entry>
22406 </row>
22407 <row>
22408 <entry><option>trusted_users</option></entry>
22409 <entry>users that are trusted</entry>
22410 </row>
22411 </tbody>
22412 </tgroup>
22413 </informaltable>
22414 </section>
22415 <section id="SECID99">
22416 <title>Logging</title>
22417 <informaltable frame="none">
22418 <tgroup cols="2" colsep="0" rowsep="0">
22419 <colspec colwidth="196pt" align="left"/>
22420 <colspec colwidth="254pt" align="left"/>
22421 <tbody>
22422 <row>
22423 <entry><option>event_action</option></entry>
22424 <entry>custom logging</entry>
22425 </row>
22426 <row>
22427 <entry><option>hosts_connection_nolog</option></entry>
22428 <entry>exemption from connect logging</entry>
22429 </row>
22430 <row>
22431 <entry><option>log_file_path</option></entry>
22432 <entry>override compiled-in value</entry>
22433 </row>
22434 <row>
22435 <entry><option>log_selector</option></entry>
22436 <entry>set/unset optional logging</entry>
22437 </row>
22438 <row>
22439 <entry><option>log_timezone</option></entry>
22440 <entry>add timezone to log lines</entry>
22441 </row>
22442 <row>
22443 <entry><option>message_logs</option></entry>
22444 <entry>create per-message logs</entry>
22445 </row>
22446 <row>
22447 <entry><option>preserve_message_logs</option></entry>
22448 <entry>after message completion</entry>
22449 </row>
22450 <row>
22451 <entry><option>process_log_path</option></entry>
22452 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
22453 </row>
22454 <row>
22455 <entry><option>slow_lookup_log</option></entry>
22456 <entry>control logging of slow DNS lookups</entry>
22457 </row>
22458 <row>
22459 <entry><option>syslog_duplication</option></entry>
22460 <entry>controls duplicate log lines on syslog</entry>
22461 </row>
22462 <row>
22463 <entry><option>syslog_facility</option></entry>
22464 <entry>set syslog <quote>facility</quote> field</entry>
22465 </row>
22466 <row>
22467 <entry><option>syslog_pid</option></entry>
22468 <entry>pid in syslog lines</entry>
22469 </row>
22470 <row>
22471 <entry><option>syslog_processname</option></entry>
22472 <entry>set syslog <quote>ident</quote> field</entry>
22473 </row>
22474 <row>
22475 <entry><option>syslog_timestamp</option></entry>
22476 <entry>timestamp syslog lines</entry>
22477 </row>
22478 <row>
22479 <entry><option>write_rejectlog</option></entry>
22480 <entry>control use of message log</entry>
22481 </row>
22482 </tbody>
22483 </tgroup>
22484 </informaltable>
22485 </section>
22486 <section id="SECID100">
22487 <title>Frozen messages</title>
22488 <informaltable frame="none">
22489 <tgroup cols="2" colsep="0" rowsep="0">
22490 <colspec colwidth="196pt" align="left"/>
22491 <colspec colwidth="254pt" align="left"/>
22492 <tbody>
22493 <row>
22494 <entry><option>auto_thaw</option></entry>
22495 <entry>sets time for retrying frozen messages</entry>
22496 </row>
22497 <row>
22498 <entry><option>freeze_tell</option></entry>
22499 <entry>send message when freezing</entry>
22500 </row>
22501 <row>
22502 <entry><option>move_frozen_messages</option></entry>
22503 <entry>to another directory</entry>
22504 </row>
22505 <row>
22506 <entry><option>timeout_frozen_after</option></entry>
22507 <entry>keep frozen messages only so long</entry>
22508 </row>
22509 </tbody>
22510 </tgroup>
22511 </informaltable>
22512 </section>
22513 <section id="SECID101">
22514 <title>Data lookups</title>
22515 <informaltable frame="none">
22516 <tgroup cols="2" colsep="0" rowsep="0">
22517 <colspec colwidth="196pt" align="left"/>
22518 <colspec colwidth="254pt" align="left"/>
22519 <tbody>
22520 <row>
22521 <entry><option>ibase_servers</option></entry>
22522 <entry>InterBase servers</entry>
22523 </row>
22524 <row>
22525 <entry><option>ldap_ca_cert_dir</option></entry>
22526 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
22527 </row>
22528 <row>
22529 <entry><option>ldap_ca_cert_file</option></entry>
22530 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
22531 </row>
22532 <row>
22533 <entry><option>ldap_cert_file</option></entry>
22534 <entry>client cert file for LDAP</entry>
22535 </row>
22536 <row>
22537 <entry><option>ldap_cert_key</option></entry>
22538 <entry>client key file for LDAP</entry>
22539 </row>
22540 <row>
22541 <entry><option>ldap_cipher_suite</option></entry>
22542 <entry>TLS negotiation preference control</entry>
22543 </row>
22544 <row>
22545 <entry><option>ldap_default_servers</option></entry>
22546 <entry>used if no server in query</entry>
22547 </row>
22548 <row>
22549 <entry><option>ldap_require_cert</option></entry>
22550 <entry>action to take without LDAP server cert</entry>
22551 </row>
22552 <row>
22553 <entry><option>ldap_start_tls</option></entry>
22554 <entry>require TLS within LDAP</entry>
22555 </row>
22556 <row>
22557 <entry><option>ldap_version</option></entry>
22558 <entry>set protocol version</entry>
22559 </row>
22560 <row>
22561 <entry><option>lookup_open_max</option></entry>
22562 <entry>lookup files held open</entry>
22563 </row>
22564 <row>
22565 <entry><option>mysql_servers</option></entry>
22566 <entry>default MySQL servers</entry>
22567 </row>
22568 <row>
22569 <entry><option>oracle_servers</option></entry>
22570 <entry>Oracle servers</entry>
22571 </row>
22572 <row>
22573 <entry><option>pgsql_servers</option></entry>
22574 <entry>default PostgreSQL servers</entry>
22575 </row>
22576 <row>
22577 <entry><option>sqlite_lock_timeout</option></entry>
22578 <entry>as it says</entry>
22579 </row>
22580 </tbody>
22581 </tgroup>
22582 </informaltable>
22583 </section>
22584 <section id="SECID102">
22585 <title>Message ids</title>
22586 <informaltable frame="none">
22587 <tgroup cols="2" colsep="0" rowsep="0">
22588 <colspec colwidth="196pt" align="left"/>
22589 <colspec colwidth="254pt" align="left"/>
22590 <tbody>
22591 <row>
22592 <entry><option>message_id_header_domain</option></entry>
22593 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
22594 </row>
22595 <row>
22596 <entry><option>message_id_header_text</option></entry>
22597 <entry>ditto</entry>
22598 </row>
22599 </tbody>
22600 </tgroup>
22601 </informaltable>
22602 </section>
22603 <section id="SECID103">
22604 <title>Embedded Perl Startup</title>
22605 <informaltable frame="none">
22606 <tgroup cols="2" colsep="0" rowsep="0">
22607 <colspec colwidth="196pt" align="left"/>
22608 <colspec colwidth="254pt" align="left"/>
22609 <tbody>
22610 <row>
22611 <entry><option>perl_at_start</option></entry>
22612 <entry>always start the interpreter</entry>
22613 </row>
22614 <row>
22615 <entry><option>perl_startup</option></entry>
22616 <entry>code to obey when starting Perl</entry>
22617 </row>
22618 <row>
22619 <entry><option>perl_taintmode</option></entry>
22620 <entry>enable taint mode in Perl</entry>
22621 </row>
22622 </tbody>
22623 </tgroup>
22624 </informaltable>
22625 </section>
22626 <section id="SECID104">
22627 <title>Daemon</title>
22628 <informaltable frame="none">
22629 <tgroup cols="2" colsep="0" rowsep="0">
22630 <colspec colwidth="196pt" align="left"/>
22631 <colspec colwidth="254pt" align="left"/>
22632 <tbody>
22633 <row>
22634 <entry><option>daemon_smtp_ports</option></entry>
22635 <entry>default ports</entry>
22636 </row>
22637 <row>
22638 <entry><option>daemon_startup_retries</option></entry>
22639 <entry>number of times to retry</entry>
22640 </row>
22641 <row>
22642 <entry><option>daemon_startup_sleep</option></entry>
22643 <entry>time to sleep between tries</entry>
22644 </row>
22645 <row>
22646 <entry><option>extra_local_interfaces</option></entry>
22647 <entry>not necessarily listened on</entry>
22648 </row>
22649 <row>
22650 <entry><option>local_interfaces</option></entry>
22651 <entry>on which to listen, with optional ports</entry>
22652 </row>
22653 <row>
22654 <entry><option>notifier_socket</option></entry>
22655 <entry>override compiled-in value</entry>
22656 </row>
22657 <row>
22658 <entry><option>pid_file_path</option></entry>
22659 <entry>override compiled-in value</entry>
22660 </row>
22661 <row>
22662 <entry><option>queue_run_max</option></entry>
22663 <entry>maximum simultaneous queue runners</entry>
22664 </row>
22665 </tbody>
22666 </tgroup>
22667 </informaltable>
22668 </section>
22669 <section id="SECID105">
22670 <title>Resource control</title>
22671 <informaltable frame="none">
22672 <tgroup cols="2" colsep="0" rowsep="0">
22673 <colspec colwidth="196pt" align="left"/>
22674 <colspec colwidth="254pt" align="left"/>
22675 <tbody>
22676 <row>
22677 <entry><option>check_log_inodes</option></entry>
22678 <entry>before accepting a message</entry>
22679 </row>
22680 <row>
22681 <entry><option>check_log_space</option></entry>
22682 <entry>before accepting a message</entry>
22683 </row>
22684 <row>
22685 <entry><option>check_spool_inodes</option></entry>
22686 <entry>before accepting a message</entry>
22687 </row>
22688 <row>
22689 <entry><option>check_spool_space</option></entry>
22690 <entry>before accepting a message</entry>
22691 </row>
22692 <row>
22693 <entry><option>deliver_queue_load_max</option></entry>
22694 <entry>no queue deliveries if load high</entry>
22695 </row>
22696 <row>
22697 <entry><option>queue_only_load</option></entry>
22698 <entry>queue incoming if load high</entry>
22699 </row>
22700 <row>
22701 <entry><option>queue_only_load_latch</option></entry>
22702 <entry>don&#x2019;t re-evaluate load for each message</entry>
22703 </row>
22704 <row>
22705 <entry><option>queue_run_max</option></entry>
22706 <entry>maximum simultaneous queue runners</entry>
22707 </row>
22708 <row>
22709 <entry><option>remote_max_parallel</option></entry>
22710 <entry>parallel SMTP delivery per message</entry>
22711 </row>
22712 <row>
22713 <entry><option>smtp_accept_max</option></entry>
22714 <entry>simultaneous incoming connections</entry>
22715 </row>
22716 <row>
22717 <entry><option>smtp_accept_max_nonmail</option></entry>
22718 <entry>non-mail commands</entry>
22719 </row>
22720 <row>
22721 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22722 <entry>hosts to which the limit applies</entry>
22723 </row>
22724 <row>
22725 <entry><option>smtp_accept_max_per_connection</option></entry>
22726 <entry>messages per connection</entry>
22727 </row>
22728 <row>
22729 <entry><option>smtp_accept_max_per_host</option></entry>
22730 <entry>connections from one host</entry>
22731 </row>
22732 <row>
22733 <entry><option>smtp_accept_queue</option></entry>
22734 <entry>queue mail if more connections</entry>
22735 </row>
22736 <row>
22737 <entry><option>smtp_accept_queue_per_connection</option></entry>
22738 <entry>queue if more messages per connection</entry>
22739 </row>
22740 <row>
22741 <entry><option>smtp_accept_reserve</option></entry>
22742 <entry>only reserve hosts if more connections</entry>
22743 </row>
22744 <row>
22745 <entry><option>smtp_check_spool_space</option></entry>
22746 <entry>from SIZE on MAIL command</entry>
22747 </row>
22748 <row>
22749 <entry><option>smtp_connect_backlog</option></entry>
22750 <entry>passed to TCP/IP stack</entry>
22751 </row>
22752 <row>
22753 <entry><option>smtp_load_reserve</option></entry>
22754 <entry>SMTP from reserved hosts if load high</entry>
22755 </row>
22756 <row>
22757 <entry><option>smtp_reserve_hosts</option></entry>
22758 <entry>these are the reserve hosts</entry>
22759 </row>
22760 </tbody>
22761 </tgroup>
22762 </informaltable>
22763 </section>
22764 <section id="SECID106">
22765 <title>Policy controls</title>
22766 <informaltable frame="none">
22767 <tgroup cols="2" colsep="0" rowsep="0">
22768 <colspec colwidth="196pt" align="left"/>
22769 <colspec colwidth="254pt" align="left"/>
22770 <tbody>
22771 <row>
22772 <entry><option>acl_not_smtp</option></entry>
22773 <entry>ACL for non-SMTP messages</entry>
22774 </row>
22775 <row>
22776 <entry><option>acl_not_smtp_mime</option></entry>
22777 <entry>ACL for non-SMTP MIME parts</entry>
22778 </row>
22779 <row>
22780 <entry><option>acl_not_smtp_start</option></entry>
22781 <entry>ACL for start of non-SMTP message</entry>
22782 </row>
22783 <row>
22784 <entry><option>acl_smtp_auth</option></entry>
22785 <entry>ACL for AUTH</entry>
22786 </row>
22787 <row>
22788 <entry><option>acl_smtp_connect</option></entry>
22789 <entry>ACL for connection</entry>
22790 </row>
22791 <row>
22792 <entry><option>acl_smtp_data</option></entry>
22793 <entry>ACL for DATA</entry>
22794 </row>
22795 <row>
22796 <entry><option>acl_smtp_data_prdr</option></entry>
22797 <entry>ACL for DATA, per-recipient</entry>
22798 </row>
22799 <row>
22800 <entry><option>acl_smtp_dkim</option></entry>
22801 <entry>ACL for DKIM verification</entry>
22802 </row>
22803 <row>
22804 <entry><option>acl_smtp_etrn</option></entry>
22805 <entry>ACL for ETRN</entry>
22806 </row>
22807 <row>
22808 <entry><option>acl_smtp_expn</option></entry>
22809 <entry>ACL for EXPN</entry>
22810 </row>
22811 <row>
22812 <entry><option>acl_smtp_helo</option></entry>
22813 <entry>ACL for EHLO or HELO</entry>
22814 </row>
22815 <row>
22816 <entry><option>acl_smtp_mail</option></entry>
22817 <entry>ACL for MAIL</entry>
22818 </row>
22819 <row>
22820 <entry><option>acl_smtp_mailauth</option></entry>
22821 <entry>ACL for AUTH on MAIL command</entry>
22822 </row>
22823 <row>
22824 <entry><option>acl_smtp_mime</option></entry>
22825 <entry>ACL for MIME parts</entry>
22826 </row>
22827 <row>
22828 <entry><option>acl_smtp_notquit</option></entry>
22829 <entry>ACL for non-QUIT terminations</entry>
22830 </row>
22831 <row>
22832 <entry><option>acl_smtp_predata</option></entry>
22833 <entry>ACL for start of data</entry>
22834 </row>
22835 <row>
22836 <entry><option>acl_smtp_quit</option></entry>
22837 <entry>ACL for QUIT</entry>
22838 </row>
22839 <row>
22840 <entry><option>acl_smtp_rcpt</option></entry>
22841 <entry>ACL for RCPT</entry>
22842 </row>
22843 <row>
22844 <entry><option>acl_smtp_starttls</option></entry>
22845 <entry>ACL for STARTTLS</entry>
22846 </row>
22847 <row>
22848 <entry><option>acl_smtp_vrfy</option></entry>
22849 <entry>ACL for VRFY</entry>
22850 </row>
22851 <row>
22852 <entry><option>av_scanner</option></entry>
22853 <entry>specify virus scanner</entry>
22854 </row>
22855 <row>
22856 <entry><option>check_rfc2047_length</option></entry>
22857 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22858 </row>
22859 <row>
22860 <entry><option>dns_cname_loops</option></entry>
22861 <entry>follow CNAMEs returned by resolver</entry>
22862 </row>
22863 <row>
22864 <entry><option>dns_csa_search_limit</option></entry>
22865 <entry>control CSA parent search depth</entry>
22866 </row>
22867 <row>
22868 <entry><option>dns_csa_use_reverse</option></entry>
22869 <entry>en/disable CSA IP reverse search</entry>
22870 </row>
22871 <row>
22872 <entry><option>header_maxsize</option></entry>
22873 <entry>total size of message header</entry>
22874 </row>
22875 <row>
22876 <entry><option>header_line_maxsize</option></entry>
22877 <entry>individual header line limit</entry>
22878 </row>
22879 <row>
22880 <entry><option>helo_accept_junk_hosts</option></entry>
22881 <entry>allow syntactic junk from these hosts</entry>
22882 </row>
22883 <row>
22884 <entry><option>helo_allow_chars</option></entry>
22885 <entry>allow illegal chars in HELO names</entry>
22886 </row>
22887 <row>
22888 <entry><option>helo_lookup_domains</option></entry>
22889 <entry>lookup hostname for these HELO names</entry>
22890 </row>
22891 <row>
22892 <entry><option>helo_try_verify_hosts</option></entry>
22893 <entry>HELO soft-checked for these hosts</entry>
22894 </row>
22895 <row>
22896 <entry><option>helo_verify_hosts</option></entry>
22897 <entry>HELO hard-checked for these hosts</entry>
22898 </row>
22899 <row>
22900 <entry><option>host_lookup</option></entry>
22901 <entry>host name looked up for these hosts</entry>
22902 </row>
22903 <row>
22904 <entry><option>host_lookup_order</option></entry>
22905 <entry>order of DNS and local name lookups</entry>
22906 </row>
22907 <row>
22908 <entry><option>hosts_proxy</option></entry>
22909 <entry>use proxy protocol for these hosts</entry>
22910 </row>
22911 <row>
22912 <entry><option>host_reject_connection</option></entry>
22913 <entry>reject connection from these hosts</entry>
22914 </row>
22915 <row>
22916 <entry><option>hosts_treat_as_local</option></entry>
22917 <entry>useful in some cluster configurations</entry>
22918 </row>
22919 <row>
22920 <entry><option>local_scan_timeout</option></entry>
22921 <entry>timeout for <function>local_scan()</function></entry>
22922 </row>
22923 <row>
22924 <entry><option>message_size_limit</option></entry>
22925 <entry>for all messages</entry>
22926 </row>
22927 <row>
22928 <entry><option>percent_hack_domains</option></entry>
22929 <entry>recognize %-hack for these domains</entry>
22930 </row>
22931 <row>
22932 <entry><option>spamd_address</option></entry>
22933 <entry>set interface to SpamAssassin</entry>
22934 </row>
22935 <row>
22936 <entry><option>strict_acl_vars</option></entry>
22937 <entry>object to unset ACL variables</entry>
22938 </row>
22939 <row>
22940 <entry><option>spf_smtp_comment_template</option></entry>
22941 <entry>template for <varname>$spf_smtp_comment</varname></entry>
22942 </row>
22943 </tbody>
22944 </tgroup>
22945 </informaltable>
22946 </section>
22947 <section id="SECID107">
22948 <title>Callout cache</title>
22949 <informaltable frame="none">
22950 <tgroup cols="2" colsep="0" rowsep="0">
22951 <colspec colwidth="196pt" align="left"/>
22952 <colspec colwidth="254pt" align="left"/>
22953 <tbody>
22954 <row>
22955 <entry><option>callout_domain_negative_expire</option></entry>
22956 <entry>timeout for negative domain cache item</entry>
22957 </row>
22958 <row>
22959 <entry><option>callout_domain_positive_expire</option></entry>
22960 <entry>timeout for positive domain cache item</entry>
22961 </row>
22962 <row>
22963 <entry><option>callout_negative_expire</option></entry>
22964 <entry>timeout for negative address cache item</entry>
22965 </row>
22966 <row>
22967 <entry><option>callout_positive_expire</option></entry>
22968 <entry>timeout for positive address cache item</entry>
22969 </row>
22970 <row>
22971 <entry><option>callout_random_local_part</option></entry>
22972 <entry>string to use for <quote>random</quote> testing</entry>
22973 </row>
22974 </tbody>
22975 </tgroup>
22976 </informaltable>
22977 </section>
22978 <section id="SECID108">
22979 <title>TLS</title>
22980 <informaltable frame="none">
22981 <tgroup cols="2" colsep="0" rowsep="0">
22982 <colspec colwidth="196pt" align="left"/>
22983 <colspec colwidth="254pt" align="left"/>
22984 <tbody>
22985 <row>
22986 <entry><option>gnutls_compat_mode</option></entry>
22987 <entry>use GnuTLS compatibility mode</entry>
22988 </row>
22989 <row>
22990 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
22991 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
22992 </row>
22993 <row>
22994 <entry><option>openssl_options</option></entry>
22995 <entry>adjust OpenSSL compatibility options</entry>
22996 </row>
22997 <row>
22998 <entry><option>tls_advertise_hosts</option></entry>
22999 <entry>advertise TLS to these hosts</entry>
23000 </row>
23001 <row>
23002 <entry><option>tls_certificate</option></entry>
23003 <entry>location of server certificate</entry>
23004 </row>
23005 <row>
23006 <entry><option>tls_crl</option></entry>
23007 <entry>certificate revocation list</entry>
23008 </row>
23009 <row>
23010 <entry><option>tls_dh_max_bits</option></entry>
23011 <entry>clamp D-H bit count suggestion</entry>
23012 </row>
23013 <row>
23014 <entry><option>tls_dhparam</option></entry>
23015 <entry>DH parameters for server</entry>
23016 </row>
23017 <row>
23018 <entry><option>tls_eccurve</option></entry>
23019 <entry>EC curve selection for server</entry>
23020 </row>
23021 <row>
23022 <entry><option>tls_ocsp_file</option></entry>
23023 <entry>location of server certificate status proof</entry>
23024 </row>
23025 <row>
23026 <entry><option>tls_on_connect_ports</option></entry>
23027 <entry>specify SSMTP (SMTPS) ports</entry>
23028 </row>
23029 <row>
23030 <entry><option>tls_privatekey</option></entry>
23031 <entry>location of server private key</entry>
23032 </row>
23033 <row>
23034 <entry><option>tls_remember_esmtp</option></entry>
23035 <entry>don&#x2019;t reset after starting TLS</entry>
23036 </row>
23037 <row>
23038 <entry><option>tls_require_ciphers</option></entry>
23039 <entry>specify acceptable ciphers</entry>
23040 </row>
23041 <row>
23042 <entry><option>tls_try_verify_hosts</option></entry>
23043 <entry>try to verify client certificate</entry>
23044 </row>
23045 <row>
23046 <entry><option>tls_verify_certificates</option></entry>
23047 <entry>expected client certificates</entry>
23048 </row>
23049 <row>
23050 <entry><option>tls_verify_hosts</option></entry>
23051 <entry>insist on client certificate verify</entry>
23052 </row>
23053 </tbody>
23054 </tgroup>
23055 </informaltable>
23056 </section>
23057 <section id="SECID109">
23058 <title>Local user handling</title>
23059 <informaltable frame="none">
23060 <tgroup cols="2" colsep="0" rowsep="0">
23061 <colspec colwidth="196pt" align="left"/>
23062 <colspec colwidth="254pt" align="left"/>
23063 <tbody>
23064 <row>
23065 <entry><option>finduser_retries</option></entry>
23066 <entry>useful in NIS environments</entry>
23067 </row>
23068 <row>
23069 <entry><option>gecos_name</option></entry>
23070 <entry>used when creating <emphasis>Sender:</emphasis></entry>
23071 </row>
23072 <row>
23073 <entry><option>gecos_pattern</option></entry>
23074 <entry>ditto</entry>
23075 </row>
23076 <row>
23077 <entry><option>max_username_length</option></entry>
23078 <entry>for systems that truncate</entry>
23079 </row>
23080 <row>
23081 <entry><option>unknown_login</option></entry>
23082 <entry>used when no login name found</entry>
23083 </row>
23084 <row>
23085 <entry><option>unknown_username</option></entry>
23086 <entry>ditto</entry>
23087 </row>
23088 <row>
23089 <entry><option>uucp_from_pattern</option></entry>
23090 <entry>for recognizing <quote>From </quote> lines</entry>
23091 </row>
23092 <row>
23093 <entry><option>uucp_from_sender</option></entry>
23094 <entry>ditto</entry>
23095 </row>
23096 </tbody>
23097 </tgroup>
23098 </informaltable>
23099 </section>
23100 <section id="SECID110">
23101 <title>All incoming messages (SMTP and non-SMTP)</title>
23102 <informaltable frame="none">
23103 <tgroup cols="2" colsep="0" rowsep="0">
23104 <colspec colwidth="196pt" align="left"/>
23105 <colspec colwidth="254pt" align="left"/>
23106 <tbody>
23107 <row>
23108 <entry><option>header_maxsize</option></entry>
23109 <entry>total size of message header</entry>
23110 </row>
23111 <row>
23112 <entry><option>header_line_maxsize</option></entry>
23113 <entry>individual header line limit</entry>
23114 </row>
23115 <row>
23116 <entry><option>message_size_limit</option></entry>
23117 <entry>applies to all messages</entry>
23118 </row>
23119 <row>
23120 <entry><option>percent_hack_domains</option></entry>
23121 <entry>recognize %-hack for these domains</entry>
23122 </row>
23123 <row>
23124 <entry><option>received_header_text</option></entry>
23125 <entry>expanded to make <emphasis>Received:</emphasis></entry>
23126 </row>
23127 <row>
23128 <entry><option>received_headers_max</option></entry>
23129 <entry>for mail loop detection</entry>
23130 </row>
23131 <row>
23132 <entry><option>recipients_max</option></entry>
23133 <entry>limit per message</entry>
23134 </row>
23135 <row>
23136 <entry><option>recipients_max_reject</option></entry>
23137 <entry>permanently reject excess recipients</entry>
23138 </row>
23139 </tbody>
23140 </tgroup>
23141 </informaltable>
23142 </section>
23143 <section id="SECID111">
23144 <title>Non-SMTP incoming messages</title>
23145 <informaltable frame="none">
23146 <tgroup cols="2" colsep="0" rowsep="0">
23147 <colspec colwidth="196pt" align="left"/>
23148 <colspec colwidth="254pt" align="left"/>
23149 <tbody>
23150 <row>
23151 <entry><option>receive_timeout</option></entry>
23152 <entry>for non-SMTP messages</entry>
23153 </row>
23154 </tbody>
23155 </tgroup>
23156 </informaltable>
23157 </section>
23158 <section id="SECID112">
23159 <title>Incoming SMTP messages</title>
23160 <para>
23161 See also the <emphasis>Policy controls</emphasis> section above.
23162 </para>
23163 <informaltable frame="none">
23164 <tgroup cols="2" colsep="0" rowsep="0">
23165 <colspec colwidth="196pt" align="left"/>
23166 <colspec colwidth="254pt" align="left"/>
23167 <tbody>
23168 <row>
23169 <entry><option>dkim_verify_hashes</option></entry>
23170 <entry>DKIM hash methods accepted for signatures</entry>
23171 </row>
23172 <row>
23173 <entry><option>dkim_verify_keytypes</option></entry>
23174 <entry>DKIM key types accepted for signatures</entry>
23175 </row>
23176 <row>
23177 <entry><option>dkim_verify_min_keysizes</option></entry>
23178 <entry>DKIM key sizes accepted for signatures</entry>
23179 </row>
23180 <row>
23181 <entry><option>dkim_verify_signers</option></entry>
23182 <entry>DKIM domains for which DKIM ACL is run</entry>
23183 </row>
23184 <row>
23185 <entry><option>dmarc_forensic_sender</option></entry>
23186 <entry>DMARC sender for report messages</entry>
23187 </row>
23188 <row>
23189 <entry><option>dmarc_history_file</option></entry>
23190 <entry>DMARC results log</entry>
23191 </row>
23192 <row>
23193 <entry><option>dmarc_tld_file</option></entry>
23194 <entry>DMARC toplevel domains file</entry>
23195 </row>
23196 <row>
23197 <entry><option>host_lookup</option></entry>
23198 <entry>host name looked up for these hosts</entry>
23199 </row>
23200 <row>
23201 <entry><option>host_lookup_order</option></entry>
23202 <entry>order of DNS and local name lookups</entry>
23203 </row>
23204 <row>
23205 <entry><option>recipient_unqualified_hosts</option></entry>
23206 <entry>may send unqualified recipients</entry>
23207 </row>
23208 <row>
23209 <entry><option>rfc1413_hosts</option></entry>
23210 <entry>make ident calls to these hosts</entry>
23211 </row>
23212 <row>
23213 <entry><option>rfc1413_query_timeout</option></entry>
23214 <entry>zero disables ident calls</entry>
23215 </row>
23216 <row>
23217 <entry><option>sender_unqualified_hosts</option></entry>
23218 <entry>may send unqualified senders</entry>
23219 </row>
23220 <row>
23221 <entry><option>smtp_accept_keepalive</option></entry>
23222 <entry>some TCP/IP magic</entry>
23223 </row>
23224 <row>
23225 <entry><option>smtp_accept_max</option></entry>
23226 <entry>simultaneous incoming connections</entry>
23227 </row>
23228 <row>
23229 <entry><option>smtp_accept_max_nonmail</option></entry>
23230 <entry>non-mail commands</entry>
23231 </row>
23232 <row>
23233 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
23234 <entry>hosts to which the limit applies</entry>
23235 </row>
23236 <row>
23237 <entry><option>smtp_accept_max_per_connection</option></entry>
23238 <entry>messages per connection</entry>
23239 </row>
23240 <row>
23241 <entry><option>smtp_accept_max_per_host</option></entry>
23242 <entry>connections from one host</entry>
23243 </row>
23244 <row>
23245 <entry><option>smtp_accept_queue</option></entry>
23246 <entry>queue mail if more connections</entry>
23247 </row>
23248 <row>
23249 <entry><option>smtp_accept_queue_per_connection</option></entry>
23250 <entry>queue if more messages per connection</entry>
23251 </row>
23252 <row>
23253 <entry><option>smtp_accept_reserve</option></entry>
23254 <entry>only reserve hosts if more connections</entry>
23255 </row>
23256 <row>
23257 <entry><option>smtp_active_hostname</option></entry>
23258 <entry>host name to use in messages</entry>
23259 </row>
23260 <row>
23261 <entry><option>smtp_banner</option></entry>
23262 <entry>text for welcome banner</entry>
23263 </row>
23264 <row>
23265 <entry><option>smtp_check_spool_space</option></entry>
23266 <entry>from SIZE on MAIL command</entry>
23267 </row>
23268 <row>
23269 <entry><option>smtp_connect_backlog</option></entry>
23270 <entry>passed to TCP/IP stack</entry>
23271 </row>
23272 <row>
23273 <entry><option>smtp_enforce_sync</option></entry>
23274 <entry>of SMTP command/responses</entry>
23275 </row>
23276 <row>
23277 <entry><option>smtp_etrn_command</option></entry>
23278 <entry>what to run for ETRN</entry>
23279 </row>
23280 <row>
23281 <entry><option>smtp_etrn_serialize</option></entry>
23282 <entry>only one at once</entry>
23283 </row>
23284 <row>
23285 <entry><option>smtp_load_reserve</option></entry>
23286 <entry>only reserve hosts if this load</entry>
23287 </row>
23288 <row>
23289 <entry><option>smtp_max_unknown_commands</option></entry>
23290 <entry>before dropping connection</entry>
23291 </row>
23292 <row>
23293 <entry><option>smtp_ratelimit_hosts</option></entry>
23294 <entry>apply ratelimiting to these hosts</entry>
23295 </row>
23296 <row>
23297 <entry><option>smtp_ratelimit_mail</option></entry>
23298 <entry>ratelimit for MAIL commands</entry>
23299 </row>
23300 <row>
23301 <entry><option>smtp_ratelimit_rcpt</option></entry>
23302 <entry>ratelimit for RCPT commands</entry>
23303 </row>
23304 <row>
23305 <entry><option>smtp_receive_timeout</option></entry>
23306 <entry>per command or data line</entry>
23307 </row>
23308 <row>
23309 <entry><option>smtp_reserve_hosts</option></entry>
23310 <entry>these are the reserve hosts</entry>
23311 </row>
23312 <row>
23313 <entry><option>smtp_return_error_details</option></entry>
23314 <entry>give detail on rejections</entry>
23315 </row>
23316 </tbody>
23317 </tgroup>
23318 </informaltable>
23319 </section>
23320 <section id="SECID113">
23321 <title>SMTP extensions</title>
23322 <informaltable frame="none">
23323 <tgroup cols="2" colsep="0" rowsep="0">
23324 <colspec colwidth="196pt" align="left"/>
23325 <colspec colwidth="254pt" align="left"/>
23326 <tbody>
23327 <row>
23328 <entry><option>accept_8bitmime</option></entry>
23329 <entry>advertise 8BITMIME</entry>
23330 </row>
23331 <row>
23332 <entry><option>auth_advertise_hosts</option></entry>
23333 <entry>advertise AUTH to these hosts</entry>
23334 </row>
23335 <row>
23336 <entry><option>chunking_advertise_hosts</option></entry>
23337 <entry>advertise CHUNKING to these hosts</entry>
23338 </row>
23339 <row>
23340 <entry><option>dsn_advertise_hosts</option></entry>
23341 <entry>advertise DSN extensions to these hosts</entry>
23342 </row>
23343 <row>
23344 <entry><option>ignore_fromline_hosts</option></entry>
23345 <entry>allow <quote>From </quote> from these hosts</entry>
23346 </row>
23347 <row>
23348 <entry><option>ignore_fromline_local</option></entry>
23349 <entry>allow <quote>From </quote> from local SMTP</entry>
23350 </row>
23351 <row>
23352 <entry><option>pipelining_advertise_hosts</option></entry>
23353 <entry>advertise pipelining to these hosts</entry>
23354 </row>
23355 <row>
23356 <entry><option>pipelining_connect_advertise_hosts</option></entry>
23357 <entry>advertise pipelining to these hosts</entry>
23358 </row>
23359 <row>
23360 <entry><option>prdr_enable</option></entry>
23361 <entry>advertise PRDR to all hosts</entry>
23362 </row>
23363 <row>
23364 <entry><option>smtputf8_advertise_hosts</option></entry>
23365 <entry>advertise SMTPUTF8 to these hosts</entry>
23366 </row>
23367 <row>
23368 <entry><option>tls_advertise_hosts</option></entry>
23369 <entry>advertise TLS to these hosts</entry>
23370 </row>
23371 </tbody>
23372 </tgroup>
23373 </informaltable>
23374 </section>
23375 <section id="SECID114">
23376 <title>Processing messages</title>
23377 <informaltable frame="none">
23378 <tgroup cols="2" colsep="0" rowsep="0">
23379 <colspec colwidth="196pt" align="left"/>
23380 <colspec colwidth="254pt" align="left"/>
23381 <tbody>
23382 <row>
23383 <entry><option>allow_domain_literals</option></entry>
23384 <entry>recognize domain literal syntax</entry>
23385 </row>
23386 <row>
23387 <entry><option>allow_mx_to_ip</option></entry>
23388 <entry>allow MX to point to IP address</entry>
23389 </row>
23390 <row>
23391 <entry><option>allow_utf8_domains</option></entry>
23392 <entry>in addresses</entry>
23393 </row>
23394 <row>
23395 <entry><option>check_rfc2047_length</option></entry>
23396 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
23397 </row>
23398 <row>
23399 <entry><option>delivery_date_remove</option></entry>
23400 <entry>from incoming messages</entry>
23401 </row>
23402 <row>
23403 <entry><option>envelope_to_remove</option></entry>
23404 <entry>from incoming messages</entry>
23405 </row>
23406 <row>
23407 <entry><option>extract_addresses_remove_arguments</option></entry>
23408 <entry>affects <option>-t</option> processing</entry>
23409 </row>
23410 <row>
23411 <entry><option>headers_charset</option></entry>
23412 <entry>default for translations</entry>
23413 </row>
23414 <row>
23415 <entry><option>qualify_domain</option></entry>
23416 <entry>default for senders</entry>
23417 </row>
23418 <row>
23419 <entry><option>qualify_recipient</option></entry>
23420 <entry>default for recipients</entry>
23421 </row>
23422 <row>
23423 <entry><option>return_path_remove</option></entry>
23424 <entry>from incoming messages</entry>
23425 </row>
23426 <row>
23427 <entry><option>strip_excess_angle_brackets</option></entry>
23428 <entry>in addresses</entry>
23429 </row>
23430 <row>
23431 <entry><option>strip_trailing_dot</option></entry>
23432 <entry>at end of addresses</entry>
23433 </row>
23434 <row>
23435 <entry><option>untrusted_set_sender</option></entry>
23436 <entry>untrusted can set envelope sender</entry>
23437 </row>
23438 </tbody>
23439 </tgroup>
23440 </informaltable>
23441 </section>
23442 <section id="SECID115">
23443 <title>System filter</title>
23444 <informaltable frame="none">
23445 <tgroup cols="2" colsep="0" rowsep="0">
23446 <colspec colwidth="196pt" align="left"/>
23447 <colspec colwidth="254pt" align="left"/>
23448 <tbody>
23449 <row>
23450 <entry><option>system_filter</option></entry>
23451 <entry>locate system filter</entry>
23452 </row>
23453 <row>
23454 <entry><option>system_filter_directory_transport</option></entry>
23455 <entry>transport for delivery to a directory</entry>
23456 </row>
23457 <row>
23458 <entry><option>system_filter_file_transport</option></entry>
23459 <entry>transport for delivery to a file</entry>
23460 </row>
23461 <row>
23462 <entry><option>system_filter_group</option></entry>
23463 <entry>group for filter running</entry>
23464 </row>
23465 <row>
23466 <entry><option>system_filter_pipe_transport</option></entry>
23467 <entry>transport for delivery to a pipe</entry>
23468 </row>
23469 <row>
23470 <entry><option>system_filter_reply_transport</option></entry>
23471 <entry>transport for autoreply delivery</entry>
23472 </row>
23473 <row>
23474 <entry><option>system_filter_user</option></entry>
23475 <entry>user for filter running</entry>
23476 </row>
23477 </tbody>
23478 </tgroup>
23479 </informaltable>
23480 </section>
23481 <section id="SECID116">
23482 <title>Routing and delivery</title>
23483 <informaltable frame="none">
23484 <tgroup cols="2" colsep="0" rowsep="0">
23485 <colspec colwidth="196pt" align="left"/>
23486 <colspec colwidth="254pt" align="left"/>
23487 <tbody>
23488 <row>
23489 <entry><option>disable_ipv6</option></entry>
23490 <entry>do no IPv6 processing</entry>
23491 </row>
23492 <row>
23493 <entry><option>dns_again_means_nonexist</option></entry>
23494 <entry>for broken domains</entry>
23495 </row>
23496 <row>
23497 <entry><option>dns_check_names_pattern</option></entry>
23498 <entry>pre-DNS syntax check</entry>
23499 </row>
23500 <row>
23501 <entry><option>dns_dnssec_ok</option></entry>
23502 <entry>parameter for resolver</entry>
23503 </row>
23504 <row>
23505 <entry><option>dns_ipv4_lookup</option></entry>
23506 <entry>only v4 lookup for these domains</entry>
23507 </row>
23508 <row>
23509 <entry><option>dns_retrans</option></entry>
23510 <entry>parameter for resolver</entry>
23511 </row>
23512 <row>
23513 <entry><option>dns_retry</option></entry>
23514 <entry>parameter for resolver</entry>
23515 </row>
23516 <row>
23517 <entry><option>dns_trust_aa</option></entry>
23518 <entry>DNS zones trusted as authentic</entry>
23519 </row>
23520 <row>
23521 <entry><option>dns_use_edns0</option></entry>
23522 <entry>parameter for resolver</entry>
23523 </row>
23524 <row>
23525 <entry><option>hold_domains</option></entry>
23526 <entry>hold delivery for these domains</entry>
23527 </row>
23528 <row>
23529 <entry><option>local_interfaces</option></entry>
23530 <entry>for routing checks</entry>
23531 </row>
23532 <row>
23533 <entry><option>queue_domains</option></entry>
23534 <entry>no immediate delivery for these</entry>
23535 </row>
23536 <row>
23537 <entry><option>queue_only</option></entry>
23538 <entry>no immediate delivery at all</entry>
23539 </row>
23540 <row>
23541 <entry><option>queue_only_file</option></entry>
23542 <entry>no immediate delivery if file exists</entry>
23543 </row>
23544 <row>
23545 <entry><option>queue_only_load</option></entry>
23546 <entry>no immediate delivery if load is high</entry>
23547 </row>
23548 <row>
23549 <entry><option>queue_only_load_latch</option></entry>
23550 <entry>don&#x2019;t re-evaluate load for each message</entry>
23551 </row>
23552 <row>
23553 <entry><option>queue_only_override</option></entry>
23554 <entry>allow command line to override</entry>
23555 </row>
23556 <row>
23557 <entry><option>queue_run_in_order</option></entry>
23558 <entry>order of arrival</entry>
23559 </row>
23560 <row>
23561 <entry><option>queue_run_max</option></entry>
23562 <entry>of simultaneous queue runners</entry>
23563 </row>
23564 <row>
23565 <entry><option>queue_smtp_domains</option></entry>
23566 <entry>no immediate SMTP delivery for these</entry>
23567 </row>
23568 <row>
23569 <entry><option>remote_max_parallel</option></entry>
23570 <entry>parallel SMTP delivery per message</entry>
23571 </row>
23572 <row>
23573 <entry><option>remote_sort_domains</option></entry>
23574 <entry>order of remote deliveries</entry>
23575 </row>
23576 <row>
23577 <entry><option>retry_data_expire</option></entry>
23578 <entry>timeout for retry data</entry>
23579 </row>
23580 <row>
23581 <entry><option>retry_interval_max</option></entry>
23582 <entry>safety net for retry rules</entry>
23583 </row>
23584 </tbody>
23585 </tgroup>
23586 </informaltable>
23587 </section>
23588 <section id="SECID117">
23589 <title>Bounce and warning messages</title>
23590 <informaltable frame="none">
23591 <tgroup cols="2" colsep="0" rowsep="0">
23592 <colspec colwidth="196pt" align="left"/>
23593 <colspec colwidth="254pt" align="left"/>
23594 <tbody>
23595 <row>
23596 <entry><option>bounce_message_file</option></entry>
23597 <entry>content of bounce</entry>
23598 </row>
23599 <row>
23600 <entry><option>bounce_message_text</option></entry>
23601 <entry>content of bounce</entry>
23602 </row>
23603 <row>
23604 <entry><option>bounce_return_body</option></entry>
23605 <entry>include body if returning message</entry>
23606 </row>
23607 <row>
23608 <entry><option>bounce_return_linesize_limit</option></entry>
23609 <entry>limit on returned message line length</entry>
23610 </row>
23611 <row>
23612 <entry><option>bounce_return_message</option></entry>
23613 <entry>include original message in bounce</entry>
23614 </row>
23615 <row>
23616 <entry><option>bounce_return_size_limit</option></entry>
23617 <entry>limit on returned message</entry>
23618 </row>
23619 <row>
23620 <entry><option>bounce_sender_authentication</option></entry>
23621 <entry>send authenticated sender with bounce</entry>
23622 </row>
23623 <row>
23624 <entry><option>dsn_from</option></entry>
23625 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
23626 </row>
23627 <row>
23628 <entry><option>errors_copy</option></entry>
23629 <entry>copy bounce messages</entry>
23630 </row>
23631 <row>
23632 <entry><option>errors_reply_to</option></entry>
23633 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
23634 </row>
23635 <row>
23636 <entry><option>delay_warning</option></entry>
23637 <entry>time schedule</entry>
23638 </row>
23639 <row>
23640 <entry><option>delay_warning_condition</option></entry>
23641 <entry>condition for warning messages</entry>
23642 </row>
23643 <row>
23644 <entry><option>ignore_bounce_errors_after</option></entry>
23645 <entry>discard undeliverable bounces</entry>
23646 </row>
23647 <row>
23648 <entry><option>smtp_return_error_details</option></entry>
23649 <entry>give detail on rejections</entry>
23650 </row>
23651 <row>
23652 <entry><option>warn_message_file</option></entry>
23653 <entry>content of warning message</entry>
23654 </row>
23655 </tbody>
23656 </tgroup>
23657 </informaltable>
23658 </section>
23659 <section id="SECTalomo">
23660 <title>Alphabetical list of main options</title>
23661 <para>
23662 Those options that undergo string expansion before use are marked with
23663 &dagger;.
23664 </para>
23665 <para>
23666 <indexterm role="option">
23667 <primary><option>accept_8bitmime</option></primary>
23668 </indexterm>
23669 </para>
23670 <informaltable frame="all">
23671 <tgroup cols="4" colsep="0" rowsep="0">
23672 <colspec colwidth="8*" align="left"/>
23673 <colspec colwidth="6*" align="center"/>
23674 <colspec colwidth="6*" align="center"/>
23675 <colspec colwidth="6*" align="right"/>
23676 <tbody>
23677 <row>
23678 <entry><option>accept_8bitmime</option></entry>
23679 <entry>Use: <emphasis>main</emphasis></entry>
23680 <entry>Type: <emphasis>boolean</emphasis></entry>
23681 <entry>Default: <emphasis>true</emphasis></entry>
23682 </row>
23683 </tbody>
23684 </tgroup>
23685 </informaltable>
23686 <para>
23687 <indexterm role="concept">
23688 <primary>8BITMIME</primary>
23689 </indexterm>
23690 <indexterm role="concept">
23691 <primary>8-bit characters</primary>
23692 </indexterm>
23693 <indexterm role="concept">
23694 <primary>log</primary>
23695 <secondary>selectors</secondary>
23696 </indexterm>
23697 <indexterm role="concept">
23698 <primary>log</primary>
23699 <secondary>8BITMIME</secondary>
23700 </indexterm>
23701 <indexterm role="concept">
23702 <primary>ESMTP extensions</primary>
23703 <secondary>8BITMIME</secondary>
23704 </indexterm>
23705 This option causes Exim to send 8BITMIME in its response to an SMTP
23706 EHLO command, and to accept the BODY= parameter on MAIL commands.
23707 However, though Exim is 8-bit clean, it is not a protocol converter, and it
23708 takes no steps to do anything special with messages received by this route.
23709 </para>
23710 <para>
23711 Historically Exim kept this option off by default, but the maintainers
23712 feel that in today&#x2019;s Internet, this causes more problems than it solves.
23713 It now defaults to true.
23714 A more detailed analysis of the issues is provided by Dan Bernstein:
23715 </para>
23716 <literallayout>
23717 <emphasis role="bold"><ulink url="https://cr.yp.to/smtp/8bitmime.html">https://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
23718 </literallayout>
23719 <para>
23720 To log received 8BITMIME status use
23721 </para>
23722 <literallayout class="monospaced">
23723 log_selector = +8bitmime
23724 </literallayout>
23725 <para>
23726 <indexterm role="option">
23727 <primary><option>acl_not_smtp</option></primary>
23728 </indexterm>
23729 </para>
23730 <informaltable frame="all">
23731 <tgroup cols="4" colsep="0" rowsep="0">
23732 <colspec colwidth="8*" align="left"/>
23733 <colspec colwidth="6*" align="center"/>
23734 <colspec colwidth="6*" align="center"/>
23735 <colspec colwidth="6*" align="right"/>
23736 <tbody>
23737 <row>
23738 <entry><option>acl_not_smtp</option></entry>
23739 <entry>Use: <emphasis>main</emphasis></entry>
23740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23741 <entry>Default: <emphasis>unset</emphasis></entry>
23742 </row>
23743 </tbody>
23744 </tgroup>
23745 </informaltable>
23746 <para>
23747 <indexterm role="concept">
23748 <primary>access control lists (ACLs)</primary>
23749 <secondary>for non-SMTP messages</secondary>
23750 </indexterm>
23751 <indexterm role="concept">
23752 <primary>non-SMTP messages</primary>
23753 <secondary>ACLs for</secondary>
23754 </indexterm>
23755 This option defines the ACL that is run when a non-SMTP message has been
23756 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
23757 further details.
23758 </para>
23759 <para>
23760 <indexterm role="option">
23761 <primary><option>acl_not_smtp_mime</option></primary>
23762 </indexterm>
23763 </para>
23764 <informaltable frame="all">
23765 <tgroup cols="4" colsep="0" rowsep="0">
23766 <colspec colwidth="8*" align="left"/>
23767 <colspec colwidth="6*" align="center"/>
23768 <colspec colwidth="6*" align="center"/>
23769 <colspec colwidth="6*" align="right"/>
23770 <tbody>
23771 <row>
23772 <entry><option>acl_not_smtp_mime</option></entry>
23773 <entry>Use: <emphasis>main</emphasis></entry>
23774 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23775 <entry>Default: <emphasis>unset</emphasis></entry>
23776 </row>
23777 </tbody>
23778 </tgroup>
23779 </informaltable>
23780 <para>
23781 This option defines the ACL that is run for individual MIME parts of non-SMTP
23782 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
23783 SMTP messages.
23784 </para>
23785 <para>
23786 <indexterm role="option">
23787 <primary><option>acl_not_smtp_start</option></primary>
23788 </indexterm>
23789 </para>
23790 <informaltable frame="all">
23791 <tgroup cols="4" colsep="0" rowsep="0">
23792 <colspec colwidth="8*" align="left"/>
23793 <colspec colwidth="6*" align="center"/>
23794 <colspec colwidth="6*" align="center"/>
23795 <colspec colwidth="6*" align="right"/>
23796 <tbody>
23797 <row>
23798 <entry><option>acl_not_smtp_start</option></entry>
23799 <entry>Use: <emphasis>main</emphasis></entry>
23800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23801 <entry>Default: <emphasis>unset</emphasis></entry>
23802 </row>
23803 </tbody>
23804 </tgroup>
23805 </informaltable>
23806 <para>
23807 <indexterm role="concept">
23808 <primary>access control lists (ACLs)</primary>
23809 <secondary>at start of non-SMTP message</secondary>
23810 </indexterm>
23811 <indexterm role="concept">
23812 <primary>non-SMTP messages</primary>
23813 <secondary>ACLs for</secondary>
23814 </indexterm>
23815 This option defines the ACL that is run before Exim starts reading a
23816 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
23817 </para>
23818 <para>
23819 <indexterm role="option">
23820 <primary><option>acl_smtp_auth</option></primary>
23821 </indexterm>
23822 </para>
23823 <informaltable frame="all">
23824 <tgroup cols="4" colsep="0" rowsep="0">
23825 <colspec colwidth="8*" align="left"/>
23826 <colspec colwidth="6*" align="center"/>
23827 <colspec colwidth="6*" align="center"/>
23828 <colspec colwidth="6*" align="right"/>
23829 <tbody>
23830 <row>
23831 <entry><option>acl_smtp_auth</option></entry>
23832 <entry>Use: <emphasis>main</emphasis></entry>
23833 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23834 <entry>Default: <emphasis>unset</emphasis></entry>
23835 </row>
23836 </tbody>
23837 </tgroup>
23838 </informaltable>
23839 <para>
23840 <indexterm role="concept">
23841 <primary>access control lists (ACLs)</primary>
23842 <secondary>setting up for SMTP commands</secondary>
23843 </indexterm>
23844 <indexterm role="concept">
23845 <primary>AUTH</primary>
23846 <secondary>ACL for</secondary>
23847 </indexterm>
23848 This option defines the ACL that is run when an SMTP AUTH command is
23849 received. See chapter <xref linkend="CHAPACL"/> for further details.
23850 </para>
23851 <para>
23852 <indexterm role="option">
23853 <primary><option>acl_smtp_connect</option></primary>
23854 </indexterm>
23855 </para>
23856 <informaltable frame="all">
23857 <tgroup cols="4" colsep="0" rowsep="0">
23858 <colspec colwidth="8*" align="left"/>
23859 <colspec colwidth="6*" align="center"/>
23860 <colspec colwidth="6*" align="center"/>
23861 <colspec colwidth="6*" align="right"/>
23862 <tbody>
23863 <row>
23864 <entry><option>acl_smtp_connect</option></entry>
23865 <entry>Use: <emphasis>main</emphasis></entry>
23866 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23867 <entry>Default: <emphasis>unset</emphasis></entry>
23868 </row>
23869 </tbody>
23870 </tgroup>
23871 </informaltable>
23872 <para>
23873 <indexterm role="concept">
23874 <primary>access control lists (ACLs)</primary>
23875 <secondary>on SMTP connection</secondary>
23876 </indexterm>
23877 This option defines the ACL that is run when an SMTP connection is received.
23878 See chapter <xref linkend="CHAPACL"/> for further details.
23879 </para>
23880 <para>
23881 <indexterm role="option">
23882 <primary><option>acl_smtp_data</option></primary>
23883 </indexterm>
23884 </para>
23885 <informaltable frame="all">
23886 <tgroup cols="4" colsep="0" rowsep="0">
23887 <colspec colwidth="8*" align="left"/>
23888 <colspec colwidth="6*" align="center"/>
23889 <colspec colwidth="6*" align="center"/>
23890 <colspec colwidth="6*" align="right"/>
23891 <tbody>
23892 <row>
23893 <entry><option>acl_smtp_data</option></entry>
23894 <entry>Use: <emphasis>main</emphasis></entry>
23895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23896 <entry>Default: <emphasis>unset</emphasis></entry>
23897 </row>
23898 </tbody>
23899 </tgroup>
23900 </informaltable>
23901 <para>
23902 <indexterm role="concept">
23903 <primary>DATA</primary>
23904 <secondary>ACL for</secondary>
23905 </indexterm>
23906 This option defines the ACL that is run after an SMTP DATA command has been
23907 processed and the message itself has been received, but before the final
23908 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23909 </para>
23910 <para>
23911 <indexterm role="option">
23912 <primary><option>acl_smtp_data_prdr</option></primary>
23913 </indexterm>
23914 </para>
23915 <informaltable frame="all">
23916 <tgroup cols="4" colsep="0" rowsep="0">
23917 <colspec colwidth="8*" align="left"/>
23918 <colspec colwidth="6*" align="center"/>
23919 <colspec colwidth="6*" align="center"/>
23920 <colspec colwidth="6*" align="right"/>
23921 <tbody>
23922 <row>
23923 <entry><option>acl_smtp_data_prdr</option></entry>
23924 <entry>Use: <emphasis>main</emphasis></entry>
23925 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23926 <entry>Default: <emphasis>accept</emphasis></entry>
23927 </row>
23928 </tbody>
23929 </tgroup>
23930 </informaltable>
23931 <para>
23932 <indexterm role="concept">
23933 <primary>PRDR</primary>
23934 <secondary>ACL for</secondary>
23935 </indexterm>
23936 <indexterm role="concept">
23937 <primary>DATA</primary>
23938 <secondary>PRDR ACL for</secondary>
23939 </indexterm>
23940 <indexterm role="concept">
23941 <primary>access control lists (ACLs)</primary>
23942 <secondary>PRDR-related</secondary>
23943 </indexterm>
23944 <indexterm role="concept">
23945 <primary>access control lists (ACLs)</primary>
23946 <secondary>per-user data processing</secondary>
23947 </indexterm>
23948 This option defines the ACL that,
23949 if the PRDR feature has been negotiated,
23950 is run for each recipient after an SMTP DATA command has been
23951 processed and the message itself has been received, but before the
23952 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23953 </para>
23954 <para>
23955 <indexterm role="option">
23956 <primary><option>acl_smtp_dkim</option></primary>
23957 </indexterm>
23958 </para>
23959 <informaltable frame="all">
23960 <tgroup cols="4" colsep="0" rowsep="0">
23961 <colspec colwidth="8*" align="left"/>
23962 <colspec colwidth="6*" align="center"/>
23963 <colspec colwidth="6*" align="center"/>
23964 <colspec colwidth="6*" align="right"/>
23965 <tbody>
23966 <row>
23967 <entry><option>acl_smtp_dkim</option></entry>
23968 <entry>Use: <emphasis>main</emphasis></entry>
23969 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23970 <entry>Default: <emphasis>unset</emphasis></entry>
23971 </row>
23972 </tbody>
23973 </tgroup>
23974 </informaltable>
23975 <para>
23976 <indexterm role="concept">
23977 <primary>DKIM</primary>
23978 <secondary>ACL for</secondary>
23979 </indexterm>
23980 This option defines the ACL that is run for each DKIM signature
23981 (by default, or as specified in the dkim_verify_signers option)
23982 of a received message.
23983 See section <xref linkend="SECDKIMVFY"/> for further details.
23984 </para>
23985 <para>
23986 <indexterm role="option">
23987 <primary><option>acl_smtp_etrn</option></primary>
23988 </indexterm>
23989 </para>
23990 <informaltable frame="all">
23991 <tgroup cols="4" colsep="0" rowsep="0">
23992 <colspec colwidth="8*" align="left"/>
23993 <colspec colwidth="6*" align="center"/>
23994 <colspec colwidth="6*" align="center"/>
23995 <colspec colwidth="6*" align="right"/>
23996 <tbody>
23997 <row>
23998 <entry><option>acl_smtp_etrn</option></entry>
23999 <entry>Use: <emphasis>main</emphasis></entry>
24000 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24001 <entry>Default: <emphasis>unset</emphasis></entry>
24002 </row>
24003 </tbody>
24004 </tgroup>
24005 </informaltable>
24006 <para>
24007 <indexterm role="concept">
24008 <primary>ETRN</primary>
24009 <secondary>ACL for</secondary>
24010 </indexterm>
24011 This option defines the ACL that is run when an SMTP ETRN command is
24012 received. See chapter <xref linkend="CHAPACL"/> for further details.
24013 </para>
24014 <para>
24015 <indexterm role="option">
24016 <primary><option>acl_smtp_expn</option></primary>
24017 </indexterm>
24018 </para>
24019 <informaltable frame="all">
24020 <tgroup cols="4" colsep="0" rowsep="0">
24021 <colspec colwidth="8*" align="left"/>
24022 <colspec colwidth="6*" align="center"/>
24023 <colspec colwidth="6*" align="center"/>
24024 <colspec colwidth="6*" align="right"/>
24025 <tbody>
24026 <row>
24027 <entry><option>acl_smtp_expn</option></entry>
24028 <entry>Use: <emphasis>main</emphasis></entry>
24029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24030 <entry>Default: <emphasis>unset</emphasis></entry>
24031 </row>
24032 </tbody>
24033 </tgroup>
24034 </informaltable>
24035 <para>
24036 <indexterm role="concept">
24037 <primary>EXPN</primary>
24038 <secondary>ACL for</secondary>
24039 </indexterm>
24040 This option defines the ACL that is run when an SMTP EXPN command is
24041 received. See chapter <xref linkend="CHAPACL"/> for further details.
24042 </para>
24043 <para>
24044 <indexterm role="option">
24045 <primary><option>acl_smtp_helo</option></primary>
24046 </indexterm>
24047 </para>
24048 <informaltable frame="all">
24049 <tgroup cols="4" colsep="0" rowsep="0">
24050 <colspec colwidth="8*" align="left"/>
24051 <colspec colwidth="6*" align="center"/>
24052 <colspec colwidth="6*" align="center"/>
24053 <colspec colwidth="6*" align="right"/>
24054 <tbody>
24055 <row>
24056 <entry><option>acl_smtp_helo</option></entry>
24057 <entry>Use: <emphasis>main</emphasis></entry>
24058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24059 <entry>Default: <emphasis>unset</emphasis></entry>
24060 </row>
24061 </tbody>
24062 </tgroup>
24063 </informaltable>
24064 <para>
24065 <indexterm role="concept">
24066 <primary>EHLO</primary>
24067 <secondary>ACL for</secondary>
24068 </indexterm>
24069 <indexterm role="concept">
24070 <primary>HELO</primary>
24071 <secondary>ACL for</secondary>
24072 </indexterm>
24073 This option defines the ACL that is run when an SMTP EHLO or HELO
24074 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
24075 </para>
24076 <para>
24077 <indexterm role="option">
24078 <primary><option>acl_smtp_mail</option></primary>
24079 </indexterm>
24080 </para>
24081 <informaltable frame="all">
24082 <tgroup cols="4" colsep="0" rowsep="0">
24083 <colspec colwidth="8*" align="left"/>
24084 <colspec colwidth="6*" align="center"/>
24085 <colspec colwidth="6*" align="center"/>
24086 <colspec colwidth="6*" align="right"/>
24087 <tbody>
24088 <row>
24089 <entry><option>acl_smtp_mail</option></entry>
24090 <entry>Use: <emphasis>main</emphasis></entry>
24091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24092 <entry>Default: <emphasis>unset</emphasis></entry>
24093 </row>
24094 </tbody>
24095 </tgroup>
24096 </informaltable>
24097 <para>
24098 <indexterm role="concept">
24099 <primary>MAIL</primary>
24100 <secondary>ACL for</secondary>
24101 </indexterm>
24102 This option defines the ACL that is run when an SMTP MAIL command is
24103 received. See chapter <xref linkend="CHAPACL"/> for further details.
24104 </para>
24105 <para>
24106 <indexterm role="option">
24107 <primary><option>acl_smtp_mailauth</option></primary>
24108 </indexterm>
24109 </para>
24110 <informaltable frame="all">
24111 <tgroup cols="4" colsep="0" rowsep="0">
24112 <colspec colwidth="8*" align="left"/>
24113 <colspec colwidth="6*" align="center"/>
24114 <colspec colwidth="6*" align="center"/>
24115 <colspec colwidth="6*" align="right"/>
24116 <tbody>
24117 <row>
24118 <entry><option>acl_smtp_mailauth</option></entry>
24119 <entry>Use: <emphasis>main</emphasis></entry>
24120 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24121 <entry>Default: <emphasis>unset</emphasis></entry>
24122 </row>
24123 </tbody>
24124 </tgroup>
24125 </informaltable>
24126 <para>
24127 <indexterm role="concept">
24128 <primary>AUTH</primary>
24129 <secondary>on MAIL command</secondary>
24130 </indexterm>
24131 This option defines the ACL that is run when there is an AUTH parameter on
24132 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
24133 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
24134 </para>
24135 <para>
24136 <indexterm role="option">
24137 <primary><option>acl_smtp_mime</option></primary>
24138 </indexterm>
24139 </para>
24140 <informaltable frame="all">
24141 <tgroup cols="4" colsep="0" rowsep="0">
24142 <colspec colwidth="8*" align="left"/>
24143 <colspec colwidth="6*" align="center"/>
24144 <colspec colwidth="6*" align="center"/>
24145 <colspec colwidth="6*" align="right"/>
24146 <tbody>
24147 <row>
24148 <entry><option>acl_smtp_mime</option></entry>
24149 <entry>Use: <emphasis>main</emphasis></entry>
24150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24151 <entry>Default: <emphasis>unset</emphasis></entry>
24152 </row>
24153 </tbody>
24154 </tgroup>
24155 </informaltable>
24156 <para>
24157 <indexterm role="concept">
24158 <primary>MIME content scanning</primary>
24159 <secondary>ACL for</secondary>
24160 </indexterm>
24161 This option is available when Exim is built with the content-scanning
24162 extension. It defines the ACL that is run for each MIME part in a message. See
24163 section <xref linkend="SECTscanmimepart"/> for details.
24164 </para>
24165 <para>
24166 <indexterm role="option">
24167 <primary><option>acl_smtp_notquit</option></primary>
24168 </indexterm>
24169 </para>
24170 <informaltable frame="all">
24171 <tgroup cols="4" colsep="0" rowsep="0">
24172 <colspec colwidth="8*" align="left"/>
24173 <colspec colwidth="6*" align="center"/>
24174 <colspec colwidth="6*" align="center"/>
24175 <colspec colwidth="6*" align="right"/>
24176 <tbody>
24177 <row>
24178 <entry><option>acl_smtp_notquit</option></entry>
24179 <entry>Use: <emphasis>main</emphasis></entry>
24180 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24181 <entry>Default: <emphasis>unset</emphasis></entry>
24182 </row>
24183 </tbody>
24184 </tgroup>
24185 </informaltable>
24186 <para>
24187 <indexterm role="concept">
24188 <primary>not-QUIT, ACL for</primary>
24189 </indexterm>
24190 This option defines the ACL that is run when an SMTP session
24191 ends without a QUIT command being received.
24192 See chapter <xref linkend="CHAPACL"/> for further details.
24193 </para>
24194 <para>
24195 <indexterm role="option">
24196 <primary><option>acl_smtp_predata</option></primary>
24197 </indexterm>
24198 </para>
24199 <informaltable frame="all">
24200 <tgroup cols="4" colsep="0" rowsep="0">
24201 <colspec colwidth="8*" align="left"/>
24202 <colspec colwidth="6*" align="center"/>
24203 <colspec colwidth="6*" align="center"/>
24204 <colspec colwidth="6*" align="right"/>
24205 <tbody>
24206 <row>
24207 <entry><option>acl_smtp_predata</option></entry>
24208 <entry>Use: <emphasis>main</emphasis></entry>
24209 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24210 <entry>Default: <emphasis>unset</emphasis></entry>
24211 </row>
24212 </tbody>
24213 </tgroup>
24214 </informaltable>
24215 <para>
24216 This option defines the ACL that is run when an SMTP DATA command is
24217 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
24218 further details.
24219 </para>
24220 <para>
24221 <indexterm role="option">
24222 <primary><option>acl_smtp_quit</option></primary>
24223 </indexterm>
24224 </para>
24225 <informaltable frame="all">
24226 <tgroup cols="4" colsep="0" rowsep="0">
24227 <colspec colwidth="8*" align="left"/>
24228 <colspec colwidth="6*" align="center"/>
24229 <colspec colwidth="6*" align="center"/>
24230 <colspec colwidth="6*" align="right"/>
24231 <tbody>
24232 <row>
24233 <entry><option>acl_smtp_quit</option></entry>
24234 <entry>Use: <emphasis>main</emphasis></entry>
24235 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24236 <entry>Default: <emphasis>unset</emphasis></entry>
24237 </row>
24238 </tbody>
24239 </tgroup>
24240 </informaltable>
24241 <para>
24242 <indexterm role="concept">
24243 <primary>QUIT, ACL for</primary>
24244 </indexterm>
24245 This option defines the ACL that is run when an SMTP QUIT command is
24246 received. See chapter <xref linkend="CHAPACL"/> for further details.
24247 </para>
24248 <para>
24249 <indexterm role="option">
24250 <primary><option>acl_smtp_rcpt</option></primary>
24251 </indexterm>
24252 </para>
24253 <informaltable frame="all">
24254 <tgroup cols="4" colsep="0" rowsep="0">
24255 <colspec colwidth="8*" align="left"/>
24256 <colspec colwidth="6*" align="center"/>
24257 <colspec colwidth="6*" align="center"/>
24258 <colspec colwidth="6*" align="right"/>
24259 <tbody>
24260 <row>
24261 <entry><option>acl_smtp_rcpt</option></entry>
24262 <entry>Use: <emphasis>main</emphasis></entry>
24263 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24264 <entry>Default: <emphasis>unset</emphasis></entry>
24265 </row>
24266 </tbody>
24267 </tgroup>
24268 </informaltable>
24269 <para>
24270 <indexterm role="concept">
24271 <primary>RCPT</primary>
24272 <secondary>ACL for</secondary>
24273 </indexterm>
24274 This option defines the ACL that is run when an SMTP RCPT command is
24275 received. See chapter <xref linkend="CHAPACL"/> for further details.
24276 </para>
24277 <para>
24278 <indexterm role="option">
24279 <primary><option>acl_smtp_starttls</option></primary>
24280 </indexterm>
24281 </para>
24282 <informaltable frame="all">
24283 <tgroup cols="4" colsep="0" rowsep="0">
24284 <colspec colwidth="8*" align="left"/>
24285 <colspec colwidth="6*" align="center"/>
24286 <colspec colwidth="6*" align="center"/>
24287 <colspec colwidth="6*" align="right"/>
24288 <tbody>
24289 <row>
24290 <entry><option>acl_smtp_starttls</option></entry>
24291 <entry>Use: <emphasis>main</emphasis></entry>
24292 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24293 <entry>Default: <emphasis>unset</emphasis></entry>
24294 </row>
24295 </tbody>
24296 </tgroup>
24297 </informaltable>
24298 <para>
24299 <indexterm role="concept">
24300 <primary>STARTTLS, ACL for</primary>
24301 </indexterm>
24302 This option defines the ACL that is run when an SMTP STARTTLS command is
24303 received. See chapter <xref linkend="CHAPACL"/> for further details.
24304 </para>
24305 <para>
24306 <indexterm role="option">
24307 <primary><option>acl_smtp_vrfy</option></primary>
24308 </indexterm>
24309 </para>
24310 <informaltable frame="all">
24311 <tgroup cols="4" colsep="0" rowsep="0">
24312 <colspec colwidth="8*" align="left"/>
24313 <colspec colwidth="6*" align="center"/>
24314 <colspec colwidth="6*" align="center"/>
24315 <colspec colwidth="6*" align="right"/>
24316 <tbody>
24317 <row>
24318 <entry><option>acl_smtp_vrfy</option></entry>
24319 <entry>Use: <emphasis>main</emphasis></entry>
24320 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24321 <entry>Default: <emphasis>unset</emphasis></entry>
24322 </row>
24323 </tbody>
24324 </tgroup>
24325 </informaltable>
24326 <para>
24327 <indexterm role="concept">
24328 <primary>VRFY</primary>
24329 <secondary>ACL for</secondary>
24330 </indexterm>
24331 This option defines the ACL that is run when an SMTP VRFY command is
24332 received. See chapter <xref linkend="CHAPACL"/> for further details.
24333 </para>
24334 <para>
24335 <indexterm role="option">
24336 <primary><option>add_environment</option></primary>
24337 </indexterm>
24338 </para>
24339 <informaltable frame="all">
24340 <tgroup cols="4" colsep="0" rowsep="0">
24341 <colspec colwidth="8*" align="left"/>
24342 <colspec colwidth="6*" align="center"/>
24343 <colspec colwidth="6*" align="center"/>
24344 <colspec colwidth="6*" align="right"/>
24345 <tbody>
24346 <row>
24347 <entry><option>add_environment</option></entry>
24348 <entry>Use: <emphasis>main</emphasis></entry>
24349 <entry>Type: <emphasis>string list</emphasis></entry>
24350 <entry>Default: <emphasis>empty</emphasis></entry>
24351 </row>
24352 </tbody>
24353 </tgroup>
24354 </informaltable>
24355 <para>
24356 <indexterm role="concept">
24357 <primary>environment</primary>
24358 <secondary>set values</secondary>
24359 </indexterm>
24360 This option adds individual environment variables that the
24361 currently linked libraries and programs in child processes may use.
24362 Each list element should be of the form <quote>name=value</quote>.
24363 </para>
24364 <para>
24365 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
24366 </para>
24367 <para>
24368 <indexterm role="option">
24369 <primary><option>admin_groups</option></primary>
24370 </indexterm>
24371 </para>
24372 <informaltable frame="all">
24373 <tgroup cols="4" colsep="0" rowsep="0">
24374 <colspec colwidth="8*" align="left"/>
24375 <colspec colwidth="6*" align="center"/>
24376 <colspec colwidth="6*" align="center"/>
24377 <colspec colwidth="6*" align="right"/>
24378 <tbody>
24379 <row>
24380 <entry><option>admin_groups</option></entry>
24381 <entry>Use: <emphasis>main</emphasis></entry>
24382 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24383 <entry>Default: <emphasis>unset</emphasis></entry>
24384 </row>
24385 </tbody>
24386 </tgroup>
24387 </informaltable>
24388 <para>
24389 <indexterm role="concept">
24390 <primary>admin user</primary>
24391 </indexterm>
24392 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
24393 current group or any of the supplementary groups of an Exim caller is in this
24394 colon-separated list, the caller has admin privileges. If all your system
24395 programmers are in a specific group, for example, you can give them all Exim
24396 admin privileges by putting that group in <option>admin_groups</option>. However, this does
24397 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
24398 To permit this, you have to add individuals to the Exim group.
24399 </para>
24400 <para>
24401 <indexterm role="option">
24402 <primary><option>allow_domain_literals</option></primary>
24403 </indexterm>
24404 </para>
24405 <informaltable frame="all">
24406 <tgroup cols="4" colsep="0" rowsep="0">
24407 <colspec colwidth="8*" align="left"/>
24408 <colspec colwidth="6*" align="center"/>
24409 <colspec colwidth="6*" align="center"/>
24410 <colspec colwidth="6*" align="right"/>
24411 <tbody>
24412 <row>
24413 <entry><option>allow_domain_literals</option></entry>
24414 <entry>Use: <emphasis>main</emphasis></entry>
24415 <entry>Type: <emphasis>boolean</emphasis></entry>
24416 <entry>Default: <emphasis>false</emphasis></entry>
24417 </row>
24418 </tbody>
24419 </tgroup>
24420 </informaltable>
24421 <para>
24422 <indexterm role="concept">
24423 <primary>domain literal</primary>
24424 </indexterm>
24425 If this option is set, the RFC 2822 domain literal format is permitted in
24426 email addresses. The option is not set by default, because the domain literal
24427 format is not normally required these days, and few people know about it. It
24428 has, however, been exploited by mail abusers.
24429 </para>
24430 <para>
24431 Unfortunately, it seems that some DNS black list maintainers are using this
24432 format to report black listing to postmasters. If you want to accept messages
24433 addressed to your hosts by IP address, you need to set
24434 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
24435 domains (defined in the named domain list <option>local_domains</option> in the default
24436 configuration). This <quote>magic string</quote> matches the domain literal form of all
24437 the local host&#x2019;s IP addresses.
24438 </para>
24439 <para>
24440 <indexterm role="option">
24441 <primary><option>allow_mx_to_ip</option></primary>
24442 </indexterm>
24443 </para>
24444 <informaltable frame="all">
24445 <tgroup cols="4" colsep="0" rowsep="0">
24446 <colspec colwidth="8*" align="left"/>
24447 <colspec colwidth="6*" align="center"/>
24448 <colspec colwidth="6*" align="center"/>
24449 <colspec colwidth="6*" align="right"/>
24450 <tbody>
24451 <row>
24452 <entry><option>allow_mx_to_ip</option></entry>
24453 <entry>Use: <emphasis>main</emphasis></entry>
24454 <entry>Type: <emphasis>boolean</emphasis></entry>
24455 <entry>Default: <emphasis>false</emphasis></entry>
24456 </row>
24457 </tbody>
24458 </tgroup>
24459 </informaltable>
24460 <para>
24461 <indexterm role="concept">
24462 <primary>MX record</primary>
24463 <secondary>pointing to IP address</secondary>
24464 </indexterm>
24465 It appears that more and more DNS zone administrators are breaking the rules
24466 and putting domain names that look like IP addresses on the right hand side of
24467 MX records. Exim follows the rules and rejects this, giving an error message
24468 that explains the misconfiguration. However, some other MTAs support this
24469 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
24470 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
24471 recommended, except when you have no other choice.
24472 </para>
24473 <para>
24474 <indexterm role="option">
24475 <primary><option>allow_utf8_domains</option></primary>
24476 </indexterm>
24477 </para>
24478 <informaltable frame="all">
24479 <tgroup cols="4" colsep="0" rowsep="0">
24480 <colspec colwidth="8*" align="left"/>
24481 <colspec colwidth="6*" align="center"/>
24482 <colspec colwidth="6*" align="center"/>
24483 <colspec colwidth="6*" align="right"/>
24484 <tbody>
24485 <row>
24486 <entry><option>allow_utf8_domains</option></entry>
24487 <entry>Use: <emphasis>main</emphasis></entry>
24488 <entry>Type: <emphasis>boolean</emphasis></entry>
24489 <entry>Default: <emphasis>false</emphasis></entry>
24490 </row>
24491 </tbody>
24492 </tgroup>
24493 </informaltable>
24494 <para>
24495 <indexterm role="concept">
24496 <primary>domain</primary>
24497 <secondary>UTF-8 characters in</secondary>
24498 </indexterm>
24499 <indexterm role="concept">
24500 <primary>UTF-8</primary>
24501 <secondary>in domain name</secondary>
24502 </indexterm>
24503 Lots of discussion is going on about internationalized domain names. One
24504 camp is strongly in favour of just using UTF-8 characters, and it seems
24505 that at least two other MTAs permit this.
24506 This option allows Exim users to experiment if they wish.
24507 </para>
24508 <para>
24509 If it is set true, Exim&#x2019;s domain parsing function allows valid
24510 UTF-8 multicharacters to appear in domain name components, in addition to
24511 letters, digits, and hyphens.
24512 </para>
24513 <para>
24514 If Exim is built with internationalization support
24515 and the SMTPUTF8 ESMTP option is in use (see chapter <xref linkend="CHAPi18n"/>)
24516 this option can be left as default.
24517 Without that,
24518 if you want to look up such domain names in the DNS, you must also
24519 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
24520 suitable setting is:
24521 </para>
24522 <literallayout class="monospaced">
24523 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
24524   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
24525 </literallayout>
24526 <para>
24527 Alternatively, you can just disable this feature by setting
24528 </para>
24529 <literallayout class="monospaced">
24530 dns_check_names_pattern =
24531 </literallayout>
24532 <para>
24533 That is, set the option to an empty string so that no check is done.
24534 </para>
24535 <para>
24536 <indexterm role="option">
24537 <primary><option>auth_advertise_hosts</option></primary>
24538 </indexterm>
24539 </para>
24540 <informaltable frame="all">
24541 <tgroup cols="4" colsep="0" rowsep="0">
24542 <colspec colwidth="8*" align="left"/>
24543 <colspec colwidth="6*" align="center"/>
24544 <colspec colwidth="6*" align="center"/>
24545 <colspec colwidth="6*" align="right"/>
24546 <tbody>
24547 <row>
24548 <entry><option>auth_advertise_hosts</option></entry>
24549 <entry>Use: <emphasis>main</emphasis></entry>
24550 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24551 <entry>Default: <emphasis>*</emphasis></entry>
24552 </row>
24553 </tbody>
24554 </tgroup>
24555 </informaltable>
24556 <para>
24557 <indexterm role="concept">
24558 <primary>authentication</primary>
24559 <secondary>advertising</secondary>
24560 </indexterm>
24561 <indexterm role="concept">
24562 <primary>AUTH</primary>
24563 <secondary>advertising</secondary>
24564 </indexterm>
24565 <indexterm role="concept">
24566 <primary>ESMTP extensions</primary>
24567 <secondary>AUTH</secondary>
24568 </indexterm>
24569 If any server authentication mechanisms are configured, Exim advertises them in
24570 response to an EHLO command only if the calling host matches this list.
24571 Otherwise, Exim does not advertise AUTH.
24572 Exim does not accept AUTH commands from clients to which it has not
24573 advertised the availability of AUTH. The advertising of individual
24574 authentication mechanisms can be controlled by the use of the
24575 <option>server_advertise_condition</option> generic authenticator option on the individual
24576 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
24577 </para>
24578 <para>
24579 Certain mail clients (for example, Netscape) require the user to provide a name
24580 and password for authentication if AUTH is advertised, even though it may
24581 not be needed (the host may accept messages from hosts on its local LAN without
24582 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
24583 to make these clients more friendly by excluding them from the set of hosts to
24584 which Exim advertises AUTH.
24585 </para>
24586 <para>
24587 <indexterm role="concept">
24588 <primary>AUTH</primary>
24589 <secondary>advertising when encrypted</secondary>
24590 </indexterm>
24591 If you want to advertise the availability of AUTH only when the connection
24592 is encrypted using TLS, you can make use of the fact that the value of this
24593 option is expanded, with a setting like this:
24594 </para>
24595 <literallayout class="monospaced">
24596 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
24597 </literallayout>
24598 <para>
24599 <indexterm role="variable">
24600 <primary><varname>$tls_in_cipher</varname></primary>
24601 </indexterm>
24602 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
24603 the expansion is empty, thus matching no hosts. Otherwise, the result of the
24604 expansion is *, which matches all hosts.
24605 </para>
24606 <para>
24607 <indexterm role="option">
24608 <primary><option>auto_thaw</option></primary>
24609 </indexterm>
24610 </para>
24611 <informaltable frame="all">
24612 <tgroup cols="4" colsep="0" rowsep="0">
24613 <colspec colwidth="8*" align="left"/>
24614 <colspec colwidth="6*" align="center"/>
24615 <colspec colwidth="6*" align="center"/>
24616 <colspec colwidth="6*" align="right"/>
24617 <tbody>
24618 <row>
24619 <entry><option>auto_thaw</option></entry>
24620 <entry>Use: <emphasis>main</emphasis></entry>
24621 <entry>Type: <emphasis>time</emphasis></entry>
24622 <entry>Default: <emphasis>0s</emphasis></entry>
24623 </row>
24624 </tbody>
24625 </tgroup>
24626 </informaltable>
24627 <para>
24628 <indexterm role="concept">
24629 <primary>thawing messages</primary>
24630 </indexterm>
24631 <indexterm role="concept">
24632 <primary>unfreezing messages</primary>
24633 </indexterm>
24634 If this option is set to a time greater than zero, a queue runner will try a
24635 new delivery attempt on any frozen message, other than a bounce message, if
24636 this much time has passed since it was frozen. This may result in the message
24637 being re-frozen if nothing has changed since the last attempt. It is a way of
24638 saying <quote>keep on trying, even though there are big problems</quote>.
24639 </para>
24640 <para>
24641 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
24642 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
24643 thought to be very useful any more, and its use should probably be avoided.
24644 </para>
24645 <para>
24646 <indexterm role="option">
24647 <primary><option>av_scanner</option></primary>
24648 </indexterm>
24649 </para>
24650 <informaltable frame="all">
24651 <tgroup cols="4" colsep="0" rowsep="0">
24652 <colspec colwidth="8*" align="left"/>
24653 <colspec colwidth="6*" align="center"/>
24654 <colspec colwidth="6*" align="center"/>
24655 <colspec colwidth="6*" align="right"/>
24656 <tbody>
24657 <row>
24658 <entry><option>av_scanner</option></entry>
24659 <entry>Use: <emphasis>main</emphasis></entry>
24660 <entry>Type: <emphasis>string</emphasis></entry>
24661 <entry>Default: <emphasis>see below</emphasis></entry>
24662 </row>
24663 </tbody>
24664 </tgroup>
24665 </informaltable>
24666 <para>
24667 This option is available if Exim is built with the content-scanning extension.
24668 It specifies which anti-virus scanner to use. The default value is:
24669 </para>
24670 <literallayout class="monospaced">
24671 sophie:/var/run/sophie
24672 </literallayout>
24673 <para>
24674 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
24675 before use. See section <xref linkend="SECTscanvirus"/> for further details.
24676 </para>
24677 <para>
24678 <indexterm role="option">
24679 <primary><option>bi_command</option></primary>
24680 </indexterm>
24681 </para>
24682 <informaltable frame="all">
24683 <tgroup cols="4" colsep="0" rowsep="0">
24684 <colspec colwidth="8*" align="left"/>
24685 <colspec colwidth="6*" align="center"/>
24686 <colspec colwidth="6*" align="center"/>
24687 <colspec colwidth="6*" align="right"/>
24688 <tbody>
24689 <row>
24690 <entry><option>bi_command</option></entry>
24691 <entry>Use: <emphasis>main</emphasis></entry>
24692 <entry>Type: <emphasis>string</emphasis></entry>
24693 <entry>Default: <emphasis>unset</emphasis></entry>
24694 </row>
24695 </tbody>
24696 </tgroup>
24697 </informaltable>
24698 <para>
24699 <indexterm role="option">
24700 <primary><option>-bi</option></primary>
24701 </indexterm>
24702 This option supplies the name of a command that is run when Exim is called with
24703 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
24704 just the command name, it is not a complete command line. If an argument is
24705 required, it must come from the <option>-oA</option> command line option.
24706 </para>
24707 <para>
24708 <indexterm role="option">
24709 <primary><option>bounce_message_file</option></primary>
24710 </indexterm>
24711 </para>
24712 <informaltable frame="all">
24713 <tgroup cols="4" colsep="0" rowsep="0">
24714 <colspec colwidth="8*" align="left"/>
24715 <colspec colwidth="6*" align="center"/>
24716 <colspec colwidth="6*" align="center"/>
24717 <colspec colwidth="6*" align="right"/>
24718 <tbody>
24719 <row>
24720 <entry><option>bounce_message_file</option></entry>
24721 <entry>Use: <emphasis>main</emphasis></entry>
24722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24723 <entry>Default: <emphasis>unset</emphasis></entry>
24724 </row>
24725 </tbody>
24726 </tgroup>
24727 </informaltable>
24728 <para>
24729 <indexterm role="concept">
24730 <primary>bounce message</primary>
24731 <secondary>customizing</secondary>
24732 </indexterm>
24733 <indexterm role="concept">
24734 <primary>customizing</primary>
24735 <secondary>bounce message</secondary>
24736 </indexterm>
24737 This option defines a template file containing paragraphs of text to be used
24738 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
24739 chapter <xref linkend="CHAPemsgcust"/>.
24740 </para>
24741 <para revisionflag="changed">
24742 <indexterm role="concept">
24743 <primary>bounce_message_file</primary>
24744 <secondary>tainted data</secondary>
24745 </indexterm>
24746 The option is expanded to give the file path, which must be
24747 absolute and untainted.
24748 </para>
24749 <para>
24750 See also <option>warn_message_file</option>.
24751 </para>
24752 <para>
24753 <indexterm role="option">
24754 <primary><option>bounce_message_text</option></primary>
24755 </indexterm>
24756 </para>
24757 <informaltable frame="all">
24758 <tgroup cols="4" colsep="0" rowsep="0">
24759 <colspec colwidth="8*" align="left"/>
24760 <colspec colwidth="6*" align="center"/>
24761 <colspec colwidth="6*" align="center"/>
24762 <colspec colwidth="6*" align="right"/>
24763 <tbody>
24764 <row>
24765 <entry><option>bounce_message_text</option></entry>
24766 <entry>Use: <emphasis>main</emphasis></entry>
24767 <entry>Type: <emphasis>string</emphasis></entry>
24768 <entry>Default: <emphasis>unset</emphasis></entry>
24769 </row>
24770 </tbody>
24771 </tgroup>
24772 </informaltable>
24773 <para>
24774 When this option is set, its contents are included in the default bounce
24775 message immediately after <quote>This message was created automatically by mail
24776 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
24777 </para>
24778 <para>
24779 <indexterm role="option">
24780 <primary><option>bounce_return_body</option></primary>
24781 </indexterm>
24782 </para>
24783 <informaltable frame="all">
24784 <tgroup cols="4" colsep="0" rowsep="0">
24785 <colspec colwidth="8*" align="left"/>
24786 <colspec colwidth="6*" align="center"/>
24787 <colspec colwidth="6*" align="center"/>
24788 <colspec colwidth="6*" align="right"/>
24789 <tbody>
24790 <row>
24791 <entry><option>bounce_return_body</option></entry>
24792 <entry>Use: <emphasis>main</emphasis></entry>
24793 <entry>Type: <emphasis>boolean</emphasis></entry>
24794 <entry>Default: <emphasis>true</emphasis></entry>
24795 </row>
24796 </tbody>
24797 </tgroup>
24798 </informaltable>
24799 <para>
24800 <indexterm role="concept">
24801 <primary>bounce message</primary>
24802 <secondary>including body</secondary>
24803 </indexterm>
24804 This option controls whether the body of an incoming message is included in a
24805 bounce message when <option>bounce_return_message</option> is true. The default setting
24806 causes the entire message, both header and body, to be returned (subject to the
24807 value of <option>bounce_return_size_limit</option>). If this option is false, only the
24808 message header is included. In the case of a non-SMTP message containing an
24809 error that is detected during reception, only those header lines preceding the
24810 point at which the error was detected are returned.
24811 <indexterm role="concept">
24812 <primary>bounce message</primary>
24813 <secondary>including original</secondary>
24814 </indexterm>
24815 </para>
24816 <para>
24817 <indexterm role="option">
24818 <primary><option>bounce_return_linesize_limit</option></primary>
24819 </indexterm>
24820 </para>
24821 <informaltable frame="all">
24822 <tgroup cols="4" colsep="0" rowsep="0">
24823 <colspec colwidth="8*" align="left"/>
24824 <colspec colwidth="6*" align="center"/>
24825 <colspec colwidth="6*" align="center"/>
24826 <colspec colwidth="6*" align="right"/>
24827 <tbody>
24828 <row>
24829 <entry><option>bounce_return_linesize_limit</option></entry>
24830 <entry>Use: <emphasis>main</emphasis></entry>
24831 <entry>Type: <emphasis>integer</emphasis></entry>
24832 <entry>Default: <emphasis>998</emphasis></entry>
24833 </row>
24834 </tbody>
24835 </tgroup>
24836 </informaltable>
24837 <para>
24838 <indexterm role="concept">
24839 <primary>size</primary>
24840 <secondary>of bounce lines, limit</secondary>
24841 </indexterm>
24842 <indexterm role="concept">
24843 <primary>bounce message</primary>
24844 <secondary>line length limit</secondary>
24845 </indexterm>
24846 <indexterm role="concept">
24847 <primary>limit</primary>
24848 <secondary>bounce message line length</secondary>
24849 </indexterm>
24850 This option sets a limit in bytes on the line length of messages
24851 that are returned to senders due to delivery problems,
24852 when <option>bounce_return_message</option> is true.
24853 The default value corresponds to RFC limits.
24854 If the message being returned has lines longer than this value it is
24855 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
24856 </para>
24857 <para>
24858 The option also applies to bounces returned when an error is detected
24859 during reception of a message.
24860 In this case lines from the original are truncated.
24861 </para>
24862 <para>
24863 The option does not apply to messages generated by an <command>autoreply</command> transport.
24864 </para>
24865 <para>
24866 <indexterm role="option">
24867 <primary><option>bounce_return_message</option></primary>
24868 </indexterm>
24869 </para>
24870 <informaltable frame="all">
24871 <tgroup cols="4" colsep="0" rowsep="0">
24872 <colspec colwidth="8*" align="left"/>
24873 <colspec colwidth="6*" align="center"/>
24874 <colspec colwidth="6*" align="center"/>
24875 <colspec colwidth="6*" align="right"/>
24876 <tbody>
24877 <row>
24878 <entry><option>bounce_return_message</option></entry>
24879 <entry>Use: <emphasis>main</emphasis></entry>
24880 <entry>Type: <emphasis>boolean</emphasis></entry>
24881 <entry>Default: <emphasis>true</emphasis></entry>
24882 </row>
24883 </tbody>
24884 </tgroup>
24885 </informaltable>
24886 <para>
24887 If this option is set false, none of the original message is included in
24888 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
24889 <option>bounce_return_body</option>.
24890 </para>
24891 <para>
24892 <indexterm role="option">
24893 <primary><option>bounce_return_size_limit</option></primary>
24894 </indexterm>
24895 </para>
24896 <informaltable frame="all">
24897 <tgroup cols="4" colsep="0" rowsep="0">
24898 <colspec colwidth="8*" align="left"/>
24899 <colspec colwidth="6*" align="center"/>
24900 <colspec colwidth="6*" align="center"/>
24901 <colspec colwidth="6*" align="right"/>
24902 <tbody>
24903 <row>
24904 <entry><option>bounce_return_size_limit</option></entry>
24905 <entry>Use: <emphasis>main</emphasis></entry>
24906 <entry>Type: <emphasis>integer</emphasis></entry>
24907 <entry>Default: <emphasis>100K</emphasis></entry>
24908 </row>
24909 </tbody>
24910 </tgroup>
24911 </informaltable>
24912 <para>
24913 <indexterm role="concept">
24914 <primary>size</primary>
24915 <secondary>of bounce, limit</secondary>
24916 </indexterm>
24917 <indexterm role="concept">
24918 <primary>bounce message</primary>
24919 <secondary>size limit</secondary>
24920 </indexterm>
24921 <indexterm role="concept">
24922 <primary>limit</primary>
24923 <secondary>bounce message size</secondary>
24924 </indexterm>
24925 This option sets a limit in bytes on the size of messages that are returned to
24926 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
24927 limit should be less than the value of the global <option>message_size_limit</option> and of
24928 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
24929 that Exim generates. If this option is set to zero there is no limit.
24930 </para>
24931 <para>
24932 When the body of any message that is to be included in a bounce message is
24933 greater than the limit, it is truncated, and a comment pointing this out is
24934 added at the top. The actual cutoff may be greater than the value given, owing
24935 to the use of buffering for transferring the message in chunks (typically 8K in
24936 size). The idea is to save bandwidth on those undeliverable 15-megabyte
24937 messages.
24938 </para>
24939 <para>
24940 <indexterm role="option">
24941 <primary><option>bounce_sender_authentication</option></primary>
24942 </indexterm>
24943 </para>
24944 <informaltable frame="all">
24945 <tgroup cols="4" colsep="0" rowsep="0">
24946 <colspec colwidth="8*" align="left"/>
24947 <colspec colwidth="6*" align="center"/>
24948 <colspec colwidth="6*" align="center"/>
24949 <colspec colwidth="6*" align="right"/>
24950 <tbody>
24951 <row>
24952 <entry><option>bounce_sender_authentication</option></entry>
24953 <entry>Use: <emphasis>main</emphasis></entry>
24954 <entry>Type: <emphasis>string</emphasis></entry>
24955 <entry>Default: <emphasis>unset</emphasis></entry>
24956 </row>
24957 </tbody>
24958 </tgroup>
24959 </informaltable>
24960 <para>
24961 <indexterm role="concept">
24962 <primary>bounce message</primary>
24963 <secondary>sender authentication</secondary>
24964 </indexterm>
24965 <indexterm role="concept">
24966 <primary>authentication</primary>
24967 <secondary>bounce message</secondary>
24968 </indexterm>
24969 <indexterm role="concept">
24970 <primary>AUTH</primary>
24971 <secondary>on bounce message</secondary>
24972 </indexterm>
24973 This option provides an authenticated sender address that is sent with any
24974 bounce messages generated by Exim that are sent over an authenticated SMTP
24975 connection. A typical setting might be:
24976 </para>
24977 <literallayout class="monospaced">
24978 bounce_sender_authentication = mailer-daemon@my.domain.example
24979 </literallayout>
24980 <para>
24981 which would cause bounce messages to be sent using the SMTP command:
24982 </para>
24983 <literallayout class="monospaced">
24984 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
24985 </literallayout>
24986 <para>
24987 The value of <option>bounce_sender_authentication</option> must always be a complete email
24988 address.
24989 </para>
24990 <para>
24991 <indexterm role="option">
24992 <primary><option>callout_domain_negative_expire</option></primary>
24993 </indexterm>
24994 </para>
24995 <informaltable frame="all">
24996 <tgroup cols="4" colsep="0" rowsep="0">
24997 <colspec colwidth="8*" align="left"/>
24998 <colspec colwidth="6*" align="center"/>
24999 <colspec colwidth="6*" align="center"/>
25000 <colspec colwidth="6*" align="right"/>
25001 <tbody>
25002 <row>
25003 <entry><option>callout_domain_negative_expire</option></entry>
25004 <entry>Use: <emphasis>main</emphasis></entry>
25005 <entry>Type: <emphasis>time</emphasis></entry>
25006 <entry>Default: <emphasis>3h</emphasis></entry>
25007 </row>
25008 </tbody>
25009 </tgroup>
25010 </informaltable>
25011 <para>
25012 <indexterm role="concept">
25013 <primary>caching</primary>
25014 <secondary>callout timeouts</secondary>
25015 </indexterm>
25016 <indexterm role="concept">
25017 <primary>callout</primary>
25018 <secondary>caching timeouts</secondary>
25019 </indexterm>
25020 This option specifies the expiry time for negative callout cache data for a
25021 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25022 section <xref linkend="SECTcallvercache"/> for details of the caching.
25023 </para>
25024 <para>
25025 <indexterm role="option">
25026 <primary><option>callout_domain_positive_expire</option></primary>
25027 </indexterm>
25028 </para>
25029 <informaltable frame="all">
25030 <tgroup cols="4" colsep="0" rowsep="0">
25031 <colspec colwidth="8*" align="left"/>
25032 <colspec colwidth="6*" align="center"/>
25033 <colspec colwidth="6*" align="center"/>
25034 <colspec colwidth="6*" align="right"/>
25035 <tbody>
25036 <row>
25037 <entry><option>callout_domain_positive_expire</option></entry>
25038 <entry>Use: <emphasis>main</emphasis></entry>
25039 <entry>Type: <emphasis>time</emphasis></entry>
25040 <entry>Default: <emphasis>7d</emphasis></entry>
25041 </row>
25042 </tbody>
25043 </tgroup>
25044 </informaltable>
25045 <para>
25046 This option specifies the expiry time for positive callout cache data for a
25047 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25048 section <xref linkend="SECTcallvercache"/> for details of the caching.
25049 </para>
25050 <para>
25051 <indexterm role="option">
25052 <primary><option>callout_negative_expire</option></primary>
25053 </indexterm>
25054 </para>
25055 <informaltable frame="all">
25056 <tgroup cols="4" colsep="0" rowsep="0">
25057 <colspec colwidth="8*" align="left"/>
25058 <colspec colwidth="6*" align="center"/>
25059 <colspec colwidth="6*" align="center"/>
25060 <colspec colwidth="6*" align="right"/>
25061 <tbody>
25062 <row>
25063 <entry><option>callout_negative_expire</option></entry>
25064 <entry>Use: <emphasis>main</emphasis></entry>
25065 <entry>Type: <emphasis>time</emphasis></entry>
25066 <entry>Default: <emphasis>2h</emphasis></entry>
25067 </row>
25068 </tbody>
25069 </tgroup>
25070 </informaltable>
25071 <para>
25072 This option specifies the expiry time for negative callout cache data for an
25073 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25074 section <xref linkend="SECTcallvercache"/> for details of the caching.
25075 </para>
25076 <para>
25077 <indexterm role="option">
25078 <primary><option>callout_positive_expire</option></primary>
25079 </indexterm>
25080 </para>
25081 <informaltable frame="all">
25082 <tgroup cols="4" colsep="0" rowsep="0">
25083 <colspec colwidth="8*" align="left"/>
25084 <colspec colwidth="6*" align="center"/>
25085 <colspec colwidth="6*" align="center"/>
25086 <colspec colwidth="6*" align="right"/>
25087 <tbody>
25088 <row>
25089 <entry><option>callout_positive_expire</option></entry>
25090 <entry>Use: <emphasis>main</emphasis></entry>
25091 <entry>Type: <emphasis>time</emphasis></entry>
25092 <entry>Default: <emphasis>24h</emphasis></entry>
25093 </row>
25094 </tbody>
25095 </tgroup>
25096 </informaltable>
25097 <para>
25098 This option specifies the expiry time for positive callout cache data for an
25099 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25100 section <xref linkend="SECTcallvercache"/> for details of the caching.
25101 </para>
25102 <para>
25103 <indexterm role="option">
25104 <primary><option>callout_random_local_part</option></primary>
25105 </indexterm>
25106 </para>
25107 <informaltable frame="all">
25108 <tgroup cols="4" colsep="0" rowsep="0">
25109 <colspec colwidth="8*" align="left"/>
25110 <colspec colwidth="6*" align="center"/>
25111 <colspec colwidth="6*" align="center"/>
25112 <colspec colwidth="6*" align="right"/>
25113 <tbody>
25114 <row>
25115 <entry><option>callout_random_local_part</option></entry>
25116 <entry>Use: <emphasis>main</emphasis></entry>
25117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25118 <entry>Default: <emphasis>see below</emphasis></entry>
25119 </row>
25120 </tbody>
25121 </tgroup>
25122 </informaltable>
25123 <para>
25124 This option defines the <quote>random</quote> local part that can be used as part of
25125 callout verification. The default value is
25126 </para>
25127 <literallayout class="monospaced">
25128 $primary_hostname-$tod_epoch-testing
25129 </literallayout>
25130 <para>
25131 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
25132 </para>
25133 <para>
25134 <indexterm role="option">
25135 <primary><option>check_log_inodes</option></primary>
25136 </indexterm>
25137 </para>
25138 <informaltable frame="all">
25139 <tgroup cols="4" colsep="0" rowsep="0">
25140 <colspec colwidth="8*" align="left"/>
25141 <colspec colwidth="6*" align="center"/>
25142 <colspec colwidth="6*" align="center"/>
25143 <colspec colwidth="6*" align="right"/>
25144 <tbody>
25145 <row>
25146 <entry><option>check_log_inodes</option></entry>
25147 <entry>Use: <emphasis>main</emphasis></entry>
25148 <entry>Type: <emphasis>integer</emphasis></entry>
25149 <entry>Default: <emphasis>100</emphasis></entry>
25150 </row>
25151 </tbody>
25152 </tgroup>
25153 </informaltable>
25154 <para>
25155 See <option>check_spool_space</option> below.
25156 </para>
25157 <para>
25158 <indexterm role="option">
25159 <primary><option>check_log_space</option></primary>
25160 </indexterm>
25161 </para>
25162 <informaltable frame="all">
25163 <tgroup cols="4" colsep="0" rowsep="0">
25164 <colspec colwidth="8*" align="left"/>
25165 <colspec colwidth="6*" align="center"/>
25166 <colspec colwidth="6*" align="center"/>
25167 <colspec colwidth="6*" align="right"/>
25168 <tbody>
25169 <row>
25170 <entry><option>check_log_space</option></entry>
25171 <entry>Use: <emphasis>main</emphasis></entry>
25172 <entry>Type: <emphasis>integer</emphasis></entry>
25173 <entry>Default: <emphasis>10M</emphasis></entry>
25174 </row>
25175 </tbody>
25176 </tgroup>
25177 </informaltable>
25178 <para>
25179 See <option>check_spool_space</option> below.
25180 </para>
25181 <para>
25182 <indexterm role="option">
25183 <primary><option>check_rfc2047_length</option></primary>
25184 </indexterm>
25185 <indexterm role="concept">
25186 <primary>RFC 2047</primary>
25187 <secondary>disabling length check</secondary>
25188 </indexterm>
25189 <indexterm role="option">
25190 <primary><option>check_rfc2047_length</option></primary>
25191 </indexterm>
25192 </para>
25193 <informaltable frame="all">
25194 <tgroup cols="4" colsep="0" rowsep="0">
25195 <colspec colwidth="8*" align="left"/>
25196 <colspec colwidth="6*" align="center"/>
25197 <colspec colwidth="6*" align="center"/>
25198 <colspec colwidth="6*" align="right"/>
25199 <tbody>
25200 <row>
25201 <entry><option>check_rfc2047_length</option></entry>
25202 <entry>Use: <emphasis>main</emphasis></entry>
25203 <entry>Type: <emphasis>boolean</emphasis></entry>
25204 <entry>Default: <emphasis>true</emphasis></entry>
25205 </row>
25206 </tbody>
25207 </tgroup>
25208 </informaltable>
25209 <para>
25210 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
25211 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
25212 word; strings to be encoded that exceed this length are supposed to use
25213 multiple encoded words. By default, Exim does not recognize encoded words that
25214 exceed the maximum length. However, it seems that some software, in violation
25215 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
25216 set false, Exim recognizes encoded words of any length.
25217 </para>
25218 <para>
25219 <indexterm role="option">
25220 <primary><option>check_spool_inodes</option></primary>
25221 </indexterm>
25222 </para>
25223 <informaltable frame="all">
25224 <tgroup cols="4" colsep="0" rowsep="0">
25225 <colspec colwidth="8*" align="left"/>
25226 <colspec colwidth="6*" align="center"/>
25227 <colspec colwidth="6*" align="center"/>
25228 <colspec colwidth="6*" align="right"/>
25229 <tbody>
25230 <row>
25231 <entry><option>check_spool_inodes</option></entry>
25232 <entry>Use: <emphasis>main</emphasis></entry>
25233 <entry>Type: <emphasis>integer</emphasis></entry>
25234 <entry>Default: <emphasis>100</emphasis></entry>
25235 </row>
25236 </tbody>
25237 </tgroup>
25238 </informaltable>
25239 <para>
25240 See <option>check_spool_space</option> below.
25241 </para>
25242 <para>
25243 <indexterm role="option">
25244 <primary><option>check_spool_space</option></primary>
25245 </indexterm>
25246 </para>
25247 <informaltable frame="all">
25248 <tgroup cols="4" colsep="0" rowsep="0">
25249 <colspec colwidth="8*" align="left"/>
25250 <colspec colwidth="6*" align="center"/>
25251 <colspec colwidth="6*" align="center"/>
25252 <colspec colwidth="6*" align="right"/>
25253 <tbody>
25254 <row>
25255 <entry><option>check_spool_space</option></entry>
25256 <entry>Use: <emphasis>main</emphasis></entry>
25257 <entry>Type: <emphasis>integer</emphasis></entry>
25258 <entry>Default: <emphasis>10M</emphasis></entry>
25259 </row>
25260 </tbody>
25261 </tgroup>
25262 </informaltable>
25263 <para>
25264 <indexterm role="concept">
25265 <primary>checking disk space</primary>
25266 </indexterm>
25267 <indexterm role="concept">
25268 <primary>disk space, checking</primary>
25269 </indexterm>
25270 <indexterm role="concept">
25271 <primary>spool directory</primary>
25272 <secondary>checking space</secondary>
25273 </indexterm>
25274 The four <option>check_...</option> options allow for checking of disk resources before a
25275 message is accepted.
25276 </para>
25277 <para>
25278 <indexterm role="variable">
25279 <primary><varname>$log_inodes</varname></primary>
25280 </indexterm>
25281 <indexterm role="variable">
25282 <primary><varname>$log_space</varname></primary>
25283 </indexterm>
25284 <indexterm role="variable">
25285 <primary><varname>$spool_inodes</varname></primary>
25286 </indexterm>
25287 <indexterm role="variable">
25288 <primary><varname>$spool_space</varname></primary>
25289 </indexterm>
25290 When any of these options are nonzero, they apply to all incoming messages. If you
25291 want to apply different checks to different kinds of message, you can do so by
25292 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
25293 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
25294 </para>
25295 <para>
25296 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
25297 either value is greater than zero, for example:
25298 </para>
25299 <literallayout class="monospaced">
25300 check_spool_space = 100M
25301 check_spool_inodes = 100
25302 </literallayout>
25303 <para>
25304 The spool partition is the one that contains the directory defined by
25305 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
25306 transit.
25307 </para>
25308 <para>
25309 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
25310 files are written if either is greater than zero. These should be set only if
25311 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
25312 </para>
25313 <para>
25314 If there is less space or fewer inodes than requested, Exim refuses to accept
25315 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
25316 error response to the MAIL command. If ESMTP is in use and there was a
25317 SIZE parameter on the MAIL command, its value is added to the
25318 <option>check_spool_space</option> value, and the check is performed even if
25319 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
25320 </para>
25321 <para>
25322 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
25323 number of kilobytes (though specified in bytes).
25324 If a non-multiple of 1024 is specified, it is rounded up.
25325 </para>
25326 <para>
25327 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
25328 failure a message is written to stderr and Exim exits with a non-zero code, as
25329 it obviously cannot send an error message of any kind.
25330 </para>
25331 <para>
25332 There is a slight performance penalty for these checks.
25333 Versions of Exim preceding 4.88 had these disabled by default;
25334 high-rate installations confident they will never run out of resources
25335 may wish to deliberately disable them.
25336 </para>
25337 <para>
25338 <indexterm role="option">
25339 <primary><option>chunking_advertise_hosts</option></primary>
25340 </indexterm>
25341 </para>
25342 <informaltable frame="all">
25343 <tgroup cols="4" colsep="0" rowsep="0">
25344 <colspec colwidth="8*" align="left"/>
25345 <colspec colwidth="6*" align="center"/>
25346 <colspec colwidth="6*" align="center"/>
25347 <colspec colwidth="6*" align="right"/>
25348 <tbody>
25349 <row>
25350 <entry><option>chunking_advertise_hosts</option></entry>
25351 <entry>Use: <emphasis>main</emphasis></entry>
25352 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25353 <entry>Default: <emphasis>*</emphasis></entry>
25354 </row>
25355 </tbody>
25356 </tgroup>
25357 </informaltable>
25358 <para>
25359 <indexterm role="concept">
25360 <primary>CHUNKING</primary>
25361 <secondary>advertisement</secondary>
25362 </indexterm>
25363 <indexterm role="concept">
25364 <primary>RFC 3030</primary>
25365 <secondary>CHUNKING</secondary>
25366 </indexterm>
25367 <indexterm role="concept">
25368 <primary>ESMTP extensions</primary>
25369 <secondary>CHUNKING</secondary>
25370 </indexterm>
25371 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
25372 these hosts.
25373 Hosts may use the BDAT command as an alternate to DATA.
25374 </para>
25375 <para>
25376 <indexterm role="option">
25377 <primary><option>commandline_checks_require_admin</option></primary>
25378 </indexterm>
25379 </para>
25380 <informaltable frame="all">
25381 <tgroup cols="4" colsep="0" rowsep="0">
25382 <colspec colwidth="8*" align="left"/>
25383 <colspec colwidth="6*" align="center"/>
25384 <colspec colwidth="6*" align="center"/>
25385 <colspec colwidth="6*" align="right"/>
25386 <tbody>
25387 <row>
25388 <entry><option>commandline_checks_require_admin</option></entry>
25389 <entry>Use: <emphasis>main</emphasis></entry>
25390 <entry>Type: <emphasis>boolean</emphasis></entry>
25391 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
25392 </row>
25393 </tbody>
25394 </tgroup>
25395 </informaltable>
25396 <para>
25397 <indexterm role="concept">
25398 <primary>restricting access to features</primary>
25399 </indexterm>
25400 This option restricts various basic checking features to require an
25401 administrative user.
25402 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
25403 </para>
25404 <para>
25405 <indexterm role="option">
25406 <primary><option>debug_store</option></primary>
25407 </indexterm>
25408 </para>
25409 <informaltable frame="all">
25410 <tgroup cols="4" colsep="0" rowsep="0">
25411 <colspec colwidth="8*" align="left"/>
25412 <colspec colwidth="6*" align="center"/>
25413 <colspec colwidth="6*" align="center"/>
25414 <colspec colwidth="6*" align="right"/>
25415 <tbody>
25416 <row>
25417 <entry><option>debug_store</option></entry>
25418 <entry>Use: <emphasis>main</emphasis></entry>
25419 <entry>Type: <emphasis>boolean</emphasis></entry>
25420 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
25421 </row>
25422 </tbody>
25423 </tgroup>
25424 </informaltable>
25425 <para>
25426 <indexterm role="concept">
25427 <primary>debugging</primary>
25428 <secondary>memory corruption</secondary>
25429 </indexterm>
25430 <indexterm role="concept">
25431 <primary>memory</primary>
25432 <secondary>debugging</secondary>
25433 </indexterm>
25434 This option, when true, enables extra checking in Exim&#x2019;s internal memory
25435 management.  For use when a memory corruption issue is being investigated,
25436 it should normally be left as default.
25437 </para>
25438 <para>
25439 <indexterm role="option">
25440 <primary><option>daemon_smtp_ports</option></primary>
25441 </indexterm>
25442 </para>
25443 <informaltable frame="all">
25444 <tgroup cols="4" colsep="0" rowsep="0">
25445 <colspec colwidth="8*" align="left"/>
25446 <colspec colwidth="6*" align="center"/>
25447 <colspec colwidth="6*" align="center"/>
25448 <colspec colwidth="6*" align="right"/>
25449 <tbody>
25450 <row>
25451 <entry><option>daemon_smtp_ports</option></entry>
25452 <entry>Use: <emphasis>main</emphasis></entry>
25453 <entry>Type: <emphasis>string</emphasis></entry>
25454 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
25455 </row>
25456 </tbody>
25457 </tgroup>
25458 </informaltable>
25459 <para>
25460 <indexterm role="concept">
25461 <primary>port</primary>
25462 <secondary>for daemon</secondary>
25463 </indexterm>
25464 <indexterm role="concept">
25465 <primary>TCP/IP</primary>
25466 <secondary>setting listening ports</secondary>
25467 </indexterm>
25468 This option specifies one or more default SMTP ports on which the Exim daemon
25469 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
25470 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
25471 </para>
25472 <para>
25473 <indexterm role="option">
25474 <primary><option>daemon_startup_retries</option></primary>
25475 </indexterm>
25476 </para>
25477 <informaltable frame="all">
25478 <tgroup cols="4" colsep="0" rowsep="0">
25479 <colspec colwidth="8*" align="left"/>
25480 <colspec colwidth="6*" align="center"/>
25481 <colspec colwidth="6*" align="center"/>
25482 <colspec colwidth="6*" align="right"/>
25483 <tbody>
25484 <row>
25485 <entry><option>daemon_startup_retries</option></entry>
25486 <entry>Use: <emphasis>main</emphasis></entry>
25487 <entry>Type: <emphasis>integer</emphasis></entry>
25488 <entry>Default: <emphasis>9</emphasis></entry>
25489 </row>
25490 </tbody>
25491 </tgroup>
25492 </informaltable>
25493 <para>
25494 <indexterm role="concept">
25495 <primary>daemon startup, retrying</primary>
25496 </indexterm>
25497 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
25498 the daemon at startup when it cannot immediately bind a listening socket
25499 (typically because the socket is already in use): <option>daemon_startup_retries</option>
25500 defines the number of retries after the first failure, and
25501 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
25502 </para>
25503 <para>
25504 <indexterm role="option">
25505 <primary><option>daemon_startup_sleep</option></primary>
25506 </indexterm>
25507 </para>
25508 <informaltable frame="all">
25509 <tgroup cols="4" colsep="0" rowsep="0">
25510 <colspec colwidth="8*" align="left"/>
25511 <colspec colwidth="6*" align="center"/>
25512 <colspec colwidth="6*" align="center"/>
25513 <colspec colwidth="6*" align="right"/>
25514 <tbody>
25515 <row>
25516 <entry><option>daemon_startup_sleep</option></entry>
25517 <entry>Use: <emphasis>main</emphasis></entry>
25518 <entry>Type: <emphasis>time</emphasis></entry>
25519 <entry>Default: <emphasis>30s</emphasis></entry>
25520 </row>
25521 </tbody>
25522 </tgroup>
25523 </informaltable>
25524 <para>
25525 See <option>daemon_startup_retries</option>.
25526 </para>
25527 <para>
25528 <indexterm role="option">
25529 <primary><option>delay_warning</option></primary>
25530 </indexterm>
25531 </para>
25532 <informaltable frame="all">
25533 <tgroup cols="4" colsep="0" rowsep="0">
25534 <colspec colwidth="8*" align="left"/>
25535 <colspec colwidth="6*" align="center"/>
25536 <colspec colwidth="6*" align="center"/>
25537 <colspec colwidth="6*" align="right"/>
25538 <tbody>
25539 <row>
25540 <entry><option>delay_warning</option></entry>
25541 <entry>Use: <emphasis>main</emphasis></entry>
25542 <entry>Type: <emphasis>time list</emphasis></entry>
25543 <entry>Default: <emphasis>24h</emphasis></entry>
25544 </row>
25545 </tbody>
25546 </tgroup>
25547 </informaltable>
25548 <para>
25549 <indexterm role="concept">
25550 <primary>warning of delay</primary>
25551 </indexterm>
25552 <indexterm role="concept">
25553 <primary>delay warning, specifying</primary>
25554 </indexterm>
25555 <indexterm role="concept">
25556 <primary>queue</primary>
25557 <secondary>delay warning</secondary>
25558 </indexterm>
25559 When a message is delayed, Exim sends a warning message to the sender at
25560 intervals specified by this option. The data is a colon-separated list of times
25561 after which to send warning messages. If the value of the option is an empty
25562 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
25563 message has been in the queue for longer than the last time, the last interval
25564 between the times is used to compute subsequent warning times. For example,
25565 with
25566 </para>
25567 <literallayout class="monospaced">
25568 delay_warning = 4h:8h:24h
25569 </literallayout>
25570 <para>
25571 the first message is sent after 4 hours, the second after 8 hours, and
25572 the third one after 24 hours. After that, messages are sent every 16 hours,
25573 because that is the interval between the last two times on the list. If you set
25574 just one time, it specifies the repeat interval. For example, with:
25575 </para>
25576 <literallayout class="monospaced">
25577 delay_warning = 6h
25578 </literallayout>
25579 <para>
25580 messages are repeated every six hours. To stop warnings after a given time, set
25581 a very large time at the end of the list. For example:
25582 </para>
25583 <literallayout class="monospaced">
25584 delay_warning = 2h:12h:99d
25585 </literallayout>
25586 <para>
25587 Note that the option is only evaluated at the time a delivery attempt fails,
25588 which depends on retry and queue-runner configuration.
25589 Typically retries will be configured more frequently than warning messages.
25590 </para>
25591 <para>
25592 <indexterm role="option">
25593 <primary><option>delay_warning_condition</option></primary>
25594 </indexterm>
25595 </para>
25596 <informaltable frame="all">
25597 <tgroup cols="4" colsep="0" rowsep="0">
25598 <colspec colwidth="8*" align="left"/>
25599 <colspec colwidth="6*" align="center"/>
25600 <colspec colwidth="6*" align="center"/>
25601 <colspec colwidth="6*" align="right"/>
25602 <tbody>
25603 <row>
25604 <entry><option>delay_warning_condition</option></entry>
25605 <entry>Use: <emphasis>main</emphasis></entry>
25606 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25607 <entry>Default: <emphasis>see below</emphasis></entry>
25608 </row>
25609 </tbody>
25610 </tgroup>
25611 </informaltable>
25612 <para>
25613 <indexterm role="variable">
25614 <primary><varname>$domain</varname></primary>
25615 </indexterm>
25616 The string is expanded at the time a warning message might be sent. If all the
25617 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
25618 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
25619 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
25620 <quote>false</quote> (the comparison being done caselessly) then the warning message is
25621 not sent. The default is:
25622 </para>
25623 <literallayout class="monospaced">
25624 delay_warning_condition = ${if or {\
25625   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
25626   { match{$h_precedence:}{(?i)bulk|list|junk} }\
25627   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
25628   } {no}{yes}}
25629 </literallayout>
25630 <para>
25631 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
25632 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
25633 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
25634 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
25635 </para>
25636 <para>
25637 <indexterm role="option">
25638 <primary><option>deliver_drop_privilege</option></primary>
25639 </indexterm>
25640 </para>
25641 <informaltable frame="all">
25642 <tgroup cols="4" colsep="0" rowsep="0">
25643 <colspec colwidth="8*" align="left"/>
25644 <colspec colwidth="6*" align="center"/>
25645 <colspec colwidth="6*" align="center"/>
25646 <colspec colwidth="6*" align="right"/>
25647 <tbody>
25648 <row>
25649 <entry><option>deliver_drop_privilege</option></entry>
25650 <entry>Use: <emphasis>main</emphasis></entry>
25651 <entry>Type: <emphasis>boolean</emphasis></entry>
25652 <entry>Default: <emphasis>false</emphasis></entry>
25653 </row>
25654 </tbody>
25655 </tgroup>
25656 </informaltable>
25657 <para>
25658 <indexterm role="concept">
25659 <primary>unprivileged delivery</primary>
25660 </indexterm>
25661 <indexterm role="concept">
25662 <primary>delivery</primary>
25663 <secondary>unprivileged</secondary>
25664 </indexterm>
25665 If this option is set true, Exim drops its root privilege at the start of a
25666 delivery process, and runs as the Exim user throughout. This severely restricts
25667 the kinds of local delivery that are possible, but is viable in certain types
25668 of configuration. There is a discussion about the use of root privilege in
25669 chapter <xref linkend="CHAPsecurity"/>.
25670 </para>
25671 <para>
25672 <indexterm role="option">
25673 <primary><option>deliver_queue_load_max</option></primary>
25674 </indexterm>
25675 </para>
25676 <informaltable frame="all">
25677 <tgroup cols="4" colsep="0" rowsep="0">
25678 <colspec colwidth="8*" align="left"/>
25679 <colspec colwidth="6*" align="center"/>
25680 <colspec colwidth="6*" align="center"/>
25681 <colspec colwidth="6*" align="right"/>
25682 <tbody>
25683 <row>
25684 <entry><option>deliver_queue_load_max</option></entry>
25685 <entry>Use: <emphasis>main</emphasis></entry>
25686 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25687 <entry>Default: <emphasis>unset</emphasis></entry>
25688 </row>
25689 </tbody>
25690 </tgroup>
25691 </informaltable>
25692 <para>
25693 <indexterm role="concept">
25694 <primary>load average</primary>
25695 </indexterm>
25696 <indexterm role="concept">
25697 <primary>queue runner</primary>
25698 <secondary>abandoning</secondary>
25699 </indexterm>
25700 When this option is set, a queue run is abandoned if the system load average
25701 becomes greater than the value of the option. The option has no effect on
25702 ancient operating systems on which Exim cannot determine the load average.
25703 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
25704 </para>
25705 <para>
25706 <indexterm role="option">
25707 <primary><option>delivery_date_remove</option></primary>
25708 </indexterm>
25709 </para>
25710 <informaltable frame="all">
25711 <tgroup cols="4" colsep="0" rowsep="0">
25712 <colspec colwidth="8*" align="left"/>
25713 <colspec colwidth="6*" align="center"/>
25714 <colspec colwidth="6*" align="center"/>
25715 <colspec colwidth="6*" align="right"/>
25716 <tbody>
25717 <row>
25718 <entry><option>delivery_date_remove</option></entry>
25719 <entry>Use: <emphasis>main</emphasis></entry>
25720 <entry>Type: <emphasis>boolean</emphasis></entry>
25721 <entry>Default: <emphasis>true</emphasis></entry>
25722 </row>
25723 </tbody>
25724 </tgroup>
25725 </informaltable>
25726 <para>
25727 <indexterm role="concept">
25728 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
25729 </indexterm>
25730 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
25731 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25732 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
25733 should not be present in incoming messages, and this option causes them to be
25734 removed at the time the message is received, to avoid any problems that might
25735 occur when a delivered message is subsequently sent on to some other recipient.
25736 </para>
25737 <para>
25738 <indexterm role="option">
25739 <primary><option>disable_fsync</option></primary>
25740 </indexterm>
25741 </para>
25742 <informaltable frame="all">
25743 <tgroup cols="4" colsep="0" rowsep="0">
25744 <colspec colwidth="8*" align="left"/>
25745 <colspec colwidth="6*" align="center"/>
25746 <colspec colwidth="6*" align="center"/>
25747 <colspec colwidth="6*" align="right"/>
25748 <tbody>
25749 <row>
25750 <entry><option>disable_fsync</option></entry>
25751 <entry>Use: <emphasis>main</emphasis></entry>
25752 <entry>Type: <emphasis>boolean</emphasis></entry>
25753 <entry>Default: <emphasis>false</emphasis></entry>
25754 </row>
25755 </tbody>
25756 </tgroup>
25757 </informaltable>
25758 <para>
25759 <indexterm role="concept">
25760 <primary><function>fsync()</function>, disabling</primary>
25761 </indexterm>
25762 This option is available only if Exim was built with the compile-time option
25763 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
25764 a runtime configuration generates an <quote>unknown option</quote> error. You should not
25765 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
25766 really, really, really understand what you are doing. <emphasis>No pre-compiled
25767 distributions of Exim should ever make this option available.</emphasis>
25768 </para>
25769 <para>
25770 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
25771 updated files&#x2019; data to be written to disc before continuing. Unexpected events
25772 such as crashes and power outages may cause data to be lost or scrambled.
25773 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
25774 </para>
25775 <para>
25776 <indexterm role="option">
25777 <primary><option>disable_ipv6</option></primary>
25778 </indexterm>
25779 </para>
25780 <informaltable frame="all">
25781 <tgroup cols="4" colsep="0" rowsep="0">
25782 <colspec colwidth="8*" align="left"/>
25783 <colspec colwidth="6*" align="center"/>
25784 <colspec colwidth="6*" align="center"/>
25785 <colspec colwidth="6*" align="right"/>
25786 <tbody>
25787 <row>
25788 <entry><option>disable_ipv6</option></entry>
25789 <entry>Use: <emphasis>main</emphasis></entry>
25790 <entry>Type: <emphasis>boolean</emphasis></entry>
25791 <entry>Default: <emphasis>false</emphasis></entry>
25792 </row>
25793 </tbody>
25794 </tgroup>
25795 </informaltable>
25796 <para>
25797 <indexterm role="concept">
25798 <primary>IPv6</primary>
25799 <secondary>disabling</secondary>
25800 </indexterm>
25801 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
25802 activities take place. AAAA records are never looked up, and any IPv6 addresses
25803 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
25804 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
25805 to handle IPv6 literal addresses.
25806 </para>
25807 <para revisionflag="changed">
25808 <indexterm role="option">
25809 <primary><option>dkim_verify_hashes</option></primary>
25810 </indexterm>
25811 </para>
25812 <informaltable frame="all" revisionflag="changed">
25813 <tgroup cols="4" colsep="0" rowsep="0">
25814 <colspec colwidth="8*" align="left"/>
25815 <colspec colwidth="6*" align="center"/>
25816 <colspec colwidth="6*" align="center"/>
25817 <colspec colwidth="6*" align="right"/>
25818 <tbody>
25819 <row>
25820 <entry><option>dkim_verify_hashes</option></entry>
25821 <entry>Use: <emphasis>main</emphasis></entry>
25822 <entry>Type: <emphasis>string list</emphasis></entry>
25823 <entry>Default: <emphasis>sha256 : sha512</emphasis></entry>
25824 </row>
25825 </tbody>
25826 </tgroup>
25827 </informaltable>
25828 <para revisionflag="changed">
25829 <indexterm role="concept">
25830 <primary>DKIM</primary>
25831 <secondary>selecting signature algorithms</secondary>
25832 </indexterm>
25833 This option gives a list of hash types which are acceptable in signatures,
25834 </para>
25835 <para>
25836 and an order of processing.
25837 Signatures with algorithms not in the list will be ignored.
25838 </para>
25839 <para>
25840 Acceptable values include:
25841 </para>
25842 <literallayout class="monospaced">
25843 sha1
25844 sha256
25845 sha512
25846 </literallayout>
25847 <para>
25848 Note that the acceptance of sha1 violates RFC 8301.
25849 </para>
25850 <para>
25851 <indexterm role="option">
25852 <primary><option>dkim_verify_keytypes</option></primary>
25853 </indexterm>
25854 </para>
25855 <informaltable frame="all">
25856 <tgroup cols="4" colsep="0" rowsep="0">
25857 <colspec colwidth="8*" align="left"/>
25858 <colspec colwidth="6*" align="center"/>
25859 <colspec colwidth="6*" align="center"/>
25860 <colspec colwidth="6*" align="right"/>
25861 <tbody>
25862 <row>
25863 <entry><option>dkim_verify_keytypes</option></entry>
25864 <entry>Use: <emphasis>main</emphasis></entry>
25865 <entry>Type: <emphasis>string list</emphasis></entry>
25866 <entry>Default: <emphasis>ed25519 : rsa</emphasis></entry>
25867 </row>
25868 </tbody>
25869 </tgroup>
25870 </informaltable>
25871 <para>
25872 This option gives a list of key types which are acceptable in signatures,
25873 and an order of processing.
25874 Signatures with algorithms not in the list will be ignored.
25875 </para>
25876 <para revisionflag="changed">
25877 <indexterm role="option">
25878 <primary><option>dkim_verify_min_keysizes</option></primary>
25879 </indexterm>
25880 </para>
25881 <informaltable frame="all" revisionflag="changed">
25882 <tgroup cols="4" colsep="0" rowsep="0">
25883 <colspec colwidth="8*" align="left"/>
25884 <colspec colwidth="6*" align="center"/>
25885 <colspec colwidth="6*" align="center"/>
25886 <colspec colwidth="6*" align="right"/>
25887 <tbody>
25888 <row>
25889 <entry><option>dkim_verify_min_keysizes</option></entry>
25890 <entry>Use: <emphasis>main</emphasis></entry>
25891 <entry>Type: <emphasis>string list</emphasis></entry>
25892 <entry>Default: <emphasis>rsa=1024 ed25519=250</emphasis></entry>
25893 </row>
25894 </tbody>
25895 </tgroup>
25896 </informaltable>
25897 <para revisionflag="changed">
25898 This option gives a list of key sizes which are acceptable in signatures.
25899 The list is keyed by the algorithm type for the key; the values are in bits.
25900 Signatures with keys smaller than given by this option will fail verification.
25901 </para>
25902 <para revisionflag="changed">
25903 The default enforces the RFC 8301 minimum key size for RSA signatures.
25904 </para>
25905 <para>
25906 <indexterm role="option">
25907 <primary><option>dkim_verify_minimal</option></primary>
25908 </indexterm>
25909 </para>
25910 <informaltable frame="all">
25911 <tgroup cols="4" colsep="0" rowsep="0">
25912 <colspec colwidth="8*" align="left"/>
25913 <colspec colwidth="6*" align="center"/>
25914 <colspec colwidth="6*" align="center"/>
25915 <colspec colwidth="6*" align="right"/>
25916 <tbody>
25917 <row>
25918 <entry><option>dkim_verify_minimal</option></entry>
25919 <entry>Use: <emphasis>main</emphasis></entry>
25920 <entry>Type: <emphasis>boolean</emphasis></entry>
25921 <entry>Default: <emphasis>false</emphasis></entry>
25922 </row>
25923 </tbody>
25924 </tgroup>
25925 </informaltable>
25926 <para>
25927 If set to true, verification of signatures will terminate after the
25928 first success.
25929 </para>
25930 <para>
25931 <indexterm role="option">
25932 <primary><option>dkim_verify_signers</option></primary>
25933 </indexterm>
25934 </para>
25935 <informaltable frame="all">
25936 <tgroup cols="4" colsep="0" rowsep="0">
25937 <colspec colwidth="8*" align="left"/>
25938 <colspec colwidth="6*" align="center"/>
25939 <colspec colwidth="6*" align="center"/>
25940 <colspec colwidth="6*" align="right"/>
25941 <tbody>
25942 <row>
25943 <entry><option>dkim_verify_signers</option></entry>
25944 <entry>Use: <emphasis>main</emphasis></entry>
25945 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25946 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
25947 </row>
25948 </tbody>
25949 </tgroup>
25950 </informaltable>
25951 <para>
25952 <indexterm role="concept">
25953 <primary>DKIM</primary>
25954 <secondary>controlling calls to the ACL</secondary>
25955 </indexterm>
25956 This option gives a list of DKIM domains for which the DKIM ACL is run.
25957 It is expanded after the message is received; by default it runs
25958 the ACL once for each signature in the message.
25959 See section <xref linkend="SECDKIMVFY"/>.
25960 </para>
25961 <para>
25962 <indexterm role="option">
25963 <primary><option>dmarc_forensic_sender</option></primary>
25964 </indexterm>
25965 </para>
25966 <informaltable frame="all">
25967 <tgroup cols="4" colsep="0" rowsep="0">
25968 <colspec colwidth="8*" align="left"/>
25969 <colspec colwidth="6*" align="center"/>
25970 <colspec colwidth="6*" align="center"/>
25971 <colspec colwidth="6*" align="right"/>
25972 <tbody>
25973 <row>
25974 <entry><option>dmarc_forensic_sender</option></entry>
25975 <entry>Use: <emphasis>main</emphasis></entry>
25976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25977 <entry>Default: <emphasis>unset</emphasis></entry>
25978 </row>
25979 </tbody>
25980 </tgroup>
25981 </informaltable>
25982 <para>
25983 <indexterm role="option">
25984 <primary><option>dmarc_history_file</option></primary>
25985 </indexterm>
25986 </para>
25987 <informaltable frame="all">
25988 <tgroup cols="4" colsep="0" rowsep="0">
25989 <colspec colwidth="8*" align="left"/>
25990 <colspec colwidth="6*" align="center"/>
25991 <colspec colwidth="6*" align="center"/>
25992 <colspec colwidth="6*" align="right"/>
25993 <tbody>
25994 <row>
25995 <entry><option>dmarc_history_file</option></entry>
25996 <entry>Use: <emphasis>main</emphasis></entry>
25997 <entry>Type: <emphasis>string</emphasis></entry>
25998 <entry>Default: <emphasis>unset</emphasis></entry>
25999 </row>
26000 </tbody>
26001 </tgroup>
26002 </informaltable>
26003 <para>
26004 <indexterm role="option">
26005 <primary><option>dmarc_tld_file</option></primary>
26006 </indexterm>
26007 </para>
26008 <informaltable frame="all">
26009 <tgroup cols="4" colsep="0" rowsep="0">
26010 <colspec colwidth="8*" align="left"/>
26011 <colspec colwidth="6*" align="center"/>
26012 <colspec colwidth="6*" align="center"/>
26013 <colspec colwidth="6*" align="right"/>
26014 <tbody>
26015 <row>
26016 <entry><option>dmarc_tld_file</option></entry>
26017 <entry>Use: <emphasis>main</emphasis></entry>
26018 <entry>Type: <emphasis>string</emphasis></entry>
26019 <entry>Default: <emphasis>unset</emphasis></entry>
26020 </row>
26021 </tbody>
26022 </tgroup>
26023 </informaltable>
26024 <para>
26025 <indexterm role="concept">
26026 <primary>DMARC</primary>
26027 <secondary>main section options</secondary>
26028 </indexterm>
26029 These options control DMARC processing.
26030 See section <xref linkend="SECDMARC"/> for details.
26031 </para>
26032 <para>
26033 <indexterm role="option">
26034 <primary><option>dns_again_means_nonexist</option></primary>
26035 </indexterm>
26036 </para>
26037 <informaltable frame="all">
26038 <tgroup cols="4" colsep="0" rowsep="0">
26039 <colspec colwidth="8*" align="left"/>
26040 <colspec colwidth="6*" align="center"/>
26041 <colspec colwidth="6*" align="center"/>
26042 <colspec colwidth="6*" align="right"/>
26043 <tbody>
26044 <row>
26045 <entry><option>dns_again_means_nonexist</option></entry>
26046 <entry>Use: <emphasis>main</emphasis></entry>
26047 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26048 <entry>Default: <emphasis>unset</emphasis></entry>
26049 </row>
26050 </tbody>
26051 </tgroup>
26052 </informaltable>
26053 <para>
26054 <indexterm role="concept">
26055 <primary>DNS</primary>
26056 <secondary><quote>try again</quote> response; overriding</secondary>
26057 </indexterm>
26058 DNS lookups give a <quote>try again</quote> response for the DNS errors
26059 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
26060 keep trying to deliver a message, or to give repeated temporary errors to
26061 incoming mail. Sometimes the effect is caused by a badly set up name server and
26062 may persist for a long time. If a domain which exhibits this problem matches
26063 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
26064 This option should be used with care. You can make it apply to reverse lookups
26065 by a setting such as this:
26066 </para>
26067 <literallayout class="monospaced">
26068 dns_again_means_nonexist = *.in-addr.arpa
26069 </literallayout>
26070 <para>
26071 This option applies to all DNS lookups that Exim does. It also applies when the
26072 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
26073 since these are most likely to be caused by DNS lookup problems. The
26074 <command>dnslookup</command> router has some options of its own for controlling what happens
26075 when lookups for MX or SRV records give temporary errors. These more specific
26076 options are applied after this global option.
26077 </para>
26078 <para>
26079 <indexterm role="option">
26080 <primary><option>dns_check_names_pattern</option></primary>
26081 </indexterm>
26082 </para>
26083 <informaltable frame="all">
26084 <tgroup cols="4" colsep="0" rowsep="0">
26085 <colspec colwidth="8*" align="left"/>
26086 <colspec colwidth="6*" align="center"/>
26087 <colspec colwidth="6*" align="center"/>
26088 <colspec colwidth="6*" align="right"/>
26089 <tbody>
26090 <row>
26091 <entry><option>dns_check_names_pattern</option></entry>
26092 <entry>Use: <emphasis>main</emphasis></entry>
26093 <entry>Type: <emphasis>string</emphasis></entry>
26094 <entry>Default: <emphasis>see below</emphasis></entry>
26095 </row>
26096 </tbody>
26097 </tgroup>
26098 </informaltable>
26099 <para>
26100 <indexterm role="concept">
26101 <primary>DNS</primary>
26102 <secondary>pre-check of name syntax</secondary>
26103 </indexterm>
26104 When this option is set to a non-empty string, it causes Exim to check domain
26105 names for characters that are not allowed in host names before handing them to
26106 the DNS resolver, because some resolvers give temporary errors for names that
26107 contain unusual characters. If a domain name contains any unwanted characters,
26108 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
26109 done by matching the domain name against a regular expression, which is the
26110 value of this option. The default pattern is
26111 </para>
26112 <literallayout class="monospaced">
26113 dns_check_names_pattern = \
26114   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
26115 </literallayout>
26116 <para>
26117 which permits only letters, digits, slashes, and hyphens in components, but
26118 they must start and end with a letter or digit. Slashes are not, in fact,
26119 permitted in host names, but they are found in certain NS records (which can be
26120 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
26121 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
26122 empty string.
26123 </para>
26124 <para>
26125 <indexterm role="option">
26126 <primary><option>dns_csa_search_limit</option></primary>
26127 </indexterm>
26128 </para>
26129 <informaltable frame="all">
26130 <tgroup cols="4" colsep="0" rowsep="0">
26131 <colspec colwidth="8*" align="left"/>
26132 <colspec colwidth="6*" align="center"/>
26133 <colspec colwidth="6*" align="center"/>
26134 <colspec colwidth="6*" align="right"/>
26135 <tbody>
26136 <row>
26137 <entry><option>dns_csa_search_limit</option></entry>
26138 <entry>Use: <emphasis>main</emphasis></entry>
26139 <entry>Type: <emphasis>integer</emphasis></entry>
26140 <entry>Default: <emphasis>5</emphasis></entry>
26141 </row>
26142 </tbody>
26143 </tgroup>
26144 </informaltable>
26145 <para>
26146 This option controls the depth of parental searching for CSA SRV records in the
26147 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
26148 </para>
26149 <para>
26150 <indexterm role="option">
26151 <primary><option>dns_csa_use_reverse</option></primary>
26152 </indexterm>
26153 </para>
26154 <informaltable frame="all">
26155 <tgroup cols="4" colsep="0" rowsep="0">
26156 <colspec colwidth="8*" align="left"/>
26157 <colspec colwidth="6*" align="center"/>
26158 <colspec colwidth="6*" align="center"/>
26159 <colspec colwidth="6*" align="right"/>
26160 <tbody>
26161 <row>
26162 <entry><option>dns_csa_use_reverse</option></entry>
26163 <entry>Use: <emphasis>main</emphasis></entry>
26164 <entry>Type: <emphasis>boolean</emphasis></entry>
26165 <entry>Default: <emphasis>true</emphasis></entry>
26166 </row>
26167 </tbody>
26168 </tgroup>
26169 </informaltable>
26170 <para>
26171 This option controls whether or not an IP address, given as a CSA domain, is
26172 reversed and looked up in the reverse DNS, as described in more detail in
26173 section <xref linkend="SECTverifyCSA"/>.
26174 </para>
26175 <para>
26176 <indexterm role="option">
26177 <primary><option>dns_cname_loops</option></primary>
26178 </indexterm>
26179 </para>
26180 <informaltable frame="all">
26181 <tgroup cols="4" colsep="0" rowsep="0">
26182 <colspec colwidth="8*" align="left"/>
26183 <colspec colwidth="6*" align="center"/>
26184 <colspec colwidth="6*" align="center"/>
26185 <colspec colwidth="6*" align="right"/>
26186 <tbody>
26187 <row>
26188 <entry><option>dns_cname_loops</option></entry>
26189 <entry>Use: <emphasis>main</emphasis></entry>
26190 <entry>Type: <emphasis>integer</emphasis></entry>
26191 <entry>Default: <emphasis>1</emphasis></entry>
26192 </row>
26193 </tbody>
26194 </tgroup>
26195 </informaltable>
26196 <para>
26197 <indexterm role="concept">
26198 <primary>DNS</primary>
26199 <secondary>CNAME following</secondary>
26200 </indexterm>
26201 This option controls the following of CNAME chains, needed if the resolver does
26202 not do it internally.
26203 As of 2018 most should, and the default can be left.
26204 If you have an ancient one, a value of 10 is likely needed.
26205 </para>
26206 <para>
26207 The default value of one CNAME-follow is needed
26208 thanks to the observed return for an MX request,
26209 given no MX presence but a CNAME to an A, of the CNAME.
26210 </para>
26211 <para>
26212 <indexterm role="option">
26213 <primary><option>dns_dnssec_ok</option></primary>
26214 </indexterm>
26215 </para>
26216 <informaltable frame="all">
26217 <tgroup cols="4" colsep="0" rowsep="0">
26218 <colspec colwidth="8*" align="left"/>
26219 <colspec colwidth="6*" align="center"/>
26220 <colspec colwidth="6*" align="center"/>
26221 <colspec colwidth="6*" align="right"/>
26222 <tbody>
26223 <row>
26224 <entry><option>dns_dnssec_ok</option></entry>
26225 <entry>Use: <emphasis>main</emphasis></entry>
26226 <entry>Type: <emphasis>integer</emphasis></entry>
26227 <entry>Default: <emphasis>-1</emphasis></entry>
26228 </row>
26229 </tbody>
26230 </tgroup>
26231 </informaltable>
26232 <para>
26233 <indexterm role="concept">
26234 <primary>DNS</primary>
26235 <secondary>resolver options</secondary>
26236 </indexterm>
26237 <indexterm role="concept">
26238 <primary>DNS</primary>
26239 <secondary>DNSSEC</secondary>
26240 </indexterm>
26241 If this option is set to a non-negative number then Exim will initialise the
26242 DNS resolver library to either use or not use DNSSEC, overriding the system
26243 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
26244 </para>
26245 <para>
26246 If the resolver library does not support DNSSEC then this option has no effect.
26247 </para>
26248 <para revisionflag="changed">
26249 On Linux with glibc 2.31 or newer this is insufficient, the resolver library
26250 will default to stripping out a successful validation status.
26251 This will break a previously working Exim installation.
26252 Provided that you do trust the resolver (ie, is on localhost) you can tell
26253 glibc to pass through any successful validation with a new option in
26254 <filename>/etc/resolv.conf</filename>:
26255 </para>
26256 <literallayout class="monospaced" revisionflag="changed">
26257 options trust-ad
26258 </literallayout>
26259 <para>
26260 <indexterm role="option">
26261 <primary><option>dns_ipv4_lookup</option></primary>
26262 </indexterm>
26263 </para>
26264 <informaltable frame="all">
26265 <tgroup cols="4" colsep="0" rowsep="0">
26266 <colspec colwidth="8*" align="left"/>
26267 <colspec colwidth="6*" align="center"/>
26268 <colspec colwidth="6*" align="center"/>
26269 <colspec colwidth="6*" align="right"/>
26270 <tbody>
26271 <row>
26272 <entry><option>dns_ipv4_lookup</option></entry>
26273 <entry>Use: <emphasis>main</emphasis></entry>
26274 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26275 <entry>Default: <emphasis>unset</emphasis></entry>
26276 </row>
26277 </tbody>
26278 </tgroup>
26279 </informaltable>
26280 <para>
26281 <indexterm role="concept">
26282 <primary>IPv6</primary>
26283 <secondary>DNS lookup for AAAA records</secondary>
26284 </indexterm>
26285 <indexterm role="concept">
26286 <primary>DNS</primary>
26287 <secondary>IPv6 lookup for AAAA records</secondary>
26288 </indexterm>
26289 <indexterm role="concept">
26290 <primary>DNS</primary>
26291 <secondary>IPv6 disabling</secondary>
26292 </indexterm>
26293 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
26294 looks for IPv6 address records (AAAA records) as well as IPv4 address records
26295 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
26296 domain matches this list.
26297 </para>
26298 <para>
26299 This is a fudge to help with name servers that give big delays or otherwise do
26300 not work for the AAAA record type. In due course, when the world&#x2019;s name
26301 servers have all been upgraded, there should be no need for this option.
26302 Note that all lookups, including those done for verification, are affected;
26303 this will result in verify failure for IPv6 connections or ones using names
26304 only valid for IPv6 addresses.
26305 </para>
26306 <para>
26307 <indexterm role="option">
26308 <primary><option>dns_retrans</option></primary>
26309 </indexterm>
26310 </para>
26311 <informaltable frame="all">
26312 <tgroup cols="4" colsep="0" rowsep="0">
26313 <colspec colwidth="8*" align="left"/>
26314 <colspec colwidth="6*" align="center"/>
26315 <colspec colwidth="6*" align="center"/>
26316 <colspec colwidth="6*" align="right"/>
26317 <tbody>
26318 <row>
26319 <entry><option>dns_retrans</option></entry>
26320 <entry>Use: <emphasis>main</emphasis></entry>
26321 <entry>Type: <emphasis>time</emphasis></entry>
26322 <entry>Default: <emphasis>0s</emphasis></entry>
26323 </row>
26324 </tbody>
26325 </tgroup>
26326 </informaltable>
26327 <para>
26328 <indexterm role="concept">
26329 <primary>DNS</primary>
26330 <secondary>resolver options</secondary>
26331 </indexterm>
26332 <indexterm role="concept">
26333 <primary>timeout</primary>
26334 <secondary>dns lookup</secondary>
26335 </indexterm>
26336 <indexterm role="concept">
26337 <primary>DNS</primary>
26338 <secondary>timeout</secondary>
26339 </indexterm>
26340 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
26341 retransmission and retry parameters for DNS lookups. Values of zero (the
26342 defaults) leave the system default settings unchanged. The first value is the
26343 time between retries, and the second is the number of retries. It isn&#x2019;t
26344 totally clear exactly how these settings affect the total time a DNS lookup may
26345 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
26346 parameter values are available in the external resolver interface structure,
26347 but nowhere does it seem to describe how they are used or what you might want
26348 to set in them.
26349 See also the <option>slow_lookup_log</option> option.
26350 </para>
26351 <para>
26352 <indexterm role="option">
26353 <primary><option>dns_retry</option></primary>
26354 </indexterm>
26355 </para>
26356 <informaltable frame="all">
26357 <tgroup cols="4" colsep="0" rowsep="0">
26358 <colspec colwidth="8*" align="left"/>
26359 <colspec colwidth="6*" align="center"/>
26360 <colspec colwidth="6*" align="center"/>
26361 <colspec colwidth="6*" align="right"/>
26362 <tbody>
26363 <row>
26364 <entry><option>dns_retry</option></entry>
26365 <entry>Use: <emphasis>main</emphasis></entry>
26366 <entry>Type: <emphasis>integer</emphasis></entry>
26367 <entry>Default: <emphasis>0</emphasis></entry>
26368 </row>
26369 </tbody>
26370 </tgroup>
26371 </informaltable>
26372 <para>
26373 See <option>dns_retrans</option> above.
26374 </para>
26375 <para>
26376 <indexterm role="option">
26377 <primary><option>dns_trust_aa</option></primary>
26378 </indexterm>
26379 </para>
26380 <informaltable frame="all">
26381 <tgroup cols="4" colsep="0" rowsep="0">
26382 <colspec colwidth="8*" align="left"/>
26383 <colspec colwidth="6*" align="center"/>
26384 <colspec colwidth="6*" align="center"/>
26385 <colspec colwidth="6*" align="right"/>
26386 <tbody>
26387 <row>
26388 <entry><option>dns_trust_aa</option></entry>
26389 <entry>Use: <emphasis>main</emphasis></entry>
26390 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26391 <entry>Default: <emphasis>unset</emphasis></entry>
26392 </row>
26393 </tbody>
26394 </tgroup>
26395 </informaltable>
26396 <para>
26397 <indexterm role="concept">
26398 <primary>DNS</primary>
26399 <secondary>resolver options</secondary>
26400 </indexterm>
26401 <indexterm role="concept">
26402 <primary>DNS</primary>
26403 <secondary>DNSSEC</secondary>
26404 </indexterm>
26405 If this option is set then lookup results marked with the AA bit
26406 (Authoritative Answer) are trusted the same way as if they were
26407 DNSSEC-verified. The authority section&#x2019;s name of the answer must
26408 match with this expanded domain list.
26409 </para>
26410 <para>
26411 Use this option only if you talk directly to a resolver that is
26412 authoritative for some zones and does not set the AD (Authentic Data)
26413 bit in the answer. Some DNS servers may have an configuration option to
26414 mark the answers from their own zones as verified (they set the AD bit).
26415 Others do not have this option. It is considered as poor practice using
26416 a resolver that is an authoritative server for some zones.
26417 </para>
26418 <para>
26419 Use this option only if you really have to (e.g. if you want
26420 to use DANE for remote delivery to a server that is listed in the DNS
26421 zones that your resolver is authoritative for).
26422 </para>
26423 <para>
26424 If the DNS answer packet has the AA bit set and contains resource record
26425 in the answer section, the name of the first NS record appearing in the
26426 authority section is compared against the list. If the answer packet is
26427 authoritative but the answer section is empty, the name of the first SOA
26428 record in the authoritative section is used instead.
26429 </para>
26430 <para>
26431 <indexterm role="concept">
26432 <primary>DNS</primary>
26433 <secondary>resolver options</secondary>
26434 </indexterm>
26435 <indexterm role="option">
26436 <primary><option>dns_use_edns0</option></primary>
26437 </indexterm>
26438 </para>
26439 <informaltable frame="all">
26440 <tgroup cols="4" colsep="0" rowsep="0">
26441 <colspec colwidth="8*" align="left"/>
26442 <colspec colwidth="6*" align="center"/>
26443 <colspec colwidth="6*" align="center"/>
26444 <colspec colwidth="6*" align="right"/>
26445 <tbody>
26446 <row>
26447 <entry><option>dns_use_edns0</option></entry>
26448 <entry>Use: <emphasis>main</emphasis></entry>
26449 <entry>Type: <emphasis>integer</emphasis></entry>
26450 <entry>Default: <emphasis>-1</emphasis></entry>
26451 </row>
26452 </tbody>
26453 </tgroup>
26454 </informaltable>
26455 <para>
26456 <indexterm role="concept">
26457 <primary>DNS</primary>
26458 <secondary>resolver options</secondary>
26459 </indexterm>
26460 <indexterm role="concept">
26461 <primary>DNS</primary>
26462 <secondary>EDNS0</secondary>
26463 </indexterm>
26464 <indexterm role="concept">
26465 <primary>DNS</primary>
26466 <secondary>OpenBSD</secondary>
26467 </indexterm>
26468 If this option is set to a non-negative number then Exim will initialise the
26469 DNS resolver library to either use or not use EDNS0 extensions, overriding
26470 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
26471 on.
26472 </para>
26473 <para>
26474 If the resolver library does not support EDNS0 then this option has no effect.
26475 </para>
26476 <para>
26477 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
26478 means that DNSSEC will not work with Exim on that platform either, unless Exim
26479 is linked against an alternative DNS client library.
26480 </para>
26481 <para>
26482 <indexterm role="option">
26483 <primary><option>drop_cr</option></primary>
26484 </indexterm>
26485 </para>
26486 <informaltable frame="all">
26487 <tgroup cols="4" colsep="0" rowsep="0">
26488 <colspec colwidth="8*" align="left"/>
26489 <colspec colwidth="6*" align="center"/>
26490 <colspec colwidth="6*" align="center"/>
26491 <colspec colwidth="6*" align="right"/>
26492 <tbody>
26493 <row>
26494 <entry><option>drop_cr</option></entry>
26495 <entry>Use: <emphasis>main</emphasis></entry>
26496 <entry>Type: <emphasis>boolean</emphasis></entry>
26497 <entry>Default: <emphasis>false</emphasis></entry>
26498 </row>
26499 </tbody>
26500 </tgroup>
26501 </informaltable>
26502 <para>
26503 This is an obsolete option that is now a no-op. It used to affect the way Exim
26504 handled CR and LF characters in incoming messages. What happens now is
26505 described in section <xref linkend="SECTlineendings"/>.
26506 </para>
26507 <para>
26508 <indexterm role="option">
26509 <primary><option>dsn_advertise_hosts</option></primary>
26510 </indexterm>
26511 </para>
26512 <informaltable frame="all">
26513 <tgroup cols="4" colsep="0" rowsep="0">
26514 <colspec colwidth="8*" align="left"/>
26515 <colspec colwidth="6*" align="center"/>
26516 <colspec colwidth="6*" align="center"/>
26517 <colspec colwidth="6*" align="right"/>
26518 <tbody>
26519 <row>
26520 <entry><option>dsn_advertise_hosts</option></entry>
26521 <entry>Use: <emphasis>main</emphasis></entry>
26522 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26523 <entry>Default: <emphasis>unset</emphasis></entry>
26524 </row>
26525 </tbody>
26526 </tgroup>
26527 </informaltable>
26528 <para>
26529 <indexterm role="concept">
26530 <primary>bounce messages</primary>
26531 <secondary>success</secondary>
26532 </indexterm>
26533 <indexterm role="concept">
26534 <primary>DSN</primary>
26535 <secondary>success</secondary>
26536 </indexterm>
26537 <indexterm role="concept">
26538 <primary>Delivery Status Notification</primary>
26539 <secondary>success</secondary>
26540 </indexterm>
26541 <indexterm role="concept">
26542 <primary>ESMTP extensions</primary>
26543 <secondary>DSN</secondary>
26544 </indexterm>
26545 DSN extensions (RFC3461) will be advertised in the EHLO message to,
26546 and accepted from, these hosts.
26547 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
26548 and RET and ORCPT options on MAIL FROM commands.
26549 A NOTIFY=SUCCESS option requests success-DSN messages.
26550 A NOTIFY= option with no argument requests that no delay or failure DSNs
26551 are sent.
26552 </para>
26553 <para revisionflag="changed">
26554 <emphasis role="bold">Note</emphasis>: Supplying success-DSN messages has been criticised
26555 on privacy grounds; it can leak details of internal forwarding.
26556 </para>
26557 <para>
26558 <indexterm role="option">
26559 <primary><option>dsn_from</option></primary>
26560 </indexterm>
26561 </para>
26562 <informaltable frame="all">
26563 <tgroup cols="4" colsep="0" rowsep="0">
26564 <colspec colwidth="8*" align="left"/>
26565 <colspec colwidth="6*" align="center"/>
26566 <colspec colwidth="6*" align="center"/>
26567 <colspec colwidth="6*" align="right"/>
26568 <tbody>
26569 <row>
26570 <entry><option>dsn_from</option></entry>
26571 <entry>Use: <emphasis>main</emphasis></entry>
26572 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26573 <entry>Default: <emphasis>see below</emphasis></entry>
26574 </row>
26575 </tbody>
26576 </tgroup>
26577 </informaltable>
26578 <para>
26579 <indexterm role="concept">
26580 <primary><emphasis>From:</emphasis> header line</primary>
26581 <secondary>in bounces</secondary>
26582 </indexterm>
26583 <indexterm role="concept">
26584 <primary>bounce messages</primary>
26585 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
26586 </indexterm>
26587 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
26588 bounces and other automatically generated messages (<quote>Delivery Status
26589 Notifications</quote> &ndash; hence the name of the option). The default setting is:
26590 </para>
26591 <literallayout class="monospaced">
26592 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
26593 </literallayout>
26594 <para>
26595 The value is expanded every time it is needed. If the expansion fails, a
26596 panic is logged, and the default value is used.
26597 </para>
26598 <para>
26599 <indexterm role="option">
26600 <primary><option>envelope_to_remove</option></primary>
26601 </indexterm>
26602 </para>
26603 <informaltable frame="all">
26604 <tgroup cols="4" colsep="0" rowsep="0">
26605 <colspec colwidth="8*" align="left"/>
26606 <colspec colwidth="6*" align="center"/>
26607 <colspec colwidth="6*" align="center"/>
26608 <colspec colwidth="6*" align="right"/>
26609 <tbody>
26610 <row>
26611 <entry><option>envelope_to_remove</option></entry>
26612 <entry>Use: <emphasis>main</emphasis></entry>
26613 <entry>Type: <emphasis>boolean</emphasis></entry>
26614 <entry>Default: <emphasis>true</emphasis></entry>
26615 </row>
26616 </tbody>
26617 </tgroup>
26618 </informaltable>
26619 <para>
26620 <indexterm role="concept">
26621 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
26622 </indexterm>
26623 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
26624 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
26625 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
26626 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
26627 be present in incoming messages, and this option causes them to be removed at
26628 the time the message is received, to avoid any problems that might occur when a
26629 delivered message is subsequently sent on to some other recipient.
26630 </para>
26631 <para>
26632 <indexterm role="option">
26633 <primary><option>errors_copy</option></primary>
26634 </indexterm>
26635 </para>
26636 <informaltable frame="all">
26637 <tgroup cols="4" colsep="0" rowsep="0">
26638 <colspec colwidth="8*" align="left"/>
26639 <colspec colwidth="6*" align="center"/>
26640 <colspec colwidth="6*" align="center"/>
26641 <colspec colwidth="6*" align="right"/>
26642 <tbody>
26643 <row>
26644 <entry><option>errors_copy</option></entry>
26645 <entry>Use: <emphasis>main</emphasis></entry>
26646 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26647 <entry>Default: <emphasis>unset</emphasis></entry>
26648 </row>
26649 </tbody>
26650 </tgroup>
26651 </informaltable>
26652 <para>
26653 <indexterm role="concept">
26654 <primary>bounce message</primary>
26655 <secondary>copy to other address</secondary>
26656 </indexterm>
26657 <indexterm role="concept">
26658 <primary>copy of bounce message</primary>
26659 </indexterm>
26660 Setting this option causes Exim to send bcc copies of bounce messages that it
26661 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
26662 coming from elsewhere. The value of the option is a colon-separated list of
26663 items. Each item consists of a pattern, terminated by white space, followed by
26664 a comma-separated list of email addresses. If a pattern contains spaces, it
26665 must be enclosed in double quotes.
26666 </para>
26667 <para>
26668 Each pattern is processed in the same way as a single item in an address list
26669 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
26670 the bounce message, the message is copied to the addresses on the list. The
26671 items are scanned in order, and once a matching one is found, no further items
26672 are examined. For example:
26673 </para>
26674 <literallayout class="monospaced">
26675 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
26676               rqps@mydomain   hostmaster@mydomain.example,\
26677                               postmaster@mydomain.example
26678 </literallayout>
26679 <para>
26680 <indexterm role="variable">
26681 <primary><varname>$domain</varname></primary>
26682 </indexterm>
26683 <indexterm role="variable">
26684 <primary><varname>$local_part</varname></primary>
26685 </indexterm>
26686 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
26687 and <varname>$domain</varname> are set from the original recipient of the error message, and if
26688 there was any wildcard matching in the pattern, the expansion
26689 <indexterm role="concept">
26690 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
26691 <secondary>in <option>errors_copy</option></secondary>
26692 </indexterm>
26693 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
26694 </para>
26695 <para>
26696 <indexterm role="option">
26697 <primary><option>errors_reply_to</option></primary>
26698 </indexterm>
26699 </para>
26700 <informaltable frame="all">
26701 <tgroup cols="4" colsep="0" rowsep="0">
26702 <colspec colwidth="8*" align="left"/>
26703 <colspec colwidth="6*" align="center"/>
26704 <colspec colwidth="6*" align="center"/>
26705 <colspec colwidth="6*" align="right"/>
26706 <tbody>
26707 <row>
26708 <entry><option>errors_reply_to</option></entry>
26709 <entry>Use: <emphasis>main</emphasis></entry>
26710 <entry>Type: <emphasis>string</emphasis></entry>
26711 <entry>Default: <emphasis>unset</emphasis></entry>
26712 </row>
26713 </tbody>
26714 </tgroup>
26715 </informaltable>
26716 <para>
26717 <indexterm role="concept">
26718 <primary>bounce message</primary>
26719 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
26720 </indexterm>
26721 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
26722 </para>
26723 <literallayout>
26724 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
26725 </literallayout>
26726 <para>
26727 <indexterm role="option">
26728 <primary><option>quota_warn_message</option></primary>
26729 </indexterm>
26730 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
26731 A warning message that is generated by the <option>quota_warn_message</option> option in an
26732 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
26733 overrides the default.
26734 </para>
26735 <para>
26736 Experience shows that people reply to bounce messages. If the
26737 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
26738 and warning messages. For example:
26739 </para>
26740 <literallayout class="monospaced">
26741 errors_reply_to = postmaster@my.domain.example
26742 </literallayout>
26743 <para>
26744 The value of the option is not expanded. It must specify a valid RFC 2822
26745 address. However, if a warning message that is generated by the
26746 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
26747 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
26748 not used.
26749 </para>
26750 <para>
26751 <indexterm role="option">
26752 <primary><option>event_action</option></primary>
26753 </indexterm>
26754 </para>
26755 <informaltable frame="all">
26756 <tgroup cols="4" colsep="0" rowsep="0">
26757 <colspec colwidth="8*" align="left"/>
26758 <colspec colwidth="6*" align="center"/>
26759 <colspec colwidth="6*" align="center"/>
26760 <colspec colwidth="6*" align="right"/>
26761 <tbody>
26762 <row>
26763 <entry><option>event_action</option></entry>
26764 <entry>Use: <emphasis>main</emphasis></entry>
26765 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26766 <entry>Default: <emphasis>unset</emphasis></entry>
26767 </row>
26768 </tbody>
26769 </tgroup>
26770 </informaltable>
26771 <para>
26772 <indexterm role="concept">
26773 <primary>events</primary>
26774 </indexterm>
26775 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
26776 For details see chapter <xref linkend="CHAPevents"/>.
26777 </para>
26778 <para>
26779 <indexterm role="option">
26780 <primary><option>exim_group</option></primary>
26781 </indexterm>
26782 </para>
26783 <informaltable frame="all">
26784 <tgroup cols="4" colsep="0" rowsep="0">
26785 <colspec colwidth="8*" align="left"/>
26786 <colspec colwidth="6*" align="center"/>
26787 <colspec colwidth="6*" align="center"/>
26788 <colspec colwidth="6*" align="right"/>
26789 <tbody>
26790 <row>
26791 <entry><option>exim_group</option></entry>
26792 <entry>Use: <emphasis>main</emphasis></entry>
26793 <entry>Type: <emphasis>string</emphasis></entry>
26794 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
26795 </row>
26796 </tbody>
26797 </tgroup>
26798 </informaltable>
26799 <para>
26800 <indexterm role="concept">
26801 <primary>gid (group id)</primary>
26802 <secondary>Exim&#x2019;s own</secondary>
26803 </indexterm>
26804 <indexterm role="concept">
26805 <primary>Exim group</primary>
26806 </indexterm>
26807 This option changes the gid under which Exim runs when it gives up root
26808 privilege. The default value is compiled into the binary. The value of this
26809 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
26810 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
26811 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
26812 security issues.
26813 </para>
26814 <para>
26815 <indexterm role="option">
26816 <primary><option>exim_path</option></primary>
26817 </indexterm>
26818 </para>
26819 <informaltable frame="all">
26820 <tgroup cols="4" colsep="0" rowsep="0">
26821 <colspec colwidth="8*" align="left"/>
26822 <colspec colwidth="6*" align="center"/>
26823 <colspec colwidth="6*" align="center"/>
26824 <colspec colwidth="6*" align="right"/>
26825 <tbody>
26826 <row>
26827 <entry><option>exim_path</option></entry>
26828 <entry>Use: <emphasis>main</emphasis></entry>
26829 <entry>Type: <emphasis>string</emphasis></entry>
26830 <entry>Default: <emphasis>see below</emphasis></entry>
26831 </row>
26832 </tbody>
26833 </tgroup>
26834 </informaltable>
26835 <para>
26836 <indexterm role="concept">
26837 <primary>Exim binary, path name</primary>
26838 </indexterm>
26839 This option specifies the path name of the Exim binary, which is used when Exim
26840 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
26841 the directory configured at compile time by the BIN_DIRECTORY setting. It
26842 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
26843 other place.
26844 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
26845 you will break those Exim utilities that scan the configuration file to find
26846 where the binary is. (They then use the <option>-bP</option> option to extract option
26847 settings such as the value of <option>spool_directory</option>.)
26848 </para>
26849 <para>
26850 <indexterm role="option">
26851 <primary><option>exim_user</option></primary>
26852 </indexterm>
26853 </para>
26854 <informaltable frame="all">
26855 <tgroup cols="4" colsep="0" rowsep="0">
26856 <colspec colwidth="8*" align="left"/>
26857 <colspec colwidth="6*" align="center"/>
26858 <colspec colwidth="6*" align="center"/>
26859 <colspec colwidth="6*" align="right"/>
26860 <tbody>
26861 <row>
26862 <entry><option>exim_user</option></entry>
26863 <entry>Use: <emphasis>main</emphasis></entry>
26864 <entry>Type: <emphasis>string</emphasis></entry>
26865 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
26866 </row>
26867 </tbody>
26868 </tgroup>
26869 </informaltable>
26870 <para>
26871 <indexterm role="concept">
26872 <primary>uid (user id)</primary>
26873 <secondary>Exim&#x2019;s own</secondary>
26874 </indexterm>
26875 <indexterm role="concept">
26876 <primary>Exim user</primary>
26877 </indexterm>
26878 This option changes the uid under which Exim runs when it gives up root
26879 privilege. The default value is compiled into the binary. Ownership of the run
26880 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
26881 options is checked against the values in the binary, not what is set here.
26882 </para>
26883 <para>
26884 Unless it consists entirely of digits, the string is looked up using
26885 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
26886 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
26887 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
26888 </para>
26889 <para>
26890 <indexterm role="option">
26891 <primary><option>exim_version</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_version</option></entry>
26903 <entry>Use: <emphasis>main</emphasis></entry>
26904 <entry>Type: <emphasis>string</emphasis></entry>
26905 <entry>Default: <emphasis>current version</emphasis></entry>
26906 </row>
26907 </tbody>
26908 </tgroup>
26909 </informaltable>
26910 <para>
26911 <indexterm role="concept">
26912 <primary>Exim version</primary>
26913 </indexterm>
26914 <indexterm role="concept">
26915 <primary>customizing</primary>
26916 <secondary>version number</secondary>
26917 </indexterm>
26918 <indexterm role="concept">
26919 <primary>version number of Exim</primary>
26920 <secondary>override</secondary>
26921 </indexterm>
26922 This option overrides the <varname>$version_number</varname>/<varname>$exim_version</varname> that Exim reports in
26923 various places.  Use with care; this may fool stupid security scanners.
26924 </para>
26925 <para>
26926 <indexterm role="option">
26927 <primary><option>extra_local_interfaces</option></primary>
26928 </indexterm>
26929 </para>
26930 <informaltable frame="all">
26931 <tgroup cols="4" colsep="0" rowsep="0">
26932 <colspec colwidth="8*" align="left"/>
26933 <colspec colwidth="6*" align="center"/>
26934 <colspec colwidth="6*" align="center"/>
26935 <colspec colwidth="6*" align="right"/>
26936 <tbody>
26937 <row>
26938 <entry><option>extra_local_interfaces</option></entry>
26939 <entry>Use: <emphasis>main</emphasis></entry>
26940 <entry>Type: <emphasis>string list</emphasis></entry>
26941 <entry>Default: <emphasis>unset</emphasis></entry>
26942 </row>
26943 </tbody>
26944 </tgroup>
26945 </informaltable>
26946 <para>
26947 This option defines network interfaces that are to be considered local when
26948 routing, but which are not used for listening by the daemon. See section
26949 <xref linkend="SECTreclocipadd"/> for details.
26950 </para>
26951 <para>
26952 <indexterm role="option">
26953 <primary><option>extract_addresses_remove_arguments</option></primary>
26954 </indexterm>
26955 </para>
26956 <informaltable frame="all">
26957 <tgroup cols="4" colsep="0" rowsep="0">
26958 <colspec colwidth="8*" align="left"/>
26959 <colspec colwidth="6*" align="center"/>
26960 <colspec colwidth="6*" align="center"/>
26961 <colspec colwidth="6*" align="right"/>
26962 <tbody>
26963 <row>
26964 <entry><option>extract_addresses_remove_arguments</option></entry>
26965 <entry>Use: <emphasis>main</emphasis></entry>
26966 <entry>Type: <emphasis>boolean</emphasis></entry>
26967 <entry>Default: <emphasis>true</emphasis></entry>
26968 </row>
26969 </tbody>
26970 </tgroup>
26971 </informaltable>
26972 <para>
26973 <indexterm role="option">
26974 <primary><option>-t</option></primary>
26975 </indexterm>
26976 <indexterm role="concept">
26977 <primary>command line</primary>
26978 <secondary>addresses with <option>-t</option></secondary>
26979 </indexterm>
26980 <indexterm role="concept">
26981 <primary>Sendmail compatibility</primary>
26982 <secondary><option>-t</option> option</secondary>
26983 </indexterm>
26984 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
26985 are present on the command line when the <option>-t</option> option is used to build an
26986 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
26987 line addresses are removed from the recipients list. This is also how Smail
26988 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
26989 command line addresses are added to those obtained from the header lines. When
26990 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
26991 argument headers. If it is set false, Exim adds rather than removes argument
26992 addresses.
26993 </para>
26994 <para>
26995 <indexterm role="option">
26996 <primary><option>finduser_retries</option></primary>
26997 </indexterm>
26998 </para>
26999 <informaltable frame="all">
27000 <tgroup cols="4" colsep="0" rowsep="0">
27001 <colspec colwidth="8*" align="left"/>
27002 <colspec colwidth="6*" align="center"/>
27003 <colspec colwidth="6*" align="center"/>
27004 <colspec colwidth="6*" align="right"/>
27005 <tbody>
27006 <row>
27007 <entry><option>finduser_retries</option></entry>
27008 <entry>Use: <emphasis>main</emphasis></entry>
27009 <entry>Type: <emphasis>integer</emphasis></entry>
27010 <entry>Default: <emphasis>0</emphasis></entry>
27011 </row>
27012 </tbody>
27013 </tgroup>
27014 </informaltable>
27015 <para>
27016 <indexterm role="concept">
27017 <primary>NIS, retrying user lookups</primary>
27018 </indexterm>
27019 On systems running NIS or other schemes in which user and group information is
27020 distributed from a remote system, there can be times when <function>getpwnam()</function> and
27021 related functions fail, even when given valid data, because things time out.
27022 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
27023 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
27024 many extra times to find a user or a group, waiting for one second between
27025 retries.
27026 </para>
27027 <para>
27028 <indexterm role="concept">
27029 <primary><filename>/etc/passwd</filename></primary>
27030 <secondary>multiple reading of</secondary>
27031 </indexterm>
27032 You should not set this option greater than zero if your user information is in
27033 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
27034 search the file multiple times for non-existent users, and also cause delay.
27035 </para>
27036 <para>
27037 <indexterm role="option">
27038 <primary><option>freeze_tell</option></primary>
27039 </indexterm>
27040 </para>
27041 <informaltable frame="all">
27042 <tgroup cols="4" colsep="0" rowsep="0">
27043 <colspec colwidth="8*" align="left"/>
27044 <colspec colwidth="6*" align="center"/>
27045 <colspec colwidth="6*" align="center"/>
27046 <colspec colwidth="6*" align="right"/>
27047 <tbody>
27048 <row>
27049 <entry><option>freeze_tell</option></entry>
27050 <entry>Use: <emphasis>main</emphasis></entry>
27051 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
27052 <entry>Default: <emphasis>unset</emphasis></entry>
27053 </row>
27054 </tbody>
27055 </tgroup>
27056 </informaltable>
27057 <para>
27058 <indexterm role="concept">
27059 <primary>freezing messages</primary>
27060 <secondary>sending a message when freezing</secondary>
27061 </indexterm>
27062 On encountering certain errors, or when configured to do so in a system filter,
27063 ACL, or special router, Exim freezes a message. This means that no further
27064 delivery attempts take place until an administrator thaws the message, or the
27065 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
27066 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
27067 warning message whenever it freezes something, unless the message it is
27068 freezing is a locally-generated bounce message. (Without this exception there
27069 is the possibility of looping.) The warning message is sent to the addresses
27070 supplied as the comma-separated value of this option. If several of the
27071 message&#x2019;s addresses cause freezing, only a single message is sent. If the
27072 freezing was automatic, the reason(s) for freezing can be found in the message
27073 log. If you configure freezing in a filter or ACL, you must arrange for any
27074 logging that you require.
27075 </para>
27076 <para>
27077 <indexterm role="option">
27078 <primary><option>gecos_name</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>gecos_name</option></entry>
27090 <entry>Use: <emphasis>main</emphasis></entry>
27091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></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>HP-UX</primary>
27100 </indexterm>
27101 <indexterm role="concept">
27102 <primary><quote>gecos</quote> field, parsing</primary>
27103 </indexterm>
27104 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
27105 password file to hold other information in addition to users&#x2019; real names. Exim
27106 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
27107 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
27108 of the field are used unchanged, except that, if an ampersand is encountered,
27109 it is replaced by the user&#x2019;s login name with the first character forced to
27110 upper case, since this is a convention that is observed on many systems.
27111 </para>
27112 <para>
27113 When these options are set, <option>gecos_pattern</option> is treated as a regular
27114 expression that is to be applied to the field (again with &amp; replaced by the
27115 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
27116 user&#x2019;s name.
27117 </para>
27118 <para>
27119 <indexterm role="concept">
27120 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
27121 <secondary>in <option>gecos_name</option></secondary>
27122 </indexterm>
27123 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
27124 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
27125 name terminates at the first comma, the following can be used:
27126 </para>
27127 <literallayout class="monospaced">
27128 gecos_pattern = ([^,]*)
27129 gecos_name = $1
27130 </literallayout>
27131 <para>
27132 <indexterm role="option">
27133 <primary><option>gecos_pattern</option></primary>
27134 </indexterm>
27135 </para>
27136 <informaltable frame="all">
27137 <tgroup cols="4" colsep="0" rowsep="0">
27138 <colspec colwidth="8*" align="left"/>
27139 <colspec colwidth="6*" align="center"/>
27140 <colspec colwidth="6*" align="center"/>
27141 <colspec colwidth="6*" align="right"/>
27142 <tbody>
27143 <row>
27144 <entry><option>gecos_pattern</option></entry>
27145 <entry>Use: <emphasis>main</emphasis></entry>
27146 <entry>Type: <emphasis>string</emphasis></entry>
27147 <entry>Default: <emphasis>unset</emphasis></entry>
27148 </row>
27149 </tbody>
27150 </tgroup>
27151 </informaltable>
27152 <para>
27153 See <option>gecos_name</option> above.
27154 </para>
27155 <para>
27156 <indexterm role="option">
27157 <primary><option>gnutls_compat_mode</option></primary>
27158 </indexterm>
27159 </para>
27160 <informaltable frame="all">
27161 <tgroup cols="4" colsep="0" rowsep="0">
27162 <colspec colwidth="8*" align="left"/>
27163 <colspec colwidth="6*" align="center"/>
27164 <colspec colwidth="6*" align="center"/>
27165 <colspec colwidth="6*" align="right"/>
27166 <tbody>
27167 <row>
27168 <entry><option>gnutls_compat_mode</option></entry>
27169 <entry>Use: <emphasis>main</emphasis></entry>
27170 <entry>Type: <emphasis>boolean</emphasis></entry>
27171 <entry>Default: <emphasis>unset</emphasis></entry>
27172 </row>
27173 </tbody>
27174 </tgroup>
27175 </informaltable>
27176 <para>
27177 This option controls whether GnuTLS is used in compatibility mode in an Exim
27178 server. This reduces security slightly, but improves interworking with older
27179 implementations of TLS.
27180 </para>
27181 <para>
27182 <indexterm role="option">
27183 <primary><option>gnutls_allow_auto_pkcs11</option></primary>
27184 </indexterm>
27185 </para>
27186 <informaltable frame="all">
27187 <tgroup cols="4" colsep="0" rowsep="0">
27188 <colspec colwidth="8*" align="left"/>
27189 <colspec colwidth="6*" align="center"/>
27190 <colspec colwidth="6*" align="center"/>
27191 <colspec colwidth="6*" align="right"/>
27192 <tbody>
27193 <row>
27194 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
27195 <entry>Use: <emphasis>main</emphasis></entry>
27196 <entry>Type: <emphasis>boolean</emphasis></entry>
27197 <entry>Default: <emphasis>unset</emphasis></entry>
27198 </row>
27199 </tbody>
27200 </tgroup>
27201 </informaltable>
27202 <para>
27203 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
27204 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
27205 </para>
27206 <para>
27207 See
27208 <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>
27209 for documentation.
27210 </para>
27211 <para>
27212 <indexterm role="option">
27213 <primary><option>headers_charset</option></primary>
27214 </indexterm>
27215 </para>
27216 <informaltable frame="all">
27217 <tgroup cols="4" colsep="0" rowsep="0">
27218 <colspec colwidth="8*" align="left"/>
27219 <colspec colwidth="6*" align="center"/>
27220 <colspec colwidth="6*" align="center"/>
27221 <colspec colwidth="6*" align="right"/>
27222 <tbody>
27223 <row>
27224 <entry><option>headers_charset</option></entry>
27225 <entry>Use: <emphasis>main</emphasis></entry>
27226 <entry>Type: <emphasis>string</emphasis></entry>
27227 <entry>Default: <emphasis>see below</emphasis></entry>
27228 </row>
27229 </tbody>
27230 </tgroup>
27231 </informaltable>
27232 <para>
27233 This option sets a default character set for translating from encoded MIME
27234 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
27235 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
27236 ultimate default is ISO-8859-1. For more details see the description of header
27237 insertions in section <xref linkend="SECTexpansionitems"/>.
27238 </para>
27239 <para>
27240 <indexterm role="option">
27241 <primary><option>header_maxsize</option></primary>
27242 </indexterm>
27243 </para>
27244 <informaltable frame="all">
27245 <tgroup cols="4" colsep="0" rowsep="0">
27246 <colspec colwidth="8*" align="left"/>
27247 <colspec colwidth="6*" align="center"/>
27248 <colspec colwidth="6*" align="center"/>
27249 <colspec colwidth="6*" align="right"/>
27250 <tbody>
27251 <row>
27252 <entry><option>header_maxsize</option></entry>
27253 <entry>Use: <emphasis>main</emphasis></entry>
27254 <entry>Type: <emphasis>integer</emphasis></entry>
27255 <entry>Default: <emphasis>see below</emphasis></entry>
27256 </row>
27257 </tbody>
27258 </tgroup>
27259 </informaltable>
27260 <para>
27261 <indexterm role="concept">
27262 <primary>header section</primary>
27263 <secondary>maximum size of</secondary>
27264 </indexterm>
27265 <indexterm role="concept">
27266 <primary>limit</primary>
27267 <secondary>size of message header section</secondary>
27268 </indexterm>
27269 This option controls the overall maximum size of a message&#x2019;s header
27270 section. The default is the value of HEADER_MAXSIZE in
27271 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
27272 sections are rejected.
27273 </para>
27274 <para>
27275 <indexterm role="option">
27276 <primary><option>header_line_maxsize</option></primary>
27277 </indexterm>
27278 </para>
27279 <informaltable frame="all">
27280 <tgroup cols="4" colsep="0" rowsep="0">
27281 <colspec colwidth="8*" align="left"/>
27282 <colspec colwidth="6*" align="center"/>
27283 <colspec colwidth="6*" align="center"/>
27284 <colspec colwidth="6*" align="right"/>
27285 <tbody>
27286 <row>
27287 <entry><option>header_line_maxsize</option></entry>
27288 <entry>Use: <emphasis>main</emphasis></entry>
27289 <entry>Type: <emphasis>integer</emphasis></entry>
27290 <entry>Default: <emphasis>0</emphasis></entry>
27291 </row>
27292 </tbody>
27293 </tgroup>
27294 </informaltable>
27295 <para>
27296 <indexterm role="concept">
27297 <primary>header lines</primary>
27298 <secondary>maximum size of</secondary>
27299 </indexterm>
27300 <indexterm role="concept">
27301 <primary>limit</primary>
27302 <secondary>size of one header line</secondary>
27303 </indexterm>
27304 This option limits the length of any individual header line in a message, after
27305 all the continuations have been joined together. Messages with individual
27306 header lines that are longer than the limit are rejected. The default value of
27307 zero means <quote>no limit</quote>.
27308 </para>
27309 <para>
27310 <indexterm role="option">
27311 <primary><option>helo_accept_junk_hosts</option></primary>
27312 </indexterm>
27313 </para>
27314 <informaltable frame="all">
27315 <tgroup cols="4" colsep="0" rowsep="0">
27316 <colspec colwidth="8*" align="left"/>
27317 <colspec colwidth="6*" align="center"/>
27318 <colspec colwidth="6*" align="center"/>
27319 <colspec colwidth="6*" align="right"/>
27320 <tbody>
27321 <row>
27322 <entry><option>helo_accept_junk_hosts</option></entry>
27323 <entry>Use: <emphasis>main</emphasis></entry>
27324 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27325 <entry>Default: <emphasis>unset</emphasis></entry>
27326 </row>
27327 </tbody>
27328 </tgroup>
27329 </informaltable>
27330 <para>
27331 <indexterm role="concept">
27332 <primary>HELO</primary>
27333 <secondary>accepting junk data</secondary>
27334 </indexterm>
27335 <indexterm role="concept">
27336 <primary>EHLO</primary>
27337 <secondary>accepting junk data</secondary>
27338 </indexterm>
27339 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
27340 mail, and gives an error response for invalid data. Unfortunately, there are
27341 some SMTP clients that send syntactic junk. They can be accommodated by setting
27342 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
27343 if you want to do semantic checking.
27344 See also <option>helo_allow_chars</option> for a way of extending the permitted character
27345 set.
27346 </para>
27347 <para>
27348 <indexterm role="option">
27349 <primary><option>helo_allow_chars</option></primary>
27350 </indexterm>
27351 </para>
27352 <informaltable frame="all">
27353 <tgroup cols="4" colsep="0" rowsep="0">
27354 <colspec colwidth="8*" align="left"/>
27355 <colspec colwidth="6*" align="center"/>
27356 <colspec colwidth="6*" align="center"/>
27357 <colspec colwidth="6*" align="right"/>
27358 <tbody>
27359 <row>
27360 <entry><option>helo_allow_chars</option></entry>
27361 <entry>Use: <emphasis>main</emphasis></entry>
27362 <entry>Type: <emphasis>string</emphasis></entry>
27363 <entry>Default: <emphasis>unset</emphasis></entry>
27364 </row>
27365 </tbody>
27366 </tgroup>
27367 </informaltable>
27368 <para>
27369 <indexterm role="concept">
27370 <primary>HELO</primary>
27371 <secondary>underscores in</secondary>
27372 </indexterm>
27373 <indexterm role="concept">
27374 <primary>EHLO</primary>
27375 <secondary>underscores in</secondary>
27376 </indexterm>
27377 <indexterm role="concept">
27378 <primary>underscore in EHLO/HELO</primary>
27379 </indexterm>
27380 This option can be set to a string of rogue characters that are permitted in
27381 all EHLO and HELO names in addition to the standard letters, digits,
27382 hyphens, and dots. If you really must allow underscores, you can set
27383 </para>
27384 <literallayout class="monospaced">
27385 helo_allow_chars = _
27386 </literallayout>
27387 <para>
27388 Note that the value is one string, not a list.
27389 </para>
27390 <para>
27391 <indexterm role="option">
27392 <primary><option>helo_lookup_domains</option></primary>
27393 </indexterm>
27394 </para>
27395 <informaltable frame="all">
27396 <tgroup cols="4" colsep="0" rowsep="0">
27397 <colspec colwidth="8*" align="left"/>
27398 <colspec colwidth="6*" align="center"/>
27399 <colspec colwidth="6*" align="center"/>
27400 <colspec colwidth="6*" align="right"/>
27401 <tbody>
27402 <row>
27403 <entry><option>helo_lookup_domains</option></entry>
27404 <entry>Use: <emphasis>main</emphasis></entry>
27405 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27406 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
27407 </row>
27408 </tbody>
27409 </tgroup>
27410 </informaltable>
27411 <para>
27412 <indexterm role="concept">
27413 <primary>HELO</primary>
27414 <secondary>forcing reverse lookup</secondary>
27415 </indexterm>
27416 <indexterm role="concept">
27417 <primary>EHLO</primary>
27418 <secondary>forcing reverse lookup</secondary>
27419 </indexterm>
27420 If the domain given by a client in a HELO or EHLO command matches this
27421 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
27422 default forces a lookup if the client host gives the server&#x2019;s name or any of
27423 its IP addresses (in brackets), something that broken clients have been seen to
27424 do.
27425 </para>
27426 <para>
27427 <indexterm role="option">
27428 <primary><option>helo_try_verify_hosts</option></primary>
27429 </indexterm>
27430 </para>
27431 <informaltable frame="all">
27432 <tgroup cols="4" colsep="0" rowsep="0">
27433 <colspec colwidth="8*" align="left"/>
27434 <colspec colwidth="6*" align="center"/>
27435 <colspec colwidth="6*" align="center"/>
27436 <colspec colwidth="6*" align="right"/>
27437 <tbody>
27438 <row>
27439 <entry><option>helo_try_verify_hosts</option></entry>
27440 <entry>Use: <emphasis>main</emphasis></entry>
27441 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27442 <entry>Default: <emphasis>unset</emphasis></entry>
27443 </row>
27444 </tbody>
27445 </tgroup>
27446 </informaltable>
27447 <para>
27448 <indexterm role="concept">
27449 <primary>HELO verifying</primary>
27450 <secondary>optional</secondary>
27451 </indexterm>
27452 <indexterm role="concept">
27453 <primary>EHLO</primary>
27454 <secondary>verifying, optional</secondary>
27455 </indexterm>
27456 By default, Exim just checks the syntax of HELO and EHLO commands (see
27457 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
27458 to do more extensive checking of the data supplied by these commands. The ACL
27459 condition <literal>verify = helo</literal> is provided to make this possible.
27460 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
27461 to force the check to occur. From release 4.53 onwards, this is no longer
27462 necessary. If the check has not been done before <literal>verify = helo</literal> is
27463 encountered, it is done at that time. Consequently, this option is obsolete.
27464 Its specification is retained here for backwards compatibility.
27465 </para>
27466 <para>
27467 When an EHLO or HELO command is received, if the calling host matches
27468 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
27469 EHLO command either:
27470 </para>
27471 <itemizedlist>
27472 <listitem>
27473 <para>
27474 is an IP literal matching the calling address of the host, or
27475 </para>
27476 </listitem>
27477 <listitem>
27478 <para>
27479 <indexterm role="concept">
27480 <primary>DNS</primary>
27481 <secondary>reverse lookup</secondary>
27482 </indexterm>
27483 <indexterm role="concept">
27484 <primary>reverse DNS lookup</primary>
27485 </indexterm>
27486 matches the host name that Exim obtains by doing a reverse lookup of the
27487 calling host address, or
27488 </para>
27489 </listitem>
27490 <listitem>
27491 <para>
27492 when looked up in DNS yields the calling host address.
27493 </para>
27494 </listitem>
27495 </itemizedlist>
27496 <para>
27497 However, the EHLO or HELO command is not rejected if any of the checks
27498 fail. Processing continues, but the result of the check is remembered, and can
27499 be detected later in an ACL by the <literal>verify = helo</literal> condition.
27500 </para>
27501 <para>
27502 If DNS was used for successful verification, the variable
27503 <indexterm role="concept">
27504 <primary>DNS</primary>
27505 <secondary>DNSSEC</secondary>
27506 </indexterm>
27507 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
27508 </para>
27509 <para>
27510 <indexterm role="option">
27511 <primary><option>helo_verify_hosts</option></primary>
27512 </indexterm>
27513 </para>
27514 <informaltable frame="all">
27515 <tgroup cols="4" colsep="0" rowsep="0">
27516 <colspec colwidth="8*" align="left"/>
27517 <colspec colwidth="6*" align="center"/>
27518 <colspec colwidth="6*" align="center"/>
27519 <colspec colwidth="6*" align="right"/>
27520 <tbody>
27521 <row>
27522 <entry><option>helo_verify_hosts</option></entry>
27523 <entry>Use: <emphasis>main</emphasis></entry>
27524 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27525 <entry>Default: <emphasis>unset</emphasis></entry>
27526 </row>
27527 </tbody>
27528 </tgroup>
27529 </informaltable>
27530 <para>
27531 <indexterm role="concept">
27532 <primary>HELO verifying</primary>
27533 <secondary>mandatory</secondary>
27534 </indexterm>
27535 <indexterm role="concept">
27536 <primary>EHLO</primary>
27537 <secondary>verifying, mandatory</secondary>
27538 </indexterm>
27539 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
27540 backwards compatibility. For hosts that match this option, Exim checks the host
27541 name given in the HELO or EHLO in the same way as for
27542 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
27543 rejected with a 550 error, and entries are written to the main and reject logs.
27544 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
27545 error.
27546 </para>
27547 <para>
27548 <indexterm role="option">
27549 <primary><option>hold_domains</option></primary>
27550 </indexterm>
27551 </para>
27552 <informaltable frame="all">
27553 <tgroup cols="4" colsep="0" rowsep="0">
27554 <colspec colwidth="8*" align="left"/>
27555 <colspec colwidth="6*" align="center"/>
27556 <colspec colwidth="6*" align="center"/>
27557 <colspec colwidth="6*" align="right"/>
27558 <tbody>
27559 <row>
27560 <entry><option>hold_domains</option></entry>
27561 <entry>Use: <emphasis>main</emphasis></entry>
27562 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27563 <entry>Default: <emphasis>unset</emphasis></entry>
27564 </row>
27565 </tbody>
27566 </tgroup>
27567 </informaltable>
27568 <para>
27569 <indexterm role="concept">
27570 <primary>domain</primary>
27571 <secondary>delaying delivery</secondary>
27572 </indexterm>
27573 <indexterm role="concept">
27574 <primary>delivery</primary>
27575 <secondary>delaying certain domains</secondary>
27576 </indexterm>
27577 This option allows mail for particular domains to be held in the queue
27578 manually. The option is overridden if a message delivery is forced with the
27579 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
27580 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
27581 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
27582 it is deferred every time the message is looked at.
27583 </para>
27584 <para>
27585 This option is intended as a temporary operational measure for delaying the
27586 delivery of mail while some problem is being sorted out, or some new
27587 configuration tested. If you just want to delay the processing of some
27588 domains until a queue run occurs, you should use <option>queue_domains</option> or
27589 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
27590 </para>
27591 <para>
27592 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
27593 messages from the queue if they have been there longer than the longest retry
27594 time in any retry rule. If you want to hold messages for longer than the normal
27595 retry times, insert a dummy retry rule with a long retry time.
27596 </para>
27597 <para>
27598 <indexterm role="option">
27599 <primary><option>host_lookup</option></primary>
27600 </indexterm>
27601 </para>
27602 <informaltable frame="all">
27603 <tgroup cols="4" colsep="0" rowsep="0">
27604 <colspec colwidth="8*" align="left"/>
27605 <colspec colwidth="6*" align="center"/>
27606 <colspec colwidth="6*" align="center"/>
27607 <colspec colwidth="6*" align="right"/>
27608 <tbody>
27609 <row>
27610 <entry><option>host_lookup</option></entry>
27611 <entry>Use: <emphasis>main</emphasis></entry>
27612 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27613 <entry>Default: <emphasis>unset</emphasis></entry>
27614 </row>
27615 </tbody>
27616 </tgroup>
27617 </informaltable>
27618 <para>
27619 <indexterm role="concept">
27620 <primary>host name</primary>
27621 <secondary>lookup, forcing</secondary>
27622 </indexterm>
27623 Exim does not look up the name of a calling host from its IP address unless it
27624 is required to compare against some host list, or the host matches
27625 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
27626 option (which normally contains IP addresses rather than host names). The
27627 default configuration file contains
27628 </para>
27629 <literallayout class="monospaced">
27630 host_lookup = *
27631 </literallayout>
27632 <para>
27633 which causes a lookup to happen for all hosts. If the expense of these lookups
27634 is felt to be too great, the setting can be changed or removed.
27635 </para>
27636 <para>
27637 After a successful reverse lookup, Exim does a forward lookup on the name it
27638 has obtained, to verify that it yields the IP address that it started with. If
27639 this check fails, Exim behaves as if the name lookup failed.
27640 </para>
27641 <para>
27642 <indexterm role="variable">
27643 <primary><varname>$host_lookup_failed</varname></primary>
27644 </indexterm>
27645 <indexterm role="variable">
27646 <primary><varname>$sender_host_name</varname></primary>
27647 </indexterm>
27648 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
27649 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
27650 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
27651 <literal>verify = reverse_host_lookup</literal> in ACLs.
27652 </para>
27653 <para>
27654 <indexterm role="option">
27655 <primary><option>host_lookup_order</option></primary>
27656 </indexterm>
27657 </para>
27658 <informaltable frame="all">
27659 <tgroup cols="4" colsep="0" rowsep="0">
27660 <colspec colwidth="8*" align="left"/>
27661 <colspec colwidth="6*" align="center"/>
27662 <colspec colwidth="6*" align="center"/>
27663 <colspec colwidth="6*" align="right"/>
27664 <tbody>
27665 <row>
27666 <entry><option>host_lookup_order</option></entry>
27667 <entry>Use: <emphasis>main</emphasis></entry>
27668 <entry>Type: <emphasis>string list</emphasis></entry>
27669 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
27670 </row>
27671 </tbody>
27672 </tgroup>
27673 </informaltable>
27674 <para>
27675 This option specifies the order of different lookup methods when Exim is trying
27676 to find a host name from an IP address. The default is to do a DNS lookup
27677 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
27678 if that fails. You can change the order of these lookups, or omit one entirely,
27679 if you want.
27680 </para>
27681 <para>
27682 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
27683 multiple PTR records in the DNS and the IP address is not listed in
27684 <filename>/etc/hosts</filename>. Different operating systems give different results in this
27685 case. That is why the default tries a DNS lookup first.
27686 </para>
27687 <para>
27688 <indexterm role="option">
27689 <primary><option>host_reject_connection</option></primary>
27690 </indexterm>
27691 </para>
27692 <informaltable frame="all">
27693 <tgroup cols="4" colsep="0" rowsep="0">
27694 <colspec colwidth="8*" align="left"/>
27695 <colspec colwidth="6*" align="center"/>
27696 <colspec colwidth="6*" align="center"/>
27697 <colspec colwidth="6*" align="right"/>
27698 <tbody>
27699 <row>
27700 <entry><option>host_reject_connection</option></entry>
27701 <entry>Use: <emphasis>main</emphasis></entry>
27702 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27703 <entry>Default: <emphasis>unset</emphasis></entry>
27704 </row>
27705 </tbody>
27706 </tgroup>
27707 </informaltable>
27708 <para>
27709 <indexterm role="concept">
27710 <primary>host</primary>
27711 <secondary>rejecting connections from</secondary>
27712 </indexterm>
27713 If this option is set, incoming SMTP calls from the hosts listed are rejected
27714 as soon as the connection is made.
27715 This option is obsolete, and retained only for backward compatibility, because
27716 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
27717 connections immediately.
27718 </para>
27719 <para>
27720 The ability to give an immediate rejection (either by this option or using an
27721 ACL) is provided for use in unusual cases. Many hosts will just try again,
27722 sometimes without much delay. Normally, it is better to use an ACL to reject
27723 incoming messages at a later stage, such as after RCPT commands. See
27724 chapter <xref linkend="CHAPACL"/>.
27725 </para>
27726 <para>
27727 <indexterm role="option">
27728 <primary><option>hosts_connection_nolog</option></primary>
27729 </indexterm>
27730 </para>
27731 <informaltable frame="all">
27732 <tgroup cols="4" colsep="0" rowsep="0">
27733 <colspec colwidth="8*" align="left"/>
27734 <colspec colwidth="6*" align="center"/>
27735 <colspec colwidth="6*" align="center"/>
27736 <colspec colwidth="6*" align="right"/>
27737 <tbody>
27738 <row>
27739 <entry><option>hosts_connection_nolog</option></entry>
27740 <entry>Use: <emphasis>main</emphasis></entry>
27741 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27742 <entry>Default: <emphasis>unset</emphasis></entry>
27743 </row>
27744 </tbody>
27745 </tgroup>
27746 </informaltable>
27747 <para>
27748 <indexterm role="concept">
27749 <primary>host</primary>
27750 <secondary>not logging connections from</secondary>
27751 </indexterm>
27752 This option defines a list of hosts for which connection logging does not
27753 happen, even though the <option>smtp_connection</option> log selector is set. For example,
27754 you might want not to log SMTP connections from local processes, or from
27755 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
27756 the daemon; you should therefore strive to restrict its value to a short inline
27757 list of IP addresses and networks. To disable logging SMTP connections from
27758 local processes, you must create a host list with an empty item. For example:
27759 </para>
27760 <literallayout class="monospaced">
27761 hosts_connection_nolog = :
27762 </literallayout>
27763 <para>
27764 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
27765 </para>
27766 <para>
27767 <indexterm role="option">
27768 <primary><option>hosts_proxy</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_proxy</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>proxy</primary>
27790 <secondary>proxy protocol</secondary>
27791 </indexterm>
27792 This option enables use of Proxy Protocol proxies for incoming
27793 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
27794 </para>
27795 <para>
27796 <indexterm role="option">
27797 <primary><option>hosts_treat_as_local</option></primary>
27798 </indexterm>
27799 </para>
27800 <informaltable frame="all">
27801 <tgroup cols="4" colsep="0" rowsep="0">
27802 <colspec colwidth="8*" align="left"/>
27803 <colspec colwidth="6*" align="center"/>
27804 <colspec colwidth="6*" align="center"/>
27805 <colspec colwidth="6*" align="right"/>
27806 <tbody>
27807 <row>
27808 <entry><option>hosts_treat_as_local</option></entry>
27809 <entry>Use: <emphasis>main</emphasis></entry>
27810 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27811 <entry>Default: <emphasis>unset</emphasis></entry>
27812 </row>
27813 </tbody>
27814 </tgroup>
27815 </informaltable>
27816 <para>
27817 <indexterm role="concept">
27818 <primary>local host</primary>
27819 <secondary>domains treated as</secondary>
27820 </indexterm>
27821 <indexterm role="concept">
27822 <primary>host</primary>
27823 <secondary>treated as local</secondary>
27824 </indexterm>
27825 If this option is set, any host names that match the domain list are treated as
27826 if they were the local host when Exim is scanning host lists obtained from MX
27827 records
27828 or other sources. Note that the value of this option is a domain list, not a
27829 host list, because it is always used to check host names, not IP addresses.
27830 </para>
27831 <para>
27832 This option also applies when Exim is matching the special items
27833 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
27834 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
27835 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
27836 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
27837 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
27838 interfaces and recognizing the local host.
27839 </para>
27840 <para>
27841 <indexterm role="option">
27842 <primary><option>ibase_servers</option></primary>
27843 </indexterm>
27844 </para>
27845 <informaltable frame="all">
27846 <tgroup cols="4" colsep="0" rowsep="0">
27847 <colspec colwidth="8*" align="left"/>
27848 <colspec colwidth="6*" align="center"/>
27849 <colspec colwidth="6*" align="center"/>
27850 <colspec colwidth="6*" align="right"/>
27851 <tbody>
27852 <row>
27853 <entry><option>ibase_servers</option></entry>
27854 <entry>Use: <emphasis>main</emphasis></entry>
27855 <entry>Type: <emphasis>string list</emphasis></entry>
27856 <entry>Default: <emphasis>unset</emphasis></entry>
27857 </row>
27858 </tbody>
27859 </tgroup>
27860 </informaltable>
27861 <para>
27862 <indexterm role="concept">
27863 <primary>InterBase</primary>
27864 <secondary>server list</secondary>
27865 </indexterm>
27866 This option provides a list of InterBase servers and associated connection data,
27867 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
27868 The option is available only if Exim has been built with InterBase support.
27869 </para>
27870 <para>
27871 <indexterm role="option">
27872 <primary><option>ignore_bounce_errors_after</option></primary>
27873 </indexterm>
27874 </para>
27875 <informaltable frame="all">
27876 <tgroup cols="4" colsep="0" rowsep="0">
27877 <colspec colwidth="8*" align="left"/>
27878 <colspec colwidth="6*" align="center"/>
27879 <colspec colwidth="6*" align="center"/>
27880 <colspec colwidth="6*" align="right"/>
27881 <tbody>
27882 <row>
27883 <entry><option>ignore_bounce_errors_after</option></entry>
27884 <entry>Use: <emphasis>main</emphasis></entry>
27885 <entry>Type: <emphasis>time</emphasis></entry>
27886 <entry>Default: <emphasis>10w</emphasis></entry>
27887 </row>
27888 </tbody>
27889 </tgroup>
27890 </informaltable>
27891 <para>
27892 <indexterm role="concept">
27893 <primary>bounce message</primary>
27894 <secondary>discarding</secondary>
27895 </indexterm>
27896 <indexterm role="concept">
27897 <primary>discarding bounce message</primary>
27898 </indexterm>
27899 This option affects the processing of bounce messages that cannot be delivered,
27900 that is, those that suffer a permanent delivery failure. (Bounce messages that
27901 suffer temporary delivery failures are of course retried in the usual way.)
27902 </para>
27903 <para>
27904 After a permanent delivery failure, bounce messages are frozen,
27905 because there is no sender to whom they can be returned. When a frozen bounce
27906 message has been in the queue for more than the given time, it is unfrozen at
27907 the next queue run, and a further delivery is attempted. If delivery fails
27908 again, the bounce message is discarded. This makes it possible to keep failed
27909 bounce messages around for a shorter time than the normal maximum retry time
27910 for frozen messages. For example,
27911 </para>
27912 <literallayout class="monospaced">
27913 ignore_bounce_errors_after = 12h
27914 </literallayout>
27915 <para>
27916 retries failed bounce message deliveries after 12 hours, discarding any further
27917 failures. If the value of this option is set to a zero time period, bounce
27918 failures are discarded immediately. Setting a very long time (as in the default
27919 value) has the effect of disabling this option. For ways of automatically
27920 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
27921 <option>timeout_frozen_after</option>.
27922 </para>
27923 <para>
27924 <indexterm role="option">
27925 <primary><option>ignore_fromline_hosts</option></primary>
27926 </indexterm>
27927 </para>
27928 <informaltable frame="all">
27929 <tgroup cols="4" colsep="0" rowsep="0">
27930 <colspec colwidth="8*" align="left"/>
27931 <colspec colwidth="6*" align="center"/>
27932 <colspec colwidth="6*" align="center"/>
27933 <colspec colwidth="6*" align="right"/>
27934 <tbody>
27935 <row>
27936 <entry><option>ignore_fromline_hosts</option></entry>
27937 <entry>Use: <emphasis>main</emphasis></entry>
27938 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27939 <entry>Default: <emphasis>unset</emphasis></entry>
27940 </row>
27941 </tbody>
27942 </tgroup>
27943 </informaltable>
27944 <para>
27945 <indexterm role="concept">
27946 <primary><quote>From</quote> line</primary>
27947 </indexterm>
27948 <indexterm role="concept">
27949 <primary>UUCP</primary>
27950 <secondary><quote>From</quote> line</secondary>
27951 </indexterm>
27952 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
27953 the headers of a message. By default this is treated as the start of the
27954 message&#x2019;s body, which means that any following headers are not recognized as
27955 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
27956 match those hosts that insist on sending it. If the sender is actually a local
27957 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
27958 <option>ignore_fromline_local</option> must be set to achieve this effect.
27959 </para>
27960 <para>
27961 <indexterm role="option">
27962 <primary><option>ignore_fromline_local</option></primary>
27963 </indexterm>
27964 </para>
27965 <informaltable frame="all">
27966 <tgroup cols="4" colsep="0" rowsep="0">
27967 <colspec colwidth="8*" align="left"/>
27968 <colspec colwidth="6*" align="center"/>
27969 <colspec colwidth="6*" align="center"/>
27970 <colspec colwidth="6*" align="right"/>
27971 <tbody>
27972 <row>
27973 <entry><option>ignore_fromline_local</option></entry>
27974 <entry>Use: <emphasis>main</emphasis></entry>
27975 <entry>Type: <emphasis>boolean</emphasis></entry>
27976 <entry>Default: <emphasis>false</emphasis></entry>
27977 </row>
27978 </tbody>
27979 </tgroup>
27980 </informaltable>
27981 <para>
27982 See <option>ignore_fromline_hosts</option> above.
27983 </para>
27984 <para>
27985 <indexterm role="option">
27986 <primary><option>keep_environment</option></primary>
27987 </indexterm>
27988 </para>
27989 <informaltable frame="all">
27990 <tgroup cols="4" colsep="0" rowsep="0">
27991 <colspec colwidth="8*" align="left"/>
27992 <colspec colwidth="6*" align="center"/>
27993 <colspec colwidth="6*" align="center"/>
27994 <colspec colwidth="6*" align="right"/>
27995 <tbody>
27996 <row>
27997 <entry><option>keep_environment</option></entry>
27998 <entry>Use: <emphasis>main</emphasis></entry>
27999 <entry>Type: <emphasis>string list</emphasis></entry>
28000 <entry>Default: <emphasis>unset</emphasis></entry>
28001 </row>
28002 </tbody>
28003 </tgroup>
28004 </informaltable>
28005 <para>
28006 <indexterm role="concept">
28007 <primary>environment</primary>
28008 <secondary>values from</secondary>
28009 </indexterm>
28010 This option contains a string list of environment variables to keep.
28011 You have to trust these variables or you have to be sure that
28012 these variables do not impose any security risk. Keep in mind that
28013 during the startup phase Exim is running with an effective UID 0 in most
28014 installations. As the default value is an empty list, the default
28015 environment for using libraries, running embedded Perl code, or running
28016 external binaries is empty, and does not not even contain PATH or HOME.
28017 </para>
28018 <para>
28019 Actually the list is interpreted as a list of patterns
28020 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
28021 </para>
28022 <para>
28023 WARNING: Macro substitution is still done first, so having a macro
28024 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
28025 unexpected results. You may work around this using a regular expression
28026 that does not match the macro name: ^[F]OO_HOME$.
28027 </para>
28028 <para>
28029 Current versions of Exim issue a warning during startup if you do not mention
28030 <option>keep_environment</option> in your runtime configuration file and if your
28031 current environment is not empty. Future versions may not issue that warning
28032 anymore.
28033 </para>
28034 <para>
28035 See the <option>add_environment</option> main config option for a way to set
28036 environment variables to a fixed value.  The environment for <command>pipe</command>
28037 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
28038 details.
28039 </para>
28040 <para>
28041 <indexterm role="option">
28042 <primary><option>keep_malformed</option></primary>
28043 </indexterm>
28044 </para>
28045 <informaltable frame="all">
28046 <tgroup cols="4" colsep="0" rowsep="0">
28047 <colspec colwidth="8*" align="left"/>
28048 <colspec colwidth="6*" align="center"/>
28049 <colspec colwidth="6*" align="center"/>
28050 <colspec colwidth="6*" align="right"/>
28051 <tbody>
28052 <row>
28053 <entry><option>keep_malformed</option></entry>
28054 <entry>Use: <emphasis>main</emphasis></entry>
28055 <entry>Type: <emphasis>time</emphasis></entry>
28056 <entry>Default: <emphasis>4d</emphasis></entry>
28057 </row>
28058 </tbody>
28059 </tgroup>
28060 </informaltable>
28061 <para>
28062 This option specifies the length of time to keep messages whose spool files
28063 have been corrupted in some way. This should, of course, never happen. At the
28064 next attempt to deliver such a message, it gets removed. The incident is
28065 logged.
28066 </para>
28067 <para>
28068 <indexterm role="option">
28069 <primary><option>ldap_ca_cert_dir</option></primary>
28070 </indexterm>
28071 </para>
28072 <informaltable frame="all">
28073 <tgroup cols="4" colsep="0" rowsep="0">
28074 <colspec colwidth="8*" align="left"/>
28075 <colspec colwidth="6*" align="center"/>
28076 <colspec colwidth="6*" align="center"/>
28077 <colspec colwidth="6*" align="right"/>
28078 <tbody>
28079 <row>
28080 <entry><option>ldap_ca_cert_dir</option></entry>
28081 <entry>Use: <emphasis>main</emphasis></entry>
28082 <entry>Type: <emphasis>string</emphasis></entry>
28083 <entry>Default: <emphasis>unset</emphasis></entry>
28084 </row>
28085 </tbody>
28086 </tgroup>
28087 </informaltable>
28088 <para>
28089 <indexterm role="concept">
28090 <primary>LDAP</primary>
28091 <secondary>,</secondary>
28092 </indexterm>
28093 <indexterm role="concept">
28094 <primary>certificate</primary>
28095 <secondary>directory for LDAP</secondary>
28096 </indexterm>
28097 This option indicates which directory contains CA certificates for verifying
28098 a TLS certificate presented by an LDAP server.
28099 While Exim does not provide a default value, your SSL library may.
28100 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
28101 and constrained to be a directory.
28102 </para>
28103 <para>
28104 <indexterm role="option">
28105 <primary><option>ldap_ca_cert_file</option></primary>
28106 </indexterm>
28107 </para>
28108 <informaltable frame="all">
28109 <tgroup cols="4" colsep="0" rowsep="0">
28110 <colspec colwidth="8*" align="left"/>
28111 <colspec colwidth="6*" align="center"/>
28112 <colspec colwidth="6*" align="center"/>
28113 <colspec colwidth="6*" align="right"/>
28114 <tbody>
28115 <row>
28116 <entry><option>ldap_ca_cert_file</option></entry>
28117 <entry>Use: <emphasis>main</emphasis></entry>
28118 <entry>Type: <emphasis>string</emphasis></entry>
28119 <entry>Default: <emphasis>unset</emphasis></entry>
28120 </row>
28121 </tbody>
28122 </tgroup>
28123 </informaltable>
28124 <para>
28125 <indexterm role="concept">
28126 <primary>LDAP</primary>
28127 <secondary>,</secondary>
28128 </indexterm>
28129 <indexterm role="concept">
28130 <primary>certificate</primary>
28131 <secondary>file for LDAP</secondary>
28132 </indexterm>
28133 This option indicates which file contains CA certificates for verifying
28134 a TLS certificate presented by an LDAP server.
28135 While Exim does not provide a default value, your SSL library may.
28136 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
28137 and constrained to be a file.
28138 </para>
28139 <para>
28140 <indexterm role="option">
28141 <primary><option>ldap_cert_file</option></primary>
28142 </indexterm>
28143 </para>
28144 <informaltable frame="all">
28145 <tgroup cols="4" colsep="0" rowsep="0">
28146 <colspec colwidth="8*" align="left"/>
28147 <colspec colwidth="6*" align="center"/>
28148 <colspec colwidth="6*" align="center"/>
28149 <colspec colwidth="6*" align="right"/>
28150 <tbody>
28151 <row>
28152 <entry><option>ldap_cert_file</option></entry>
28153 <entry>Use: <emphasis>main</emphasis></entry>
28154 <entry>Type: <emphasis>string</emphasis></entry>
28155 <entry>Default: <emphasis>unset</emphasis></entry>
28156 </row>
28157 </tbody>
28158 </tgroup>
28159 </informaltable>
28160 <para>
28161 <indexterm role="concept">
28162 <primary>LDAP</primary>
28163 <secondary>TLS client certificate file</secondary>
28164 </indexterm>
28165 <indexterm role="concept">
28166 <primary>certificate</primary>
28167 <secondary>file for LDAP</secondary>
28168 </indexterm>
28169 This option indicates which file contains an TLS client certificate which
28170 Exim should present to the LDAP server during TLS negotiation.
28171 Should be used together with <option>ldap_cert_key</option>.
28172 </para>
28173 <para>
28174 <indexterm role="option">
28175 <primary><option>ldap_cert_key</option></primary>
28176 </indexterm>
28177 </para>
28178 <informaltable frame="all">
28179 <tgroup cols="4" colsep="0" rowsep="0">
28180 <colspec colwidth="8*" align="left"/>
28181 <colspec colwidth="6*" align="center"/>
28182 <colspec colwidth="6*" align="center"/>
28183 <colspec colwidth="6*" align="right"/>
28184 <tbody>
28185 <row>
28186 <entry><option>ldap_cert_key</option></entry>
28187 <entry>Use: <emphasis>main</emphasis></entry>
28188 <entry>Type: <emphasis>string</emphasis></entry>
28189 <entry>Default: <emphasis>unset</emphasis></entry>
28190 </row>
28191 </tbody>
28192 </tgroup>
28193 </informaltable>
28194 <para>
28195 <indexterm role="concept">
28196 <primary>LDAP</primary>
28197 <secondary>TLS client key file</secondary>
28198 </indexterm>
28199 <indexterm role="concept">
28200 <primary>certificate</primary>
28201 <secondary>key for LDAP</secondary>
28202 </indexterm>
28203 This option indicates which file contains the secret/private key to use
28204 to prove identity to the LDAP server during TLS negotiation.
28205 Should be used together with <option>ldap_cert_file</option>, which contains the
28206 identity to be proven.
28207 </para>
28208 <para>
28209 <indexterm role="option">
28210 <primary><option>ldap_cipher_suite</option></primary>
28211 </indexterm>
28212 </para>
28213 <informaltable frame="all">
28214 <tgroup cols="4" colsep="0" rowsep="0">
28215 <colspec colwidth="8*" align="left"/>
28216 <colspec colwidth="6*" align="center"/>
28217 <colspec colwidth="6*" align="center"/>
28218 <colspec colwidth="6*" align="right"/>
28219 <tbody>
28220 <row>
28221 <entry><option>ldap_cipher_suite</option></entry>
28222 <entry>Use: <emphasis>main</emphasis></entry>
28223 <entry>Type: <emphasis>string</emphasis></entry>
28224 <entry>Default: <emphasis>unset</emphasis></entry>
28225 </row>
28226 </tbody>
28227 </tgroup>
28228 </informaltable>
28229 <para>
28230 <indexterm role="concept">
28231 <primary>LDAP</primary>
28232 <secondary>TLS cipher suite</secondary>
28233 </indexterm>
28234 This controls the TLS cipher-suite negotiation during TLS negotiation with
28235 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
28236 cipher-suite options with OpenSSL (as used by LDAP client libraries).
28237 </para>
28238 <para>
28239 <indexterm role="option">
28240 <primary><option>ldap_default_servers</option></primary>
28241 </indexterm>
28242 </para>
28243 <informaltable frame="all">
28244 <tgroup cols="4" colsep="0" rowsep="0">
28245 <colspec colwidth="8*" align="left"/>
28246 <colspec colwidth="6*" align="center"/>
28247 <colspec colwidth="6*" align="center"/>
28248 <colspec colwidth="6*" align="right"/>
28249 <tbody>
28250 <row>
28251 <entry><option>ldap_default_servers</option></entry>
28252 <entry>Use: <emphasis>main</emphasis></entry>
28253 <entry>Type: <emphasis>string list</emphasis></entry>
28254 <entry>Default: <emphasis>unset</emphasis></entry>
28255 </row>
28256 </tbody>
28257 </tgroup>
28258 </informaltable>
28259 <para>
28260 <indexterm role="concept">
28261 <primary>LDAP</primary>
28262 <secondary>default servers</secondary>
28263 </indexterm>
28264 This option provides a list of LDAP servers which are tried in turn when an
28265 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
28266 details of LDAP queries. This option is available only when Exim has been built
28267 with LDAP support.
28268 </para>
28269 <para>
28270 <indexterm role="option">
28271 <primary><option>ldap_require_cert</option></primary>
28272 </indexterm>
28273 </para>
28274 <informaltable frame="all">
28275 <tgroup cols="4" colsep="0" rowsep="0">
28276 <colspec colwidth="8*" align="left"/>
28277 <colspec colwidth="6*" align="center"/>
28278 <colspec colwidth="6*" align="center"/>
28279 <colspec colwidth="6*" align="right"/>
28280 <tbody>
28281 <row>
28282 <entry><option>ldap_require_cert</option></entry>
28283 <entry>Use: <emphasis>main</emphasis></entry>
28284 <entry>Type: <emphasis>string</emphasis></entry>
28285 <entry>Default: <emphasis>unset.</emphasis></entry>
28286 </row>
28287 </tbody>
28288 </tgroup>
28289 </informaltable>
28290 <para>
28291 <indexterm role="concept">
28292 <primary>LDAP</primary>
28293 <secondary>policy for LDAP server TLS cert presentation</secondary>
28294 </indexterm>
28295 This should be one of the values "hard", "demand", "allow", "try" or "never".
28296 A value other than one of these is interpreted as "never".
28297 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
28298 Although Exim does not set a default, the LDAP library probably defaults
28299 to hard/demand.
28300 </para>
28301 <para>
28302 <indexterm role="option">
28303 <primary><option>ldap_start_tls</option></primary>
28304 </indexterm>
28305 </para>
28306 <informaltable frame="all">
28307 <tgroup cols="4" colsep="0" rowsep="0">
28308 <colspec colwidth="8*" align="left"/>
28309 <colspec colwidth="6*" align="center"/>
28310 <colspec colwidth="6*" align="center"/>
28311 <colspec colwidth="6*" align="right"/>
28312 <tbody>
28313 <row>
28314 <entry><option>ldap_start_tls</option></entry>
28315 <entry>Use: <emphasis>main</emphasis></entry>
28316 <entry>Type: <emphasis>boolean</emphasis></entry>
28317 <entry>Default: <emphasis>false</emphasis></entry>
28318 </row>
28319 </tbody>
28320 </tgroup>
28321 </informaltable>
28322 <para>
28323 <indexterm role="concept">
28324 <primary>LDAP</primary>
28325 <secondary>whether or not to negotiate TLS</secondary>
28326 </indexterm>
28327 If set, Exim will attempt to negotiate TLS with the LDAP server when
28328 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
28329 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
28330 of SSL-on-connect.
28331 In the event of failure to negotiate TLS, the action taken is controlled
28332 by <option>ldap_require_cert</option>.
28333 This option is ignored for <literal>ldapi</literal> connections.
28334 </para>
28335 <para>
28336 <indexterm role="option">
28337 <primary><option>ldap_version</option></primary>
28338 </indexterm>
28339 </para>
28340 <informaltable frame="all">
28341 <tgroup cols="4" colsep="0" rowsep="0">
28342 <colspec colwidth="8*" align="left"/>
28343 <colspec colwidth="6*" align="center"/>
28344 <colspec colwidth="6*" align="center"/>
28345 <colspec colwidth="6*" align="right"/>
28346 <tbody>
28347 <row>
28348 <entry><option>ldap_version</option></entry>
28349 <entry>Use: <emphasis>main</emphasis></entry>
28350 <entry>Type: <emphasis>integer</emphasis></entry>
28351 <entry>Default: <emphasis>unset</emphasis></entry>
28352 </row>
28353 </tbody>
28354 </tgroup>
28355 </informaltable>
28356 <para>
28357 <indexterm role="concept">
28358 <primary>LDAP</primary>
28359 <secondary>protocol version, forcing</secondary>
28360 </indexterm>
28361 This option can be used to force Exim to set a specific protocol version for
28362 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
28363 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
28364 the LDAP headers; otherwise it is 2. This option is available only when Exim
28365 has been built with LDAP support.
28366 </para>
28367 <para>
28368 <indexterm role="option">
28369 <primary><option>local_from_check</option></primary>
28370 </indexterm>
28371 </para>
28372 <informaltable frame="all">
28373 <tgroup cols="4" colsep="0" rowsep="0">
28374 <colspec colwidth="8*" align="left"/>
28375 <colspec colwidth="6*" align="center"/>
28376 <colspec colwidth="6*" align="center"/>
28377 <colspec colwidth="6*" align="right"/>
28378 <tbody>
28379 <row>
28380 <entry><option>local_from_check</option></entry>
28381 <entry>Use: <emphasis>main</emphasis></entry>
28382 <entry>Type: <emphasis>boolean</emphasis></entry>
28383 <entry>Default: <emphasis>true</emphasis></entry>
28384 </row>
28385 </tbody>
28386 </tgroup>
28387 </informaltable>
28388 <para>
28389 <indexterm role="concept">
28390 <primary><emphasis>Sender:</emphasis> header line</primary>
28391 <secondary>disabling addition of</secondary>
28392 </indexterm>
28393 <indexterm role="concept">
28394 <primary><emphasis>From:</emphasis> header line</primary>
28395 <secondary>disabling checking of</secondary>
28396 </indexterm>
28397 When a message is submitted locally (that is, not over a TCP/IP connection) by
28398 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
28399 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
28400 the domain specified by <option>qualify_domain</option>.
28401 </para>
28402 <para>
28403 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
28404 locally submitted message is automatically qualified by Exim, unless the
28405 <option>-bnq</option> command line option is used.
28406 </para>
28407 <para>
28408 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
28409 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
28410 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
28411 and the default qualify domain.
28412 </para>
28413 <para>
28414 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
28415 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
28416 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
28417 <option>local_sender_retain</option> to be true.
28418 </para>
28419 <para>
28420 <indexterm role="concept">
28421 <primary>envelope from</primary>
28422 </indexterm>
28423 <indexterm role="concept">
28424 <primary>envelope sender</primary>
28425 </indexterm>
28426 These options affect only the header lines in the message. The envelope sender
28427 is still forced to be the login id at the qualify domain unless
28428 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
28429 </para>
28430 <para>
28431 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
28432 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
28433 has more details about <emphasis>Sender:</emphasis> processing.
28434 </para>
28435 <para>
28436 <indexterm role="option">
28437 <primary><option>local_from_prefix</option></primary>
28438 </indexterm>
28439 </para>
28440 <informaltable frame="all">
28441 <tgroup cols="4" colsep="0" rowsep="0">
28442 <colspec colwidth="8*" align="left"/>
28443 <colspec colwidth="6*" align="center"/>
28444 <colspec colwidth="6*" align="center"/>
28445 <colspec colwidth="6*" align="right"/>
28446 <tbody>
28447 <row>
28448 <entry><option>local_from_prefix</option></entry>
28449 <entry>Use: <emphasis>main</emphasis></entry>
28450 <entry>Type: <emphasis>string</emphasis></entry>
28451 <entry>Default: <emphasis>unset</emphasis></entry>
28452 </row>
28453 </tbody>
28454 </tgroup>
28455 </informaltable>
28456 <para>
28457 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
28458 matching the login id (see <option>local_from_check</option> above), it can be configured to
28459 ignore certain prefixes and suffixes in the local part of the address. This is
28460 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
28461 appropriate lists, in the same form as the <option>local_part_prefix</option> and
28462 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
28463 example, if
28464 </para>
28465 <literallayout class="monospaced">
28466 local_from_prefix = *-
28467 </literallayout>
28468 <para>
28469 is set, a <emphasis>From:</emphasis> line containing
28470 </para>
28471 <literallayout class="monospaced">
28472 From: anything-user@your.domain.example
28473 </literallayout>
28474 <para>
28475 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
28476 matches the actual sender address that is constructed from the login name and
28477 qualify domain.
28478 </para>
28479 <para>
28480 <indexterm role="option">
28481 <primary><option>local_from_suffix</option></primary>
28482 </indexterm>
28483 </para>
28484 <informaltable frame="all">
28485 <tgroup cols="4" colsep="0" rowsep="0">
28486 <colspec colwidth="8*" align="left"/>
28487 <colspec colwidth="6*" align="center"/>
28488 <colspec colwidth="6*" align="center"/>
28489 <colspec colwidth="6*" align="right"/>
28490 <tbody>
28491 <row>
28492 <entry><option>local_from_suffix</option></entry>
28493 <entry>Use: <emphasis>main</emphasis></entry>
28494 <entry>Type: <emphasis>string</emphasis></entry>
28495 <entry>Default: <emphasis>unset</emphasis></entry>
28496 </row>
28497 </tbody>
28498 </tgroup>
28499 </informaltable>
28500 <para>
28501 See <option>local_from_prefix</option> above.
28502 </para>
28503 <para>
28504 <indexterm role="option">
28505 <primary><option>local_interfaces</option></primary>
28506 </indexterm>
28507 </para>
28508 <informaltable frame="all">
28509 <tgroup cols="4" colsep="0" rowsep="0">
28510 <colspec colwidth="8*" align="left"/>
28511 <colspec colwidth="6*" align="center"/>
28512 <colspec colwidth="6*" align="center"/>
28513 <colspec colwidth="6*" align="right"/>
28514 <tbody>
28515 <row>
28516 <entry><option>local_interfaces</option></entry>
28517 <entry>Use: <emphasis>main</emphasis></entry>
28518 <entry>Type: <emphasis>string list</emphasis></entry>
28519 <entry>Default: <emphasis>see below</emphasis></entry>
28520 </row>
28521 </tbody>
28522 </tgroup>
28523 </informaltable>
28524 <para>
28525 This option controls which network interfaces are used by the daemon for
28526 listening; they are also used to identify the local host when routing. Chapter
28527 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
28528 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
28529 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
28530 <option>local_interfaces</option> is
28531 </para>
28532 <literallayout class="monospaced">
28533 local_interfaces = 0.0.0.0
28534 </literallayout>
28535 <para>
28536 when Exim is built without IPv6 support; otherwise it is
28537 </para>
28538 <literallayout class="monospaced">
28539 local_interfaces = &lt;; ::0 ; 0.0.0.0
28540 </literallayout>
28541 <para>
28542 <indexterm role="option">
28543 <primary><option>local_scan_timeout</option></primary>
28544 </indexterm>
28545 </para>
28546 <informaltable frame="all">
28547 <tgroup cols="4" colsep="0" rowsep="0">
28548 <colspec colwidth="8*" align="left"/>
28549 <colspec colwidth="6*" align="center"/>
28550 <colspec colwidth="6*" align="center"/>
28551 <colspec colwidth="6*" align="right"/>
28552 <tbody>
28553 <row>
28554 <entry><option>local_scan_timeout</option></entry>
28555 <entry>Use: <emphasis>main</emphasis></entry>
28556 <entry>Type: <emphasis>time</emphasis></entry>
28557 <entry>Default: <emphasis>5m</emphasis></entry>
28558 </row>
28559 </tbody>
28560 </tgroup>
28561 </informaltable>
28562 <para>
28563 <indexterm role="concept">
28564 <primary>timeout</primary>
28565 <secondary>for <function>local_scan()</function> function</secondary>
28566 </indexterm>
28567 <indexterm role="concept">
28568 <primary><function>local_scan()</function> function</primary>
28569 <secondary>timeout</secondary>
28570 </indexterm>
28571 This timeout applies to the <function>local_scan()</function> function (see chapter
28572 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
28573 the incoming message is rejected with a temporary error if it is an SMTP
28574 message. For a non-SMTP message, the message is dropped and Exim ends with a
28575 non-zero code. The incident is logged on the main and reject logs.
28576 </para>
28577 <para>
28578 <indexterm role="option">
28579 <primary><option>local_sender_retain</option></primary>
28580 </indexterm>
28581 </para>
28582 <informaltable frame="all">
28583 <tgroup cols="4" colsep="0" rowsep="0">
28584 <colspec colwidth="8*" align="left"/>
28585 <colspec colwidth="6*" align="center"/>
28586 <colspec colwidth="6*" align="center"/>
28587 <colspec colwidth="6*" align="right"/>
28588 <tbody>
28589 <row>
28590 <entry><option>local_sender_retain</option></entry>
28591 <entry>Use: <emphasis>main</emphasis></entry>
28592 <entry>Type: <emphasis>boolean</emphasis></entry>
28593 <entry>Default: <emphasis>false</emphasis></entry>
28594 </row>
28595 </tbody>
28596 </tgroup>
28597 </informaltable>
28598 <para>
28599 <indexterm role="concept">
28600 <primary><emphasis>Sender:</emphasis> header line</primary>
28601 <secondary>retaining from local submission</secondary>
28602 </indexterm>
28603 When a message is submitted locally (that is, not over a TCP/IP connection) by
28604 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
28605 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
28606 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
28607 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
28608 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
28609 </para>
28610 <para>
28611 <indexterm role="option">
28612 <primary><option>localhost_number</option></primary>
28613 </indexterm>
28614 </para>
28615 <informaltable frame="all">
28616 <tgroup cols="4" colsep="0" rowsep="0">
28617 <colspec colwidth="8*" align="left"/>
28618 <colspec colwidth="6*" align="center"/>
28619 <colspec colwidth="6*" align="center"/>
28620 <colspec colwidth="6*" align="right"/>
28621 <tbody>
28622 <row>
28623 <entry><option>localhost_number</option></entry>
28624 <entry>Use: <emphasis>main</emphasis></entry>
28625 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28626 <entry>Default: <emphasis>unset</emphasis></entry>
28627 </row>
28628 </tbody>
28629 </tgroup>
28630 </informaltable>
28631 <para>
28632 <indexterm role="concept">
28633 <primary>host</primary>
28634 <secondary>locally unique number for</secondary>
28635 </indexterm>
28636 <indexterm role="concept">
28637 <primary>message ids</primary>
28638 <secondary>with multiple hosts</secondary>
28639 </indexterm>
28640 <indexterm role="variable">
28641 <primary><varname>$localhost_number</varname></primary>
28642 </indexterm>
28643 Exim&#x2019;s message ids are normally unique only within the local host. If
28644 uniqueness among a set of hosts is required, each host must set a different
28645 value for the <option>localhost_number</option> option. The string is expanded immediately
28646 after reading the configuration file (so that a number can be computed from the
28647 host name, for example) and the result of the expansion must be a number in the
28648 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
28649 systems). This is available in subsequent string expansions via the variable
28650 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
28651 characters of the message id, instead of just being a fractional part of the
28652 time, are computed from the time and the local host number as described in
28653 section <xref linkend="SECTmessiden"/>.
28654 </para>
28655 <para>
28656 <indexterm role="option">
28657 <primary><option>log_file_path</option></primary>
28658 </indexterm>
28659 </para>
28660 <informaltable frame="all">
28661 <tgroup cols="4" colsep="0" rowsep="0">
28662 <colspec colwidth="8*" align="left"/>
28663 <colspec colwidth="6*" align="center"/>
28664 <colspec colwidth="6*" align="center"/>
28665 <colspec colwidth="6*" align="right"/>
28666 <tbody>
28667 <row>
28668 <entry><option>log_file_path</option></entry>
28669 <entry>Use: <emphasis>main</emphasis></entry>
28670 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28671 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28672 </row>
28673 </tbody>
28674 </tgroup>
28675 </informaltable>
28676 <para>
28677 <indexterm role="concept">
28678 <primary>log</primary>
28679 <secondary>file path for</secondary>
28680 </indexterm>
28681 This option sets the path which is used to determine the names of Exim&#x2019;s log
28682 files, or indicates that logging is to be to syslog, or both. It is expanded
28683 when Exim is entered, so it can, for example, contain a reference to the host
28684 name. If no specific path is set for the log files at compile or runtime,
28685 or if the option is unset at runtime (i.e.  <literal>log_file_path = </literal>)
28686 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
28687 A path must start with a slash.
28688 To send to syslog, use the word <quote>syslog</quote>.
28689 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
28690 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
28691 used. If this string is fixed at your installation (contains no expansion
28692 variables) it is recommended that you do not set this option in the
28693 configuration file, but instead supply the path using LOG_FILE_PATH in
28694 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
28695 early on &ndash; in particular, failure to read the configuration file.
28696 </para>
28697 <para>
28698 <indexterm role="option">
28699 <primary><option>log_selector</option></primary>
28700 </indexterm>
28701 </para>
28702 <informaltable frame="all">
28703 <tgroup cols="4" colsep="0" rowsep="0">
28704 <colspec colwidth="8*" align="left"/>
28705 <colspec colwidth="6*" align="center"/>
28706 <colspec colwidth="6*" align="center"/>
28707 <colspec colwidth="6*" align="right"/>
28708 <tbody>
28709 <row>
28710 <entry><option>log_selector</option></entry>
28711 <entry>Use: <emphasis>main</emphasis></entry>
28712 <entry>Type: <emphasis>string</emphasis></entry>
28713 <entry>Default: <emphasis>unset</emphasis></entry>
28714 </row>
28715 </tbody>
28716 </tgroup>
28717 </informaltable>
28718 <para>
28719 <indexterm role="concept">
28720 <primary>log</primary>
28721 <secondary>selectors</secondary>
28722 </indexterm>
28723 This option can be used to reduce or increase the number of things that Exim
28724 writes to its log files. Its argument is made up of names preceded by plus or
28725 minus characters. For example:
28726 </para>
28727 <literallayout class="monospaced">
28728 log_selector = +arguments -retry_defer
28729 </literallayout>
28730 <para>
28731 A list of possible names and what they control is given in the chapter on
28732 logging, in section <xref linkend="SECTlogselector"/>.
28733 </para>
28734 <para>
28735 <indexterm role="option">
28736 <primary><option>log_timezone</option></primary>
28737 </indexterm>
28738 </para>
28739 <informaltable frame="all">
28740 <tgroup cols="4" colsep="0" rowsep="0">
28741 <colspec colwidth="8*" align="left"/>
28742 <colspec colwidth="6*" align="center"/>
28743 <colspec colwidth="6*" align="center"/>
28744 <colspec colwidth="6*" align="right"/>
28745 <tbody>
28746 <row>
28747 <entry><option>log_timezone</option></entry>
28748 <entry>Use: <emphasis>main</emphasis></entry>
28749 <entry>Type: <emphasis>boolean</emphasis></entry>
28750 <entry>Default: <emphasis>false</emphasis></entry>
28751 </row>
28752 </tbody>
28753 </tgroup>
28754 </informaltable>
28755 <para>
28756 <indexterm role="concept">
28757 <primary>log</primary>
28758 <secondary>timezone for entries</secondary>
28759 </indexterm>
28760 <indexterm role="variable">
28761 <primary><varname>$tod_log</varname></primary>
28762 </indexterm>
28763 <indexterm role="variable">
28764 <primary><varname>$tod_zone</varname></primary>
28765 </indexterm>
28766 By default, the timestamps on log lines are in local time without the
28767 timezone. This means that if your timezone changes twice a year, the timestamps
28768 in log lines are ambiguous for an hour when the clocks go back. One way of
28769 avoiding this problem is to set the timezone to UTC. An alternative is to set
28770 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
28771 timestamps in log lines. Turning on this option can add quite a lot to the size
28772 of log files because each line is extended by 6 characters. Note that the
28773 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
28774 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
28775 </para>
28776 <para>
28777 <indexterm role="option">
28778 <primary><option>lookup_open_max</option></primary>
28779 </indexterm>
28780 </para>
28781 <informaltable frame="all">
28782 <tgroup cols="4" colsep="0" rowsep="0">
28783 <colspec colwidth="8*" align="left"/>
28784 <colspec colwidth="6*" align="center"/>
28785 <colspec colwidth="6*" align="center"/>
28786 <colspec colwidth="6*" align="right"/>
28787 <tbody>
28788 <row>
28789 <entry><option>lookup_open_max</option></entry>
28790 <entry>Use: <emphasis>main</emphasis></entry>
28791 <entry>Type: <emphasis>integer</emphasis></entry>
28792 <entry>Default: <emphasis>25</emphasis></entry>
28793 </row>
28794 </tbody>
28795 </tgroup>
28796 </informaltable>
28797 <para>
28798 <indexterm role="concept">
28799 <primary>too many open files</primary>
28800 </indexterm>
28801 <indexterm role="concept">
28802 <primary>open files, too many</primary>
28803 </indexterm>
28804 <indexterm role="concept">
28805 <primary>file</primary>
28806 <secondary>too many open</secondary>
28807 </indexterm>
28808 <indexterm role="concept">
28809 <primary>lookup</primary>
28810 <secondary>maximum open files</secondary>
28811 </indexterm>
28812 <indexterm role="concept">
28813 <primary>limit</primary>
28814 <secondary>open files for lookups</secondary>
28815 </indexterm>
28816 This option limits the number of simultaneously open files for single-key
28817 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
28818 Exim normally keeps these files open during routing, because often the same
28819 file is required several times. If the limit is reached, Exim closes the least
28820 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
28821 actually opens two files for each logical DBM database, though it still counts
28822 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
28823 open files</quote> errors with NDBM, you need to reduce the value of
28824 <option>lookup_open_max</option>.
28825 </para>
28826 <para>
28827 <indexterm role="option">
28828 <primary><option>max_username_length</option></primary>
28829 </indexterm>
28830 </para>
28831 <informaltable frame="all">
28832 <tgroup cols="4" colsep="0" rowsep="0">
28833 <colspec colwidth="8*" align="left"/>
28834 <colspec colwidth="6*" align="center"/>
28835 <colspec colwidth="6*" align="center"/>
28836 <colspec colwidth="6*" align="right"/>
28837 <tbody>
28838 <row>
28839 <entry><option>max_username_length</option></entry>
28840 <entry>Use: <emphasis>main</emphasis></entry>
28841 <entry>Type: <emphasis>integer</emphasis></entry>
28842 <entry>Default: <emphasis>0</emphasis></entry>
28843 </row>
28844 </tbody>
28845 </tgroup>
28846 </informaltable>
28847 <para>
28848 <indexterm role="concept">
28849 <primary>length of login name</primary>
28850 </indexterm>
28851 <indexterm role="concept">
28852 <primary>user name</primary>
28853 <secondary>maximum length</secondary>
28854 </indexterm>
28855 <indexterm role="concept">
28856 <primary>limit</primary>
28857 <secondary>user name length</secondary>
28858 </indexterm>
28859 Some operating systems are broken in that they truncate long arguments to
28860 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
28861 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
28862 an argument that is longer behaves as if <function>getpwnam()</function> failed.
28863 </para>
28864 <para>
28865 <indexterm role="option">
28866 <primary><option>message_body_newlines</option></primary>
28867 </indexterm>
28868 </para>
28869 <informaltable frame="all">
28870 <tgroup cols="4" colsep="0" rowsep="0">
28871 <colspec colwidth="8*" align="left"/>
28872 <colspec colwidth="6*" align="center"/>
28873 <colspec colwidth="6*" align="center"/>
28874 <colspec colwidth="6*" align="right"/>
28875 <tbody>
28876 <row>
28877 <entry><option>message_body_newlines</option></entry>
28878 <entry>Use: <emphasis>main</emphasis></entry>
28879 <entry>Type: <emphasis>bool</emphasis></entry>
28880 <entry>Default: <emphasis>false</emphasis></entry>
28881 </row>
28882 </tbody>
28883 </tgroup>
28884 </informaltable>
28885 <para>
28886 <indexterm role="concept">
28887 <primary>message body</primary>
28888 <secondary>newlines in variables</secondary>
28889 </indexterm>
28890 <indexterm role="concept">
28891 <primary>newline</primary>
28892 <secondary>in message body variables</secondary>
28893 </indexterm>
28894 <indexterm role="variable">
28895 <primary><varname>$message_body</varname></primary>
28896 </indexterm>
28897 <indexterm role="variable">
28898 <primary><varname>$message_body_end</varname></primary>
28899 </indexterm>
28900 By default, newlines in the message body are replaced by spaces when setting
28901 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
28902 option is set true, this no longer happens.
28903 </para>
28904 <para>
28905 <indexterm role="option">
28906 <primary><option>message_body_visible</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_visible</option></entry>
28918 <entry>Use: <emphasis>main</emphasis></entry>
28919 <entry>Type: <emphasis>integer</emphasis></entry>
28920 <entry>Default: <emphasis>500</emphasis></entry>
28921 </row>
28922 </tbody>
28923 </tgroup>
28924 </informaltable>
28925 <para>
28926 <indexterm role="concept">
28927 <primary>body of message</primary>
28928 <secondary>visible size</secondary>
28929 </indexterm>
28930 <indexterm role="concept">
28931 <primary>message body</primary>
28932 <secondary>visible size</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 This option specifies how much of a message&#x2019;s body is to be included in the
28941 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
28942 </para>
28943 <para>
28944 <indexterm role="option">
28945 <primary><option>message_id_header_domain</option></primary>
28946 </indexterm>
28947 </para>
28948 <informaltable frame="all">
28949 <tgroup cols="4" colsep="0" rowsep="0">
28950 <colspec colwidth="8*" align="left"/>
28951 <colspec colwidth="6*" align="center"/>
28952 <colspec colwidth="6*" align="center"/>
28953 <colspec colwidth="6*" align="right"/>
28954 <tbody>
28955 <row>
28956 <entry><option>message_id_header_domain</option></entry>
28957 <entry>Use: <emphasis>main</emphasis></entry>
28958 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28959 <entry>Default: <emphasis>unset</emphasis></entry>
28960 </row>
28961 </tbody>
28962 </tgroup>
28963 </informaltable>
28964 <para>
28965 <indexterm role="concept">
28966 <primary><emphasis>Message-ID:</emphasis> header line</primary>
28967 </indexterm>
28968 If this option is set, the string is expanded and used as the right hand side
28969 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
28970 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
28971 means <quote>not received over TCP/IP.</quote>
28972 Otherwise, the primary host name is used.
28973 Only letters, digits, dot and hyphen are accepted; any other characters are
28974 replaced by hyphens. If the expansion is forced to fail, or if the result is an
28975 empty string, the option is ignored.
28976 </para>
28977 <para>
28978 <indexterm role="option">
28979 <primary><option>message_id_header_text</option></primary>
28980 </indexterm>
28981 </para>
28982 <informaltable frame="all">
28983 <tgroup cols="4" colsep="0" rowsep="0">
28984 <colspec colwidth="8*" align="left"/>
28985 <colspec colwidth="6*" align="center"/>
28986 <colspec colwidth="6*" align="center"/>
28987 <colspec colwidth="6*" align="right"/>
28988 <tbody>
28989 <row>
28990 <entry><option>message_id_header_text</option></entry>
28991 <entry>Use: <emphasis>main</emphasis></entry>
28992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28993 <entry>Default: <emphasis>unset</emphasis></entry>
28994 </row>
28995 </tbody>
28996 </tgroup>
28997 </informaltable>
28998 <para>
28999 If this variable is set, the string is expanded and used to augment the text of
29000 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
29001 message does not have one. The text of this header is required by RFC 2822 to
29002 take the form of an address. By default, Exim uses its internal message id as
29003 the local part, and the primary host name as the domain. If this option is set,
29004 it is expanded, and provided the expansion is not forced to fail, and does not
29005 yield an empty string, the result is inserted into the header immediately
29006 before the @, separated from the internal message id by a dot. Any characters
29007 that are illegal in an address are automatically converted into hyphens. This
29008 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
29009 colons will become hyphens.
29010 </para>
29011 <para>
29012 <indexterm role="option">
29013 <primary><option>message_logs</option></primary>
29014 </indexterm>
29015 </para>
29016 <informaltable frame="all">
29017 <tgroup cols="4" colsep="0" rowsep="0">
29018 <colspec colwidth="8*" align="left"/>
29019 <colspec colwidth="6*" align="center"/>
29020 <colspec colwidth="6*" align="center"/>
29021 <colspec colwidth="6*" align="right"/>
29022 <tbody>
29023 <row>
29024 <entry><option>message_logs</option></entry>
29025 <entry>Use: <emphasis>main</emphasis></entry>
29026 <entry>Type: <emphasis>boolean</emphasis></entry>
29027 <entry>Default: <emphasis>true</emphasis></entry>
29028 </row>
29029 </tbody>
29030 </tgroup>
29031 </informaltable>
29032 <para>
29033 <indexterm role="concept">
29034 <primary>message logs</primary>
29035 <secondary>disabling</secondary>
29036 </indexterm>
29037 <indexterm role="concept">
29038 <primary>log</primary>
29039 <secondary>message log; disabling</secondary>
29040 </indexterm>
29041 If this option is turned off, per-message log files are not created in the
29042 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
29043 Exim, by reducing the number of files involved in handling a message from a
29044 minimum of four (header spool file, body spool file, delivery journal, and
29045 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
29046 which is not affected by this option.
29047 </para>
29048 <para>
29049 <indexterm role="option">
29050 <primary><option>message_size_limit</option></primary>
29051 </indexterm>
29052 </para>
29053 <informaltable frame="all">
29054 <tgroup cols="4" colsep="0" rowsep="0">
29055 <colspec colwidth="8*" align="left"/>
29056 <colspec colwidth="6*" align="center"/>
29057 <colspec colwidth="6*" align="center"/>
29058 <colspec colwidth="6*" align="right"/>
29059 <tbody>
29060 <row>
29061 <entry><option>message_size_limit</option></entry>
29062 <entry>Use: <emphasis>main</emphasis></entry>
29063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29064 <entry>Default: <emphasis>50M</emphasis></entry>
29065 </row>
29066 </tbody>
29067 </tgroup>
29068 </informaltable>
29069 <para>
29070 <indexterm role="concept">
29071 <primary>message</primary>
29072 <secondary>size limit</secondary>
29073 </indexterm>
29074 <indexterm role="concept">
29075 <primary>limit</primary>
29076 <secondary>message size</secondary>
29077 </indexterm>
29078 <indexterm role="concept">
29079 <primary>size</primary>
29080 <secondary>of message, limit</secondary>
29081 </indexterm>
29082 This option limits the maximum size of message that Exim will process. The
29083 value is expanded for each incoming connection so, for example, it can be made
29084 to depend on the IP address of the remote host for messages arriving via
29085 TCP/IP. After expansion, the value must be a sequence of decimal digits,
29086 optionally followed by K or M.
29087 </para>
29088 <para>
29089 <indexterm role="concept">
29090 <primary>SIZE</primary>
29091 <secondary>ESMTP extension, advertising</secondary>
29092 </indexterm>
29093 <indexterm role="concept">
29094 <primary>ESMTP extensions</primary>
29095 <secondary>SIZE</secondary>
29096 </indexterm>
29097 If nonzero the value will be advertised as a parameter to the ESMTP SIZE
29098 service extension keyword.
29099 </para>
29100 <para>
29101 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
29102 other properties of an individual message, because it has to be advertised in
29103 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
29104 error. A value of zero means no limit, but its use is not recommended. See also
29105 <option>bounce_return_size_limit</option>.
29106 </para>
29107 <para>
29108 Incoming SMTP messages are failed with a 552 error if the limit is
29109 exceeded; locally-generated messages either get a stderr message or a delivery
29110 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
29111 an oversized message is logged in both the main and the reject logs. See also
29112 the generic transport option <option>message_size_limit</option>, which limits the size of
29113 message that an individual transport can process.
29114 </para>
29115 <para>
29116 If you use a virus-scanner and set this option to to a value larger than the
29117 maximum size that your virus-scanner is configured to support, you may get
29118 failures triggered by large mails.  The right size to configure for the
29119 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
29120 probably safest to just set it to a little larger than this value.  E.g., with a
29121 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
29122 some problems may result.
29123 </para>
29124 <para>
29125 A value of 0 will disable size limit checking; Exim will still advertise the
29126 SIZE extension in an EHLO response, but without a limit, so as to permit
29127 SMTP clients to still indicate the message size along with the MAIL verb.
29128 </para>
29129 <para>
29130 <indexterm role="option">
29131 <primary><option>move_frozen_messages</option></primary>
29132 </indexterm>
29133 </para>
29134 <informaltable frame="all">
29135 <tgroup cols="4" colsep="0" rowsep="0">
29136 <colspec colwidth="8*" align="left"/>
29137 <colspec colwidth="6*" align="center"/>
29138 <colspec colwidth="6*" align="center"/>
29139 <colspec colwidth="6*" align="right"/>
29140 <tbody>
29141 <row>
29142 <entry><option>move_frozen_messages</option></entry>
29143 <entry>Use: <emphasis>main</emphasis></entry>
29144 <entry>Type: <emphasis>boolean</emphasis></entry>
29145 <entry>Default: <emphasis>false</emphasis></entry>
29146 </row>
29147 </tbody>
29148 </tgroup>
29149 </informaltable>
29150 <para>
29151 <indexterm role="concept">
29152 <primary>frozen messages</primary>
29153 <secondary>moving</secondary>
29154 </indexterm>
29155 This option, which is available only if Exim has been built with the setting
29156 </para>
29157 <literallayout class="monospaced">
29158 SUPPORT_MOVE_FROZEN_MESSAGES=yes
29159 </literallayout>
29160 <para>
29161 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
29162 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
29163 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
29164 standard utilities for handling such moved messages, and they do not show up in
29165 lists generated by <option>-bp</option> or by the Exim monitor.
29166 </para>
29167 <para>
29168 <indexterm role="option">
29169 <primary><option>mua_wrapper</option></primary>
29170 </indexterm>
29171 </para>
29172 <informaltable frame="all">
29173 <tgroup cols="4" colsep="0" rowsep="0">
29174 <colspec colwidth="8*" align="left"/>
29175 <colspec colwidth="6*" align="center"/>
29176 <colspec colwidth="6*" align="center"/>
29177 <colspec colwidth="6*" align="right"/>
29178 <tbody>
29179 <row>
29180 <entry><option>mua_wrapper</option></entry>
29181 <entry>Use: <emphasis>main</emphasis></entry>
29182 <entry>Type: <emphasis>boolean</emphasis></entry>
29183 <entry>Default: <emphasis>false</emphasis></entry>
29184 </row>
29185 </tbody>
29186 </tgroup>
29187 </informaltable>
29188 <para>
29189 Setting this option true causes Exim to run in a very restrictive mode in which
29190 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
29191 contains a full description of this facility.
29192 </para>
29193 <para>
29194 <indexterm role="option">
29195 <primary><option>mysql_servers</option></primary>
29196 </indexterm>
29197 </para>
29198 <informaltable frame="all">
29199 <tgroup cols="4" colsep="0" rowsep="0">
29200 <colspec colwidth="8*" align="left"/>
29201 <colspec colwidth="6*" align="center"/>
29202 <colspec colwidth="6*" align="center"/>
29203 <colspec colwidth="6*" align="right"/>
29204 <tbody>
29205 <row>
29206 <entry><option>mysql_servers</option></entry>
29207 <entry>Use: <emphasis>main</emphasis></entry>
29208 <entry>Type: <emphasis>string list</emphasis></entry>
29209 <entry>Default: <emphasis>unset</emphasis></entry>
29210 </row>
29211 </tbody>
29212 </tgroup>
29213 </informaltable>
29214 <para>
29215 <indexterm role="concept">
29216 <primary>MySQL</primary>
29217 <secondary>server list</secondary>
29218 </indexterm>
29219 This option provides a list of MySQL servers and associated connection data, to
29220 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
29221 option is available only if Exim has been built with MySQL support.
29222 </para>
29223 <para>
29224 <indexterm role="option">
29225 <primary><option>never_users</option></primary>
29226 </indexterm>
29227 </para>
29228 <informaltable frame="all">
29229 <tgroup cols="4" colsep="0" rowsep="0">
29230 <colspec colwidth="8*" align="left"/>
29231 <colspec colwidth="6*" align="center"/>
29232 <colspec colwidth="6*" align="center"/>
29233 <colspec colwidth="6*" align="right"/>
29234 <tbody>
29235 <row>
29236 <entry><option>never_users</option></entry>
29237 <entry>Use: <emphasis>main</emphasis></entry>
29238 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29239 <entry>Default: <emphasis>unset</emphasis></entry>
29240 </row>
29241 </tbody>
29242 </tgroup>
29243 </informaltable>
29244 <para>
29245 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
29246 message deliveries are normally run in processes that are setuid to the
29247 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
29248 It is usually desirable to prevent any deliveries from running as root, as a
29249 safety precaution.
29250 </para>
29251 <para>
29252 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
29253 list of users that must not be used for local deliveries. This list is fixed in
29254 the binary and cannot be overridden by the configuration file. By default, it
29255 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
29256 can be used to add more users to the fixed list.
29257 </para>
29258 <para>
29259 If a message is to be delivered as one of the users on the fixed list or the
29260 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
29261 example is
29262 </para>
29263 <literallayout class="monospaced">
29264 never_users = root:daemon:bin
29265 </literallayout>
29266 <para>
29267 Including root is redundant if it is also on the fixed list, but it does no
29268 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
29269 transport driver.
29270 </para>
29271 <para revisionflag="changed">
29272 <indexterm role="option">
29273 <primary><option>notifier_socket</option></primary>
29274 </indexterm>
29275 </para>
29276 <informaltable frame="all" revisionflag="changed">
29277 <tgroup cols="4" colsep="0" rowsep="0">
29278 <colspec colwidth="8*" align="left"/>
29279 <colspec colwidth="6*" align="center"/>
29280 <colspec colwidth="6*" align="center"/>
29281 <colspec colwidth="6*" align="right"/>
29282 <tbody>
29283 <row>
29284 <entry><option>notifier_socket</option></entry>
29285 <entry>Use: <emphasis>main</emphasis></entry>
29286 <entry>Type: <emphasis>string</emphasis></entry>
29287 <entry>Default: <emphasis>$spool_directory/exim_daemon_notify</emphasis></entry>
29288 </row>
29289 </tbody>
29290 </tgroup>
29291 </informaltable>
29292 <para revisionflag="changed">
29293 This option gives the name for a unix-domain socket on which the daemon
29294 listens for work and information-requests.
29295 Only installations running multiple daemons sharing a spool directory
29296 should need to modify the default.
29297 </para>
29298 <para revisionflag="changed">
29299 The option is expanded before use.
29300 If the platform supports Linux-style abstract socket names, the result
29301 is used with a nul byte prefixed.
29302 Otherwise, it should be a full path name and use a directory accessible
29303 to Exim.
29304 </para>
29305 <para revisionflag="changed">
29306 If the Exim command line uses a <option>-oX</option> option and does not use <option>-oP</option>
29307 then a notifier socket is not created.
29308 </para>
29309 <para>
29310 <indexterm role="option">
29311 <primary><option>openssl_options</option></primary>
29312 </indexterm>
29313 </para>
29314 <informaltable frame="all">
29315 <tgroup cols="4" colsep="0" rowsep="0">
29316 <colspec colwidth="8*" align="left"/>
29317 <colspec colwidth="6*" align="center"/>
29318 <colspec colwidth="6*" align="center"/>
29319 <colspec colwidth="6*" align="right"/>
29320 <tbody>
29321 <row>
29322 <entry><option>openssl_options</option></entry>
29323 <entry>Use: <emphasis>main</emphasis></entry>
29324 <entry>Type: <emphasis>string list</emphasis></entry>
29325 <entry>Default: <emphasis>+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation</emphasis></entry>
29326 </row>
29327 </tbody>
29328 </tgroup>
29329 </informaltable>
29330 <para>
29331 <indexterm role="concept">
29332 <primary>OpenSSL </primary>
29333 <secondary>compatibility</secondary>
29334 </indexterm>
29335 This option allows an administrator to adjust the SSL options applied
29336 by OpenSSL to connections.  It is given as a space-separated list of items,
29337 each one to be +added or -subtracted from the current value.
29338 </para>
29339 <para>
29340 This option is only available if Exim is built against OpenSSL.  The values
29341 available for this option vary according to the age of your OpenSSL install.
29342 The <quote>all</quote> value controls a subset of flags which are available, typically
29343 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
29344 list the values known on your system and Exim should support all the
29345 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
29346 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
29347 </para>
29348 <para>
29349 Note that adjusting the options can have severe impact upon the security of
29350 SSL as used by Exim.  It is possible to disable safety checks and shoot
29351 yourself in the foot in various unpleasant ways.  This option should not be
29352 adjusted lightly.  An unrecognised item will be detected at startup, by
29353 invoking Exim with the <option>-bV</option> flag.
29354 </para>
29355 <para>
29356 The option affects Exim operating both as a server and as a client.
29357 </para>
29358 <para>
29359 Historical note: prior to release 4.80, Exim defaulted this value to
29360 "+dont_insert_empty_fragments", which may still be needed for compatibility
29361 with some clients, but which lowers security by increasing exposure to
29362 some now infamous attacks.
29363 </para>
29364 <para>
29365 Examples:
29366 </para>
29367 <literallayout class="monospaced">
29368 # Make both old MS and old Eudora happy:
29369 openssl_options = -all +microsoft_big_sslv3_buffer \
29370                        +dont_insert_empty_fragments
29371
29372 # Disable older protocol versions:
29373 openssl_options = +no_sslv2 +no_sslv3
29374 </literallayout>
29375 <para>
29376 Possible options may include:
29377 </para>
29378 <itemizedlist>
29379 <listitem>
29380 <para>
29381 <literal>all</literal>
29382 </para>
29383 </listitem>
29384 <listitem>
29385 <para>
29386 <literal>allow_unsafe_legacy_renegotiation</literal>
29387 </para>
29388 </listitem>
29389 <listitem>
29390 <para>
29391 <literal>cipher_server_preference</literal>
29392 </para>
29393 </listitem>
29394 <listitem>
29395 <para>
29396 <literal>dont_insert_empty_fragments</literal>
29397 </para>
29398 </listitem>
29399 <listitem>
29400 <para>
29401 <literal>ephemeral_rsa</literal>
29402 </para>
29403 </listitem>
29404 <listitem>
29405 <para>
29406 <literal>legacy_server_connect</literal>
29407 </para>
29408 </listitem>
29409 <listitem>
29410 <para>
29411 <literal>microsoft_big_sslv3_buffer</literal>
29412 </para>
29413 </listitem>
29414 <listitem>
29415 <para>
29416 <literal>microsoft_sess_id_bug</literal>
29417 </para>
29418 </listitem>
29419 <listitem>
29420 <para>
29421 <literal>msie_sslv2_rsa_padding</literal>
29422 </para>
29423 </listitem>
29424 <listitem>
29425 <para>
29426 <literal>netscape_challenge_bug</literal>
29427 </para>
29428 </listitem>
29429 <listitem>
29430 <para>
29431 <literal>netscape_reuse_cipher_change_bug</literal>
29432 </para>
29433 </listitem>
29434 <listitem>
29435 <para>
29436 <literal>no_compression</literal>
29437 </para>
29438 </listitem>
29439 <listitem>
29440 <para>
29441 <literal>no_session_resumption_on_renegotiation</literal>
29442 </para>
29443 </listitem>
29444 <listitem>
29445 <para>
29446 <literal>no_sslv2</literal>
29447 </para>
29448 </listitem>
29449 <listitem>
29450 <para>
29451 <literal>no_sslv3</literal>
29452 </para>
29453 </listitem>
29454 <listitem>
29455 <para>
29456 <literal>no_ticket</literal>
29457 </para>
29458 </listitem>
29459 <listitem>
29460 <para>
29461 <literal>no_tlsv1</literal>
29462 </para>
29463 </listitem>
29464 <listitem>
29465 <para>
29466 <literal>no_tlsv1_1</literal>
29467 </para>
29468 </listitem>
29469 <listitem>
29470 <para>
29471 <literal>no_tlsv1_2</literal>
29472 </para>
29473 </listitem>
29474 <listitem>
29475 <para>
29476 <literal>safari_ecdhe_ecdsa_bug</literal>
29477 </para>
29478 </listitem>
29479 <listitem>
29480 <para>
29481 <literal>single_dh_use</literal>
29482 </para>
29483 </listitem>
29484 <listitem>
29485 <para>
29486 <literal>single_ecdh_use</literal>
29487 </para>
29488 </listitem>
29489 <listitem>
29490 <para>
29491 <literal>ssleay_080_client_dh_bug</literal>
29492 </para>
29493 </listitem>
29494 <listitem>
29495 <para>
29496 <literal>sslref2_reuse_cert_type_bug</literal>
29497 </para>
29498 </listitem>
29499 <listitem>
29500 <para>
29501 <literal>tls_block_padding_bug</literal>
29502 </para>
29503 </listitem>
29504 <listitem>
29505 <para>
29506 <literal>tls_d5_bug</literal>
29507 </para>
29508 </listitem>
29509 <listitem>
29510 <para>
29511 <literal>tls_rollback_bug</literal>
29512 </para>
29513 </listitem>
29514 </itemizedlist>
29515 <para>
29516 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
29517 all clients connecting using the MacOS SecureTransport TLS facility prior
29518 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
29519 to negotiate TLS then this option value might help, provided that your OpenSSL
29520 release is new enough to contain this work-around.  This may be a situation
29521 where you have to upgrade OpenSSL to get buggy clients working.
29522 </para>
29523 <para>
29524 <indexterm role="option">
29525 <primary><option>oracle_servers</option></primary>
29526 </indexterm>
29527 </para>
29528 <informaltable frame="all">
29529 <tgroup cols="4" colsep="0" rowsep="0">
29530 <colspec colwidth="8*" align="left"/>
29531 <colspec colwidth="6*" align="center"/>
29532 <colspec colwidth="6*" align="center"/>
29533 <colspec colwidth="6*" align="right"/>
29534 <tbody>
29535 <row>
29536 <entry><option>oracle_servers</option></entry>
29537 <entry>Use: <emphasis>main</emphasis></entry>
29538 <entry>Type: <emphasis>string list</emphasis></entry>
29539 <entry>Default: <emphasis>unset</emphasis></entry>
29540 </row>
29541 </tbody>
29542 </tgroup>
29543 </informaltable>
29544 <para>
29545 <indexterm role="concept">
29546 <primary>Oracle</primary>
29547 <secondary>server list</secondary>
29548 </indexterm>
29549 This option provides a list of Oracle servers and associated connection data,
29550 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
29551 The option is available only if Exim has been built with Oracle support.
29552 </para>
29553 <para>
29554 <indexterm role="option">
29555 <primary><option>percent_hack_domains</option></primary>
29556 </indexterm>
29557 </para>
29558 <informaltable frame="all">
29559 <tgroup cols="4" colsep="0" rowsep="0">
29560 <colspec colwidth="8*" align="left"/>
29561 <colspec colwidth="6*" align="center"/>
29562 <colspec colwidth="6*" align="center"/>
29563 <colspec colwidth="6*" align="right"/>
29564 <tbody>
29565 <row>
29566 <entry><option>percent_hack_domains</option></entry>
29567 <entry>Use: <emphasis>main</emphasis></entry>
29568 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29569 <entry>Default: <emphasis>unset</emphasis></entry>
29570 </row>
29571 </tbody>
29572 </tgroup>
29573 </informaltable>
29574 <para>
29575 <indexterm role="concept">
29576 <primary><quote>percent hack</quote></primary>
29577 </indexterm>
29578 <indexterm role="concept">
29579 <primary>source routing</primary>
29580 <secondary>in email address</secondary>
29581 </indexterm>
29582 <indexterm role="concept">
29583 <primary>address</primary>
29584 <secondary>source-routed</secondary>
29585 </indexterm>
29586 The <quote>percent hack</quote> is the convention whereby a local part containing a
29587 percent sign is re-interpreted as a new email address, with the percent
29588 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
29589 also applied to RFC 2822 addresses that begin with an @ character. If this
29590 option is set, Exim implements the percent facility for those domains listed,
29591 but no others. This happens before an incoming SMTP address is tested against
29592 an ACL.
29593 </para>
29594 <para>
29595 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
29596 trying to get round relaying restrictions. For this reason, it is best avoided
29597 if at all possible. Unfortunately, a number of less security-conscious MTAs
29598 implement it unconditionally. If you are running Exim on a gateway host, and
29599 routing mail through to internal MTAs without processing the local parts, it is
29600 a good idea to reject recipient addresses with percent characters in their
29601 local parts. Exim&#x2019;s default configuration does this.
29602 </para>
29603 <para>
29604 <indexterm role="option">
29605 <primary><option>perl_at_start</option></primary>
29606 </indexterm>
29607 </para>
29608 <informaltable frame="all">
29609 <tgroup cols="4" colsep="0" rowsep="0">
29610 <colspec colwidth="8*" align="left"/>
29611 <colspec colwidth="6*" align="center"/>
29612 <colspec colwidth="6*" align="center"/>
29613 <colspec colwidth="6*" align="right"/>
29614 <tbody>
29615 <row>
29616 <entry><option>perl_at_start</option></entry>
29617 <entry>Use: <emphasis>main</emphasis></entry>
29618 <entry>Type: <emphasis>boolean</emphasis></entry>
29619 <entry>Default: <emphasis>false</emphasis></entry>
29620 </row>
29621 </tbody>
29622 </tgroup>
29623 </informaltable>
29624 <para>
29625 <indexterm role="concept">
29626 <primary>Perl</primary>
29627 </indexterm>
29628 This option is available only when Exim is built with an embedded Perl
29629 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
29630 </para>
29631 <para>
29632 <indexterm role="option">
29633 <primary><option>perl_startup</option></primary>
29634 </indexterm>
29635 </para>
29636 <informaltable frame="all">
29637 <tgroup cols="4" colsep="0" rowsep="0">
29638 <colspec colwidth="8*" align="left"/>
29639 <colspec colwidth="6*" align="center"/>
29640 <colspec colwidth="6*" align="center"/>
29641 <colspec colwidth="6*" align="right"/>
29642 <tbody>
29643 <row>
29644 <entry><option>perl_startup</option></entry>
29645 <entry>Use: <emphasis>main</emphasis></entry>
29646 <entry>Type: <emphasis>string</emphasis></entry>
29647 <entry>Default: <emphasis>unset</emphasis></entry>
29648 </row>
29649 </tbody>
29650 </tgroup>
29651 </informaltable>
29652 <para>
29653 <indexterm role="concept">
29654 <primary>Perl</primary>
29655 </indexterm>
29656 This option is available only when Exim is built with an embedded Perl
29657 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
29658 </para>
29659 <para>
29660 <indexterm role="option">
29661 <primary><option>perl_taintmode</option></primary>
29662 </indexterm>
29663 </para>
29664 <informaltable frame="all">
29665 <tgroup cols="4" colsep="0" rowsep="0">
29666 <colspec colwidth="8*" align="left"/>
29667 <colspec colwidth="6*" align="center"/>
29668 <colspec colwidth="6*" align="center"/>
29669 <colspec colwidth="6*" align="right"/>
29670 <tbody>
29671 <row>
29672 <entry><option>perl_taintmode</option></entry>
29673 <entry>Use: <emphasis>main</emphasis></entry>
29674 <entry>Type: <emphasis>boolean</emphasis></entry>
29675 <entry>Default: <emphasis>false</emphasis></entry>
29676 </row>
29677 </tbody>
29678 </tgroup>
29679 </informaltable>
29680 <para>
29681 <indexterm role="concept">
29682 <primary>Perl</primary>
29683 </indexterm>
29684 This option enables the taint mode of the embedded Perl interpreter.
29685 </para>
29686 <para>
29687 <indexterm role="option">
29688 <primary><option>pgsql_servers</option></primary>
29689 </indexterm>
29690 </para>
29691 <informaltable frame="all">
29692 <tgroup cols="4" colsep="0" rowsep="0">
29693 <colspec colwidth="8*" align="left"/>
29694 <colspec colwidth="6*" align="center"/>
29695 <colspec colwidth="6*" align="center"/>
29696 <colspec colwidth="6*" align="right"/>
29697 <tbody>
29698 <row>
29699 <entry><option>pgsql_servers</option></entry>
29700 <entry>Use: <emphasis>main</emphasis></entry>
29701 <entry>Type: <emphasis>string list</emphasis></entry>
29702 <entry>Default: <emphasis>unset</emphasis></entry>
29703 </row>
29704 </tbody>
29705 </tgroup>
29706 </informaltable>
29707 <para>
29708 <indexterm role="concept">
29709 <primary>PostgreSQL lookup type</primary>
29710 <secondary>server list</secondary>
29711 </indexterm>
29712 This option provides a list of PostgreSQL servers and associated connection
29713 data, to be used in conjunction with <command>pgsql</command> lookups (see section
29714 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
29715 PostgreSQL support.
29716 </para>
29717 <para>
29718 <indexterm role="option">
29719 <primary><option>pid_file_path</option></primary>
29720 </indexterm>
29721 </para>
29722 <informaltable frame="all">
29723 <tgroup cols="4" colsep="0" rowsep="0">
29724 <colspec colwidth="8*" align="left"/>
29725 <colspec colwidth="6*" align="center"/>
29726 <colspec colwidth="6*" align="center"/>
29727 <colspec colwidth="6*" align="right"/>
29728 <tbody>
29729 <row>
29730 <entry><option>pid_file_path</option></entry>
29731 <entry>Use: <emphasis>main</emphasis></entry>
29732 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29733 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29734 </row>
29735 </tbody>
29736 </tgroup>
29737 </informaltable>
29738 <para>
29739 <indexterm role="concept">
29740 <primary>daemon</primary>
29741 <secondary>pid file path</secondary>
29742 </indexterm>
29743 <indexterm role="concept">
29744 <primary>pid file, path for</primary>
29745 </indexterm>
29746 This option sets the name of the file to which the Exim daemon writes its
29747 process id. The string is expanded, so it can contain, for example, references
29748 to the host name:
29749 </para>
29750 <literallayout class="monospaced">
29751 pid_file_path = /var/log/$primary_hostname/exim.pid
29752 </literallayout>
29753 <para>
29754 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
29755 spool directory.
29756 The value set by the option can be overridden by the <option>-oP</option> command line
29757 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
29758 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
29759 </para>
29760 <para>
29761 <indexterm role="option">
29762 <primary><option>pipelining_advertise_hosts</option></primary>
29763 </indexterm>
29764 </para>
29765 <informaltable frame="all">
29766 <tgroup cols="4" colsep="0" rowsep="0">
29767 <colspec colwidth="8*" align="left"/>
29768 <colspec colwidth="6*" align="center"/>
29769 <colspec colwidth="6*" align="center"/>
29770 <colspec colwidth="6*" align="right"/>
29771 <tbody>
29772 <row>
29773 <entry><option>pipelining_advertise_hosts</option></entry>
29774 <entry>Use: <emphasis>main</emphasis></entry>
29775 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29776 <entry>Default: <emphasis>*</emphasis></entry>
29777 </row>
29778 </tbody>
29779 </tgroup>
29780 </informaltable>
29781 <para>
29782 <indexterm role="concept">
29783 <primary>PIPELINING</primary>
29784 <secondary>suppressing advertising</secondary>
29785 </indexterm>
29786 <indexterm role="concept">
29787 <primary>ESMTP extensions</primary>
29788 <secondary>PIPELINING</secondary>
29789 </indexterm>
29790 This option can be used to suppress the advertisement of the SMTP
29791 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
29792 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
29793 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
29794 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
29795 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
29796 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
29797 </para>
29798 <para>
29799 <indexterm role="option">
29800 <primary><option>pipelining_connect_advertise_hosts</option></primary>
29801 </indexterm>
29802 </para>
29803 <informaltable frame="all">
29804 <tgroup cols="4" colsep="0" rowsep="0">
29805 <colspec colwidth="8*" align="left"/>
29806 <colspec colwidth="6*" align="center"/>
29807 <colspec colwidth="6*" align="center"/>
29808 <colspec colwidth="6*" align="right"/>
29809 <tbody>
29810 <row>
29811 <entry><option>pipelining_connect_advertise_hosts</option></entry>
29812 <entry>Use: <emphasis>main</emphasis></entry>
29813 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29814 <entry>Default: <emphasis>*</emphasis></entry>
29815 </row>
29816 </tbody>
29817 </tgroup>
29818 </informaltable>
29819 <para>
29820 <indexterm role="concept">
29821 <primary>pipelining</primary>
29822 <secondary>early connection</secondary>
29823 </indexterm>
29824 <indexterm role="concept">
29825 <primary>pipelining</primary>
29826 <secondary>PIPE_CONNECT</secondary>
29827 </indexterm>
29828 <indexterm role="concept">
29829 <primary>ESMTP extensions</primary>
29830 <secondary>X_PIPE_CONNECT</secondary>
29831 </indexterm>
29832 If Exim is built with the SUPPORT_PIPE_CONNECT build option
29833 this option controls which hosts the facility is advertised to
29834 and from which pipeline early-connection (before MAIL) SMTP
29835 commands are acceptable.
29836 When used, the pipelining saves on roundtrip times.
29837 </para>
29838 <para>
29839 See also the <option>hosts_pipe_connect</option> smtp transport option.
29840 </para>
29841 <para>
29842 Currently the option name <quote>X_PIPE_CONNECT</quote> is used.
29843 </para>
29844 <para>
29845 <indexterm role="option">
29846 <primary><option>prdr_enable</option></primary>
29847 </indexterm>
29848 </para>
29849 <informaltable frame="all">
29850 <tgroup cols="4" colsep="0" rowsep="0">
29851 <colspec colwidth="8*" align="left"/>
29852 <colspec colwidth="6*" align="center"/>
29853 <colspec colwidth="6*" align="center"/>
29854 <colspec colwidth="6*" align="right"/>
29855 <tbody>
29856 <row>
29857 <entry><option>prdr_enable</option></entry>
29858 <entry>Use: <emphasis>main</emphasis></entry>
29859 <entry>Type: <emphasis>boolean</emphasis></entry>
29860 <entry>Default: <emphasis>false</emphasis></entry>
29861 </row>
29862 </tbody>
29863 </tgroup>
29864 </informaltable>
29865 <para>
29866 <indexterm role="concept">
29867 <primary>PRDR</primary>
29868 <secondary>enabling on server</secondary>
29869 </indexterm>
29870 <indexterm role="concept">
29871 <primary>ESMTP extensions</primary>
29872 <secondary>PRDR</secondary>
29873 </indexterm>
29874 This option can be used to enable the Per-Recipient Data Response extension
29875 to SMTP, defined by Eric Hall.
29876 If the option is set, PRDR is advertised by Exim when operating as a server.
29877 If the client requests PRDR, and more than one recipient, for a message
29878 an additional ACL is called for each recipient after the message content
29879 is received.  See section <xref linkend="SECTPRDRACL"/>.
29880 </para>
29881 <para>
29882 <indexterm role="option">
29883 <primary><option>preserve_message_logs</option></primary>
29884 </indexterm>
29885 </para>
29886 <informaltable frame="all">
29887 <tgroup cols="4" colsep="0" rowsep="0">
29888 <colspec colwidth="8*" align="left"/>
29889 <colspec colwidth="6*" align="center"/>
29890 <colspec colwidth="6*" align="center"/>
29891 <colspec colwidth="6*" align="right"/>
29892 <tbody>
29893 <row>
29894 <entry><option>preserve_message_logs</option></entry>
29895 <entry>Use: <emphasis>main</emphasis></entry>
29896 <entry>Type: <emphasis>boolean</emphasis></entry>
29897 <entry>Default: <emphasis>false</emphasis></entry>
29898 </row>
29899 </tbody>
29900 </tgroup>
29901 </informaltable>
29902 <para>
29903 <indexterm role="concept">
29904 <primary>message logs</primary>
29905 <secondary>preserving</secondary>
29906 </indexterm>
29907 If this option is set, message log files are not deleted when messages are
29908 completed. Instead, they are moved to a sub-directory of the spool directory
29909 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
29910 purposes. This is a dangerous option to set on systems with any appreciable
29911 volume of mail. Use with care!
29912 </para>
29913 <para>
29914 <indexterm role="option">
29915 <primary><option>primary_hostname</option></primary>
29916 </indexterm>
29917 </para>
29918 <informaltable frame="all">
29919 <tgroup cols="4" colsep="0" rowsep="0">
29920 <colspec colwidth="8*" align="left"/>
29921 <colspec colwidth="6*" align="center"/>
29922 <colspec colwidth="6*" align="center"/>
29923 <colspec colwidth="6*" align="right"/>
29924 <tbody>
29925 <row>
29926 <entry><option>primary_hostname</option></entry>
29927 <entry>Use: <emphasis>main</emphasis></entry>
29928 <entry>Type: <emphasis>string</emphasis></entry>
29929 <entry>Default: <emphasis>see below</emphasis></entry>
29930 </row>
29931 </tbody>
29932 </tgroup>
29933 </informaltable>
29934 <para>
29935 <indexterm role="concept">
29936 <primary>name</primary>
29937 <secondary>of local host</secondary>
29938 </indexterm>
29939 <indexterm role="concept">
29940 <primary>host</primary>
29941 <secondary>name of local</secondary>
29942 </indexterm>
29943 <indexterm role="concept">
29944 <primary>local host</primary>
29945 <secondary>name of</secondary>
29946 </indexterm>
29947 <indexterm role="variable">
29948 <primary><varname>$primary_hostname</varname></primary>
29949 </indexterm>
29950 This specifies the name of the current host. It is used in the default EHLO or
29951 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
29952 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
29953 The value is also used by default in some SMTP response messages from an Exim
29954 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
29955 </para>
29956 <para>
29957 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
29958 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
29959 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
29960 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
29961 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
29962 explicitly by this option, or defaulted.
29963 </para>
29964 <para>
29965 <indexterm role="option">
29966 <primary><option>print_topbitchars</option></primary>
29967 </indexterm>
29968 </para>
29969 <informaltable frame="all">
29970 <tgroup cols="4" colsep="0" rowsep="0">
29971 <colspec colwidth="8*" align="left"/>
29972 <colspec colwidth="6*" align="center"/>
29973 <colspec colwidth="6*" align="center"/>
29974 <colspec colwidth="6*" align="right"/>
29975 <tbody>
29976 <row>
29977 <entry><option>print_topbitchars</option></entry>
29978 <entry>Use: <emphasis>main</emphasis></entry>
29979 <entry>Type: <emphasis>boolean</emphasis></entry>
29980 <entry>Default: <emphasis>false</emphasis></entry>
29981 </row>
29982 </tbody>
29983 </tgroup>
29984 </informaltable>
29985 <para>
29986 <indexterm role="concept">
29987 <primary>printing characters</primary>
29988 </indexterm>
29989 <indexterm role="concept">
29990 <primary>8-bit characters</primary>
29991 </indexterm>
29992 By default, Exim considers only those characters whose codes lie in the range
29993 32&ndash;126 to be printing characters. In a number of circumstances (for example,
29994 when writing log entries) non-printing characters are converted into escape
29995 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
29996 is set, code values of 128 and above are also considered to be printing
29997 characters.
29998 </para>
29999 <para>
30000 This option also affects the header syntax checks performed by the
30001 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
30002 the user&#x2019;s full name when constructing From: and Sender: addresses (as
30003 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
30004 Exim to generate eight bit message headers that do not conform to the
30005 standards.
30006 </para>
30007 <para>
30008 <indexterm role="option">
30009 <primary><option>process_log_path</option></primary>
30010 </indexterm>
30011 </para>
30012 <informaltable frame="all">
30013 <tgroup cols="4" colsep="0" rowsep="0">
30014 <colspec colwidth="8*" align="left"/>
30015 <colspec colwidth="6*" align="center"/>
30016 <colspec colwidth="6*" align="center"/>
30017 <colspec colwidth="6*" align="right"/>
30018 <tbody>
30019 <row>
30020 <entry><option>process_log_path</option></entry>
30021 <entry>Use: <emphasis>main</emphasis></entry>
30022 <entry>Type: <emphasis>string</emphasis></entry>
30023 <entry>Default: <emphasis>unset</emphasis></entry>
30024 </row>
30025 </tbody>
30026 </tgroup>
30027 </informaltable>
30028 <para>
30029 <indexterm role="concept">
30030 <primary>process log path</primary>
30031 </indexterm>
30032 <indexterm role="concept">
30033 <primary>log</primary>
30034 <secondary>process log</secondary>
30035 </indexterm>
30036 <indexterm role="concept">
30037 <primary><emphasis>exiwhat</emphasis></primary>
30038 </indexterm>
30039 This option sets the name of the file to which an Exim process writes its
30040 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
30041 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
30042 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
30043 can be useful in environments where two different Exims are running, using
30044 different spool directories.
30045 </para>
30046 <para>
30047 <indexterm role="option">
30048 <primary><option>prod_requires_admin</option></primary>
30049 </indexterm>
30050 </para>
30051 <informaltable frame="all">
30052 <tgroup cols="4" colsep="0" rowsep="0">
30053 <colspec colwidth="8*" align="left"/>
30054 <colspec colwidth="6*" align="center"/>
30055 <colspec colwidth="6*" align="center"/>
30056 <colspec colwidth="6*" align="right"/>
30057 <tbody>
30058 <row>
30059 <entry><option>prod_requires_admin</option></entry>
30060 <entry>Use: <emphasis>main</emphasis></entry>
30061 <entry>Type: <emphasis>boolean</emphasis></entry>
30062 <entry>Default: <emphasis>true</emphasis></entry>
30063 </row>
30064 </tbody>
30065 </tgroup>
30066 </informaltable>
30067 <para>
30068 <indexterm role="concept">
30069 <primary>restricting access to features</primary>
30070 </indexterm>
30071 <indexterm role="option">
30072 <primary><option>-M</option></primary>
30073 </indexterm>
30074 <indexterm role="option">
30075 <primary><option>-R</option></primary>
30076 </indexterm>
30077 <indexterm role="option">
30078 <primary><option>-q</option></primary>
30079 </indexterm>
30080 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
30081 admin user unless <option>prod_requires_admin</option> is set false. See also
30082 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
30083 </para>
30084 <para>
30085 <indexterm role="option">
30086 <primary><option>qualify_domain</option></primary>
30087 </indexterm>
30088 </para>
30089 <informaltable frame="all">
30090 <tgroup cols="4" colsep="0" rowsep="0">
30091 <colspec colwidth="8*" align="left"/>
30092 <colspec colwidth="6*" align="center"/>
30093 <colspec colwidth="6*" align="center"/>
30094 <colspec colwidth="6*" align="right"/>
30095 <tbody>
30096 <row>
30097 <entry><option>qualify_domain</option></entry>
30098 <entry>Use: <emphasis>main</emphasis></entry>
30099 <entry>Type: <emphasis>string</emphasis></entry>
30100 <entry>Default: <emphasis>see below</emphasis></entry>
30101 </row>
30102 </tbody>
30103 </tgroup>
30104 </informaltable>
30105 <para>
30106 <indexterm role="concept">
30107 <primary>domain</primary>
30108 <secondary>for qualifying addresses</secondary>
30109 </indexterm>
30110 <indexterm role="concept">
30111 <primary>address</primary>
30112 <secondary>qualification</secondary>
30113 </indexterm>
30114 This option specifies the domain name that is added to any envelope sender
30115 addresses that do not have a domain qualification. It also applies to
30116 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
30117 are accepted by default only for locally-generated messages. Qualification is
30118 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
30119 locally-generated messages, unless the <option>-bnq</option> command line option is used.
30120 </para>
30121 <para>
30122 Messages from external sources must always contain fully qualified addresses,
30123 unless the sending host matches <option>sender_unqualified_hosts</option> or
30124 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
30125 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
30126 necessary. Internally, Exim always works with fully qualified envelope
30127 addresses. If <option>qualify_domain</option> is not set, it defaults to the
30128 <option>primary_hostname</option> value.
30129 </para>
30130 <para>
30131 <indexterm role="option">
30132 <primary><option>qualify_recipient</option></primary>
30133 </indexterm>
30134 </para>
30135 <informaltable frame="all">
30136 <tgroup cols="4" colsep="0" rowsep="0">
30137 <colspec colwidth="8*" align="left"/>
30138 <colspec colwidth="6*" align="center"/>
30139 <colspec colwidth="6*" align="center"/>
30140 <colspec colwidth="6*" align="right"/>
30141 <tbody>
30142 <row>
30143 <entry><option>qualify_recipient</option></entry>
30144 <entry>Use: <emphasis>main</emphasis></entry>
30145 <entry>Type: <emphasis>string</emphasis></entry>
30146 <entry>Default: <emphasis>see below</emphasis></entry>
30147 </row>
30148 </tbody>
30149 </tgroup>
30150 </informaltable>
30151 <para>
30152 This option allows you to specify a different domain for qualifying recipient
30153 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
30154 </para>
30155 <para>
30156 <indexterm role="option">
30157 <primary><option>queue_domains</option></primary>
30158 </indexterm>
30159 </para>
30160 <informaltable frame="all">
30161 <tgroup cols="4" colsep="0" rowsep="0">
30162 <colspec colwidth="8*" align="left"/>
30163 <colspec colwidth="6*" align="center"/>
30164 <colspec colwidth="6*" align="center"/>
30165 <colspec colwidth="6*" align="right"/>
30166 <tbody>
30167 <row>
30168 <entry><option>queue_domains</option></entry>
30169 <entry>Use: <emphasis>main</emphasis></entry>
30170 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30171 <entry>Default: <emphasis>unset</emphasis></entry>
30172 </row>
30173 </tbody>
30174 </tgroup>
30175 </informaltable>
30176 <para>
30177 <indexterm role="concept">
30178 <primary>domain</primary>
30179 <secondary>specifying non-immediate delivery</secondary>
30180 </indexterm>
30181 <indexterm role="concept">
30182 <primary>queueing incoming messages</primary>
30183 </indexterm>
30184 <indexterm role="concept">
30185 <primary>message</primary>
30186 <secondary>queueing certain domains</secondary>
30187 </indexterm>
30188 This option lists domains for which immediate delivery is not required.
30189 A delivery process is started whenever a message is received, but only those
30190 domains that do not match are processed. All other deliveries wait until the
30191 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
30192 </para>
30193 <para>
30194 <indexterm role="option">
30195 <primary><option>queue_list_requires_admin</option></primary>
30196 </indexterm>
30197 </para>
30198 <informaltable frame="all">
30199 <tgroup cols="4" colsep="0" rowsep="0">
30200 <colspec colwidth="8*" align="left"/>
30201 <colspec colwidth="6*" align="center"/>
30202 <colspec colwidth="6*" align="center"/>
30203 <colspec colwidth="6*" align="right"/>
30204 <tbody>
30205 <row>
30206 <entry><option>queue_list_requires_admin</option></entry>
30207 <entry>Use: <emphasis>main</emphasis></entry>
30208 <entry>Type: <emphasis>boolean</emphasis></entry>
30209 <entry>Default: <emphasis>true</emphasis></entry>
30210 </row>
30211 </tbody>
30212 </tgroup>
30213 </informaltable>
30214 <para>
30215 <indexterm role="concept">
30216 <primary>restricting access to features</primary>
30217 </indexterm>
30218 <indexterm role="option">
30219 <primary><option>-bp</option></primary>
30220 </indexterm>
30221 The <option>-bp</option> command-line option, which lists the messages that are on the
30222 queue, requires the caller to be an admin user unless
30223 <option>queue_list_requires_admin</option> is set false.
30224 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
30225 </para>
30226 <para>
30227 <indexterm role="option">
30228 <primary><option>queue_only</option></primary>
30229 </indexterm>
30230 </para>
30231 <informaltable frame="all">
30232 <tgroup cols="4" colsep="0" rowsep="0">
30233 <colspec colwidth="8*" align="left"/>
30234 <colspec colwidth="6*" align="center"/>
30235 <colspec colwidth="6*" align="center"/>
30236 <colspec colwidth="6*" align="right"/>
30237 <tbody>
30238 <row>
30239 <entry><option>queue_only</option></entry>
30240 <entry>Use: <emphasis>main</emphasis></entry>
30241 <entry>Type: <emphasis>boolean</emphasis></entry>
30242 <entry>Default: <emphasis>false</emphasis></entry>
30243 </row>
30244 </tbody>
30245 </tgroup>
30246 </informaltable>
30247 <para>
30248 <indexterm role="concept">
30249 <primary>queueing incoming messages</primary>
30250 </indexterm>
30251 <indexterm role="concept">
30252 <primary>message</primary>
30253 <secondary>queueing unconditionally</secondary>
30254 </indexterm>
30255 If <option>queue_only</option> is set, a delivery process is not automatically started
30256 whenever a message is received. Instead, the message waits in the queue for the
30257 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
30258 delivered immediately when certain conditions (such as heavy load) occur.
30259 </para>
30260 <para>
30261 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
30262 and <option>-odi</option> command line options override <option>queue_only</option> unless
30263 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
30264 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
30265 </para>
30266 <para>
30267 <indexterm role="option">
30268 <primary><option>queue_only_file</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_file</option></entry>
30280 <entry>Use: <emphasis>main</emphasis></entry>
30281 <entry>Type: <emphasis>string</emphasis></entry>
30282 <entry>Default: <emphasis>unset</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 by file existence</secondary>
30294 </indexterm>
30295 This option can be set to a colon-separated list of absolute path names, each
30296 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
30297 it tests for the existence of each listed path using a call to <function>stat()</function>. For
30298 each path that exists, the corresponding queueing option is set.
30299 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
30300 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
30301 </para>
30302 <literallayout class="monospaced">
30303 queue_only_file = smtp/some/file
30304 </literallayout>
30305 <para>
30306 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
30307 <filename>/some/file</filename> exists.
30308 </para>
30309 <para>
30310 <indexterm role="option">
30311 <primary><option>queue_only_load</option></primary>
30312 </indexterm>
30313 </para>
30314 <informaltable frame="all">
30315 <tgroup cols="4" colsep="0" rowsep="0">
30316 <colspec colwidth="8*" align="left"/>
30317 <colspec colwidth="6*" align="center"/>
30318 <colspec colwidth="6*" align="center"/>
30319 <colspec colwidth="6*" align="right"/>
30320 <tbody>
30321 <row>
30322 <entry><option>queue_only_load</option></entry>
30323 <entry>Use: <emphasis>main</emphasis></entry>
30324 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30325 <entry>Default: <emphasis>unset</emphasis></entry>
30326 </row>
30327 </tbody>
30328 </tgroup>
30329 </informaltable>
30330 <para>
30331 <indexterm role="concept">
30332 <primary>load average</primary>
30333 </indexterm>
30334 <indexterm role="concept">
30335 <primary>queueing incoming messages</primary>
30336 </indexterm>
30337 <indexterm role="concept">
30338 <primary>message</primary>
30339 <secondary>queueing by load</secondary>
30340 </indexterm>
30341 If the system load average is higher than this value, incoming messages from
30342 all sources are queued, and no automatic deliveries are started. If this
30343 happens during local or remote SMTP input, all subsequent messages received on
30344 the same SMTP connection are queued by default, whatever happens to the load in
30345 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
30346 false.
30347 </para>
30348 <para>
30349 Deliveries will subsequently be performed by queue runner processes. This
30350 option has no effect on ancient operating systems on which Exim cannot
30351 determine the load average. See also <option>deliver_queue_load_max</option> and
30352 <option>smtp_load_reserve</option>.
30353 </para>
30354 <para>
30355 <indexterm role="option">
30356 <primary><option>queue_only_load_latch</option></primary>
30357 </indexterm>
30358 </para>
30359 <informaltable frame="all">
30360 <tgroup cols="4" colsep="0" rowsep="0">
30361 <colspec colwidth="8*" align="left"/>
30362 <colspec colwidth="6*" align="center"/>
30363 <colspec colwidth="6*" align="center"/>
30364 <colspec colwidth="6*" align="right"/>
30365 <tbody>
30366 <row>
30367 <entry><option>queue_only_load_latch</option></entry>
30368 <entry>Use: <emphasis>main</emphasis></entry>
30369 <entry>Type: <emphasis>boolean</emphasis></entry>
30370 <entry>Default: <emphasis>true</emphasis></entry>
30371 </row>
30372 </tbody>
30373 </tgroup>
30374 </informaltable>
30375 <para>
30376 <indexterm role="concept">
30377 <primary>load average</primary>
30378 <secondary>re-evaluating per message</secondary>
30379 </indexterm>
30380 When this option is true (the default), once one message has been queued
30381 because the load average is higher than the value set by <option>queue_only_load</option>,
30382 all subsequent messages received on the same SMTP connection are also queued.
30383 This is a deliberate choice; even though the load average may fall below the
30384 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
30385 connection when not delivering earlier ones. However, there are special
30386 circumstances such as very long-lived connections from scanning appliances
30387 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
30388 should be set false. This causes the value of the load average to be
30389 re-evaluated for each message.
30390 </para>
30391 <para>
30392 <indexterm role="option">
30393 <primary><option>queue_only_override</option></primary>
30394 </indexterm>
30395 </para>
30396 <informaltable frame="all">
30397 <tgroup cols="4" colsep="0" rowsep="0">
30398 <colspec colwidth="8*" align="left"/>
30399 <colspec colwidth="6*" align="center"/>
30400 <colspec colwidth="6*" align="center"/>
30401 <colspec colwidth="6*" align="right"/>
30402 <tbody>
30403 <row>
30404 <entry><option>queue_only_override</option></entry>
30405 <entry>Use: <emphasis>main</emphasis></entry>
30406 <entry>Type: <emphasis>boolean</emphasis></entry>
30407 <entry>Default: <emphasis>true</emphasis></entry>
30408 </row>
30409 </tbody>
30410 </tgroup>
30411 </informaltable>
30412 <para>
30413 <indexterm role="concept">
30414 <primary>queueing incoming messages</primary>
30415 </indexterm>
30416 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
30417 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
30418 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
30419 to override; they are accepted, but ignored.
30420 </para>
30421 <para>
30422 <indexterm role="option">
30423 <primary><option>queue_run_in_order</option></primary>
30424 </indexterm>
30425 </para>
30426 <informaltable frame="all">
30427 <tgroup cols="4" colsep="0" rowsep="0">
30428 <colspec colwidth="8*" align="left"/>
30429 <colspec colwidth="6*" align="center"/>
30430 <colspec colwidth="6*" align="center"/>
30431 <colspec colwidth="6*" align="right"/>
30432 <tbody>
30433 <row>
30434 <entry><option>queue_run_in_order</option></entry>
30435 <entry>Use: <emphasis>main</emphasis></entry>
30436 <entry>Type: <emphasis>boolean</emphasis></entry>
30437 <entry>Default: <emphasis>false</emphasis></entry>
30438 </row>
30439 </tbody>
30440 </tgroup>
30441 </informaltable>
30442 <para>
30443 <indexterm role="concept">
30444 <primary>queue runner</primary>
30445 <secondary>processing messages in order</secondary>
30446 </indexterm>
30447 If this option is set, queue runs happen in order of message arrival instead of
30448 in an arbitrary order. For this to happen, a complete list of the entire queue
30449 must be set up before the deliveries start. When the queue is all held in a
30450 single directory (the default), a single list is created for both the ordered
30451 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
30452 single list is not created when <option>queue_run_in_order</option> is false. In this case,
30453 the sub-directories are processed one at a time (in a random order), and this
30454 avoids setting up one huge list for the whole queue. Thus, setting
30455 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
30456 when the queue is large, because of the extra work in setting up the single,
30457 large list. In most situations, <option>queue_run_in_order</option> should not be set.
30458 </para>
30459 <para>
30460 <indexterm role="option">
30461 <primary><option>queue_run_max</option></primary>
30462 </indexterm>
30463 </para>
30464 <informaltable frame="all">
30465 <tgroup cols="4" colsep="0" rowsep="0">
30466 <colspec colwidth="8*" align="left"/>
30467 <colspec colwidth="6*" align="center"/>
30468 <colspec colwidth="6*" align="center"/>
30469 <colspec colwidth="6*" align="right"/>
30470 <tbody>
30471 <row>
30472 <entry><option>queue_run_max</option></entry>
30473 <entry>Use: <emphasis>main</emphasis></entry>
30474 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
30475 <entry>Default: <emphasis>5</emphasis></entry>
30476 </row>
30477 </tbody>
30478 </tgroup>
30479 </informaltable>
30480 <para>
30481 <indexterm role="concept">
30482 <primary>queue runner</primary>
30483 <secondary>maximum number of</secondary>
30484 </indexterm>
30485 This controls the maximum number of queue runner processes that an Exim daemon
30486 can run simultaneously. This does not mean that it starts them all at once,
30487 but rather that if the maximum number are still running when the time comes to
30488 start another one, it refrains from starting another one. This can happen with
30489 very large queues and/or very sluggish deliveries. This option does not,
30490 however, interlock with other processes, so additional queue runners can be
30491 started by other means, or by killing and restarting the daemon.
30492 </para>
30493 <para>
30494 Setting this option to zero does not suppress queue runs; rather, it disables
30495 the limit, allowing any number of simultaneous queue runner processes to be
30496 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
30497 the daemon&#x2019;s command line.
30498 </para>
30499 <para>
30500 <indexterm role="concept">
30501 <primary>queues</primary>
30502 <secondary>named</secondary>
30503 </indexterm>
30504 <indexterm role="concept">
30505 <primary>named queues</primary>
30506 <secondary>resource limit</secondary>
30507 </indexterm>
30508 To set limits for different named queues use
30509 an expansion depending on the <varname>$queue_name</varname> variable.
30510 </para>
30511 <para>
30512 <indexterm role="option">
30513 <primary><option>queue_smtp_domains</option></primary>
30514 </indexterm>
30515 </para>
30516 <informaltable frame="all">
30517 <tgroup cols="4" colsep="0" rowsep="0">
30518 <colspec colwidth="8*" align="left"/>
30519 <colspec colwidth="6*" align="center"/>
30520 <colspec colwidth="6*" align="center"/>
30521 <colspec colwidth="6*" align="right"/>
30522 <tbody>
30523 <row>
30524 <entry><option>queue_smtp_domains</option></entry>
30525 <entry>Use: <emphasis>main</emphasis></entry>
30526 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30527 <entry>Default: <emphasis>unset</emphasis></entry>
30528 </row>
30529 </tbody>
30530 </tgroup>
30531 </informaltable>
30532 <para>
30533 <indexterm role="concept">
30534 <primary>queueing incoming messages</primary>
30535 </indexterm>
30536 <indexterm role="concept">
30537 <primary>message</primary>
30538 <secondary>queueing remote deliveries</secondary>
30539 </indexterm>
30540 <indexterm role="concept">
30541 <primary>first pass routing</primary>
30542 </indexterm>
30543 When this option is set, a delivery process is started whenever a message is
30544 received, routing is performed, and local deliveries take place.
30545 However, if any SMTP deliveries are required for domains that match
30546 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
30547 message waits in the queue for the next queue run. Since routing of the message
30548 has taken place, Exim knows to which remote hosts it must be delivered, and so
30549 when the queue run happens, multiple messages for the same host are delivered
30550 over a single SMTP connection. The <option>-odqs</option> command line option causes all
30551 SMTP deliveries to be queued in this way, and is equivalent to setting
30552 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
30553 <option>queue_domains</option>.
30554 </para>
30555 <para>
30556 <indexterm role="option">
30557 <primary><option>receive_timeout</option></primary>
30558 </indexterm>
30559 </para>
30560 <informaltable frame="all">
30561 <tgroup cols="4" colsep="0" rowsep="0">
30562 <colspec colwidth="8*" align="left"/>
30563 <colspec colwidth="6*" align="center"/>
30564 <colspec colwidth="6*" align="center"/>
30565 <colspec colwidth="6*" align="right"/>
30566 <tbody>
30567 <row>
30568 <entry><option>receive_timeout</option></entry>
30569 <entry>Use: <emphasis>main</emphasis></entry>
30570 <entry>Type: <emphasis>time</emphasis></entry>
30571 <entry>Default: <emphasis>0s</emphasis></entry>
30572 </row>
30573 </tbody>
30574 </tgroup>
30575 </informaltable>
30576 <para>
30577 <indexterm role="concept">
30578 <primary>timeout</primary>
30579 <secondary>for non-SMTP input</secondary>
30580 </indexterm>
30581 This option sets the timeout for accepting a non-SMTP message, that is, the
30582 maximum time that Exim waits when reading a message on the standard input. If
30583 the value is zero, it will wait forever. This setting is overridden by the
30584 <option>-or</option> command line option. The timeout for incoming SMTP messages is
30585 controlled by <option>smtp_receive_timeout</option>.
30586 </para>
30587 <para>
30588 <indexterm role="option">
30589 <primary><option>received_header_text</option></primary>
30590 </indexterm>
30591 </para>
30592 <informaltable frame="all">
30593 <tgroup cols="4" colsep="0" rowsep="0">
30594 <colspec colwidth="8*" align="left"/>
30595 <colspec colwidth="6*" align="center"/>
30596 <colspec colwidth="6*" align="center"/>
30597 <colspec colwidth="6*" align="right"/>
30598 <tbody>
30599 <row>
30600 <entry><option>received_header_text</option></entry>
30601 <entry>Use: <emphasis>main</emphasis></entry>
30602 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30603 <entry>Default: <emphasis>see below</emphasis></entry>
30604 </row>
30605 </tbody>
30606 </tgroup>
30607 </informaltable>
30608 <para>
30609 <indexterm role="concept">
30610 <primary>customizing</primary>
30611 <secondary><emphasis>Received:</emphasis> header</secondary>
30612 </indexterm>
30613 <indexterm role="concept">
30614 <primary><emphasis>Received:</emphasis> header line</primary>
30615 <secondary>customizing</secondary>
30616 </indexterm>
30617 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
30618 added to each message, except for the timestamp, which is automatically added
30619 on at the end (preceded by a semicolon). The string is expanded each time it is
30620 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
30621 added to the message. Otherwise, the string should start with the text
30622 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
30623 header lines.
30624 The default setting is:
30625 </para>
30626 <literallayout class="monospaced">
30627 received_header_text = Received: \
30628   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
30629     {${if def:sender_ident \
30630       {from ${quote_local_part:$sender_ident} }}\
30631         ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
30632   by $primary_hostname \
30633   ${if def:received_protocol {with $received_protocol }}\
30634   ${if def:tls_in_ver        { ($tls_in_ver)}}\
30635   ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\
30636   (Exim $version_number)\n\t\
30637   ${if def:sender_address \
30638   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
30639   id $message_exim_id\
30640   ${if def:received_for {\n\tfor $received_for}}
30641 </literallayout>
30642 <para>
30643 The references to the TLS version and cipher are
30644 omitted when Exim is built without TLS
30645 support. The use of conditional expansions ensures that this works for both
30646 locally generated messages and messages received from remote hosts, giving
30647 header lines such as the following:
30648 </para>
30649 <literallayout class="monospaced">
30650 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
30651 by marley.carol.example with esmtp (Exim 4.00)
30652 (envelope-from &lt;bob@carol.example&gt;)
30653 id 16IOWa-00019l-00
30654 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
30655 Received: by scrooge.carol.example with local (Exim 4.00)
30656 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
30657 </literallayout>
30658 <para>
30659 Until the body of the message has been received, the timestamp is the time when
30660 the message started to be received. Once the body has arrived, and all policy
30661 checks have taken place, the timestamp is updated to the time at which the
30662 message was accepted.
30663 </para>
30664 <para>
30665 <indexterm role="option">
30666 <primary><option>received_headers_max</option></primary>
30667 </indexterm>
30668 </para>
30669 <informaltable frame="all">
30670 <tgroup cols="4" colsep="0" rowsep="0">
30671 <colspec colwidth="8*" align="left"/>
30672 <colspec colwidth="6*" align="center"/>
30673 <colspec colwidth="6*" align="center"/>
30674 <colspec colwidth="6*" align="right"/>
30675 <tbody>
30676 <row>
30677 <entry><option>received_headers_max</option></entry>
30678 <entry>Use: <emphasis>main</emphasis></entry>
30679 <entry>Type: <emphasis>integer</emphasis></entry>
30680 <entry>Default: <emphasis>30</emphasis></entry>
30681 </row>
30682 </tbody>
30683 </tgroup>
30684 </informaltable>
30685 <para>
30686 <indexterm role="concept">
30687 <primary>loop</primary>
30688 <secondary>prevention</secondary>
30689 </indexterm>
30690 <indexterm role="concept">
30691 <primary>mail loop prevention</primary>
30692 </indexterm>
30693 <indexterm role="concept">
30694 <primary><emphasis>Received:</emphasis> header line</primary>
30695 <secondary>counting</secondary>
30696 </indexterm>
30697 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
30698 counted, and if it is greater than this parameter, a mail loop is assumed to
30699 have occurred, the delivery is abandoned, and an error message is generated.
30700 This applies to both local and remote deliveries.
30701 </para>
30702 <para>
30703 <indexterm role="option">
30704 <primary><option>recipient_unqualified_hosts</option></primary>
30705 </indexterm>
30706 </para>
30707 <informaltable frame="all">
30708 <tgroup cols="4" colsep="0" rowsep="0">
30709 <colspec colwidth="8*" align="left"/>
30710 <colspec colwidth="6*" align="center"/>
30711 <colspec colwidth="6*" align="center"/>
30712 <colspec colwidth="6*" align="right"/>
30713 <tbody>
30714 <row>
30715 <entry><option>recipient_unqualified_hosts</option></entry>
30716 <entry>Use: <emphasis>main</emphasis></entry>
30717 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30718 <entry>Default: <emphasis>unset</emphasis></entry>
30719 </row>
30720 </tbody>
30721 </tgroup>
30722 </informaltable>
30723 <para>
30724 <indexterm role="concept">
30725 <primary>unqualified addresses</primary>
30726 </indexterm>
30727 <indexterm role="concept">
30728 <primary>host</primary>
30729 <secondary>unqualified addresses from</secondary>
30730 </indexterm>
30731 This option lists those hosts from which Exim is prepared to accept unqualified
30732 recipient addresses in message envelopes. The addresses are made fully
30733 qualified by the addition of the <option>qualify_recipient</option> value. This option also
30734 affects message header lines. Exim does not reject unqualified recipient
30735 addresses in headers, but it qualifies them only if the message came from a
30736 host that matches <option>recipient_unqualified_hosts</option>,
30737 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
30738 option was not set.
30739 </para>
30740 <para>
30741 <indexterm role="option">
30742 <primary><option>recipients_max</option></primary>
30743 </indexterm>
30744 </para>
30745 <informaltable frame="all">
30746 <tgroup cols="4" colsep="0" rowsep="0">
30747 <colspec colwidth="8*" align="left"/>
30748 <colspec colwidth="6*" align="center"/>
30749 <colspec colwidth="6*" align="center"/>
30750 <colspec colwidth="6*" align="right"/>
30751 <tbody>
30752 <row>
30753 <entry><option>recipients_max</option></entry>
30754 <entry>Use: <emphasis>main</emphasis></entry>
30755 <entry>Type: <emphasis>integer</emphasis></entry>
30756 <entry>Default: <emphasis>0</emphasis></entry>
30757 </row>
30758 </tbody>
30759 </tgroup>
30760 </informaltable>
30761 <para>
30762 <indexterm role="concept">
30763 <primary>limit</primary>
30764 <secondary>number of recipients</secondary>
30765 </indexterm>
30766 <indexterm role="concept">
30767 <primary>recipient</primary>
30768 <secondary>maximum number</secondary>
30769 </indexterm>
30770 If this option is set greater than zero, it specifies the maximum number of
30771 original recipients for any message. Additional recipients that are generated
30772 by aliasing or forwarding do not count. SMTP messages get a 452 response for
30773 all recipients over the limit; earlier recipients are delivered as normal.
30774 Non-SMTP messages with too many recipients are failed, and no deliveries are
30775 done.
30776 </para>
30777 <para>
30778 <indexterm role="concept">
30779 <primary>RCPT</primary>
30780 <secondary>maximum number of incoming</secondary>
30781 </indexterm>
30782 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
30783 RCPT commands in a single message.
30784 </para>
30785 <para>
30786 <indexterm role="option">
30787 <primary><option>recipients_max_reject</option></primary>
30788 </indexterm>
30789 </para>
30790 <informaltable frame="all">
30791 <tgroup cols="4" colsep="0" rowsep="0">
30792 <colspec colwidth="8*" align="left"/>
30793 <colspec colwidth="6*" align="center"/>
30794 <colspec colwidth="6*" align="center"/>
30795 <colspec colwidth="6*" align="right"/>
30796 <tbody>
30797 <row>
30798 <entry><option>recipients_max_reject</option></entry>
30799 <entry>Use: <emphasis>main</emphasis></entry>
30800 <entry>Type: <emphasis>boolean</emphasis></entry>
30801 <entry>Default: <emphasis>false</emphasis></entry>
30802 </row>
30803 </tbody>
30804 </tgroup>
30805 </informaltable>
30806 <para>
30807 If this option is set true, Exim rejects SMTP messages containing too many
30808 recipients by giving 552 errors to the surplus RCPT commands, and a 554
30809 error to the eventual DATA command. Otherwise (the default) it gives a 452
30810 error to the surplus RCPT commands and accepts the message on behalf of the
30811 initial set of recipients. The remote server should then re-send the message
30812 for the remaining recipients at a later time.
30813 </para>
30814 <para>
30815 <indexterm role="option">
30816 <primary><option>remote_max_parallel</option></primary>
30817 </indexterm>
30818 </para>
30819 <informaltable frame="all">
30820 <tgroup cols="4" colsep="0" rowsep="0">
30821 <colspec colwidth="8*" align="left"/>
30822 <colspec colwidth="6*" align="center"/>
30823 <colspec colwidth="6*" align="center"/>
30824 <colspec colwidth="6*" align="right"/>
30825 <tbody>
30826 <row>
30827 <entry><option>remote_max_parallel</option></entry>
30828 <entry>Use: <emphasis>main</emphasis></entry>
30829 <entry>Type: <emphasis>integer</emphasis></entry>
30830 <entry>Default: <emphasis>2</emphasis></entry>
30831 </row>
30832 </tbody>
30833 </tgroup>
30834 </informaltable>
30835 <para>
30836 <indexterm role="concept">
30837 <primary>delivery</primary>
30838 <secondary>parallelism for remote</secondary>
30839 </indexterm>
30840 This option controls parallel delivery of one message to a number of remote
30841 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
30842 does all the remote deliveries for a message one by one. Otherwise, if a single
30843 message has to be delivered to more than one remote host, or if several copies
30844 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
30845 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
30846 deliveries are required, the maximum number of processes are started, and as
30847 each one finishes, another is begun. The order of starting processes is the
30848 same as if sequential delivery were being done, and can be controlled by the
30849 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
30850 with debugging turned on, the debugging output from each delivery process is
30851 tagged with its process id.
30852 </para>
30853 <para>
30854 This option controls only the maximum number of parallel deliveries for one
30855 message in one Exim delivery process. Because Exim has no central queue
30856 manager, there is no way of controlling the total number of simultaneous
30857 deliveries if the configuration allows a delivery attempt as soon as a message
30858 is received.
30859 </para>
30860 <para>
30861 <indexterm role="concept">
30862 <primary>number of deliveries</primary>
30863 </indexterm>
30864 <indexterm role="concept">
30865 <primary>delivery</primary>
30866 <secondary>maximum number of</secondary>
30867 </indexterm>
30868 If you want to control the total number of deliveries on the system, you
30869 need to set the <option>queue_only</option> option. This ensures that all incoming messages
30870 are added to the queue without starting a delivery process. Then set up an Exim
30871 daemon to start queue runner processes at appropriate intervals (probably
30872 fairly often, for example, every minute), and limit the total number of queue
30873 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
30874 delivers only one message at a time, the maximum number of deliveries that can
30875 then take place at once is <option>queue_run_max</option> multiplied by
30876 <option>remote_max_parallel</option>.
30877 </para>
30878 <para>
30879 If it is purely remote deliveries you want to control, use
30880 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
30881 doing the SMTP routing before queueing, so that several messages for the same
30882 host will eventually get delivered down the same connection.
30883 </para>
30884 <para>
30885 <indexterm role="option">
30886 <primary><option>remote_sort_domains</option></primary>
30887 </indexterm>
30888 </para>
30889 <informaltable frame="all">
30890 <tgroup cols="4" colsep="0" rowsep="0">
30891 <colspec colwidth="8*" align="left"/>
30892 <colspec colwidth="6*" align="center"/>
30893 <colspec colwidth="6*" align="center"/>
30894 <colspec colwidth="6*" align="right"/>
30895 <tbody>
30896 <row>
30897 <entry><option>remote_sort_domains</option></entry>
30898 <entry>Use: <emphasis>main</emphasis></entry>
30899 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30900 <entry>Default: <emphasis>unset</emphasis></entry>
30901 </row>
30902 </tbody>
30903 </tgroup>
30904 </informaltable>
30905 <para>
30906 <indexterm role="concept">
30907 <primary>sorting remote deliveries</primary>
30908 </indexterm>
30909 <indexterm role="concept">
30910 <primary>delivery</primary>
30911 <secondary>sorting remote</secondary>
30912 </indexterm>
30913 When there are a number of remote deliveries for a message, they are sorted by
30914 domain into the order given by this list. For example,
30915 </para>
30916 <literallayout class="monospaced">
30917 remote_sort_domains = *.cam.ac.uk:*.uk
30918 </literallayout>
30919 <para>
30920 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
30921 then to those in the <option>uk</option> domain, then to any others.
30922 </para>
30923 <para>
30924 <indexterm role="option">
30925 <primary><option>retry_data_expire</option></primary>
30926 </indexterm>
30927 </para>
30928 <informaltable frame="all">
30929 <tgroup cols="4" colsep="0" rowsep="0">
30930 <colspec colwidth="8*" align="left"/>
30931 <colspec colwidth="6*" align="center"/>
30932 <colspec colwidth="6*" align="center"/>
30933 <colspec colwidth="6*" align="right"/>
30934 <tbody>
30935 <row>
30936 <entry><option>retry_data_expire</option></entry>
30937 <entry>Use: <emphasis>main</emphasis></entry>
30938 <entry>Type: <emphasis>time</emphasis></entry>
30939 <entry>Default: <emphasis>7d</emphasis></entry>
30940 </row>
30941 </tbody>
30942 </tgroup>
30943 </informaltable>
30944 <para>
30945 <indexterm role="concept">
30946 <primary>hints database</primary>
30947 <secondary>data expiry</secondary>
30948 </indexterm>
30949 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
30950 database. Any older retry data is ignored. This means that, for example, once a
30951 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
30952 past failures.
30953 </para>
30954 <para>
30955 <indexterm role="option">
30956 <primary><option>retry_interval_max</option></primary>
30957 </indexterm>
30958 </para>
30959 <informaltable frame="all">
30960 <tgroup cols="4" colsep="0" rowsep="0">
30961 <colspec colwidth="8*" align="left"/>
30962 <colspec colwidth="6*" align="center"/>
30963 <colspec colwidth="6*" align="center"/>
30964 <colspec colwidth="6*" align="right"/>
30965 <tbody>
30966 <row>
30967 <entry><option>retry_interval_max</option></entry>
30968 <entry>Use: <emphasis>main</emphasis></entry>
30969 <entry>Type: <emphasis>time</emphasis></entry>
30970 <entry>Default: <emphasis>24h</emphasis></entry>
30971 </row>
30972 </tbody>
30973 </tgroup>
30974 </informaltable>
30975 <para>
30976 <indexterm role="concept">
30977 <primary>retry</primary>
30978 <secondary>limit on interval</secondary>
30979 </indexterm>
30980 <indexterm role="concept">
30981 <primary>limit</primary>
30982 <secondary>on retry interval</secondary>
30983 </indexterm>
30984 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
30985 intervals between delivery attempts for messages that cannot be delivered
30986 straight away. This option sets an overall limit to the length of time between
30987 retries. It cannot be set greater than 24 hours; any attempt to do so forces
30988 the default value.
30989 </para>
30990 <para>
30991 <indexterm role="option">
30992 <primary><option>return_path_remove</option></primary>
30993 </indexterm>
30994 </para>
30995 <informaltable frame="all">
30996 <tgroup cols="4" colsep="0" rowsep="0">
30997 <colspec colwidth="8*" align="left"/>
30998 <colspec colwidth="6*" align="center"/>
30999 <colspec colwidth="6*" align="center"/>
31000 <colspec colwidth="6*" align="right"/>
31001 <tbody>
31002 <row>
31003 <entry><option>return_path_remove</option></entry>
31004 <entry>Use: <emphasis>main</emphasis></entry>
31005 <entry>Type: <emphasis>boolean</emphasis></entry>
31006 <entry>Default: <emphasis>true</emphasis></entry>
31007 </row>
31008 </tbody>
31009 </tgroup>
31010 </informaltable>
31011 <para>
31012 <indexterm role="concept">
31013 <primary><emphasis>Return-path:</emphasis> header line</primary>
31014 <secondary>removing</secondary>
31015 </indexterm>
31016 RFC 2821, section 4.4, states that an SMTP server must insert a
31017 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
31018 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
31019 MAIL command. This description implies that this header should not be present
31020 in an incoming message. If <option>return_path_remove</option> is true, any existing
31021 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
31022 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
31023 the time of delivery. They are normally used only for final local deliveries.
31024 </para>
31025 <para>
31026 <indexterm role="option">
31027 <primary><option>return_size_limit</option></primary>
31028 </indexterm>
31029 </para>
31030 <informaltable frame="all">
31031 <tgroup cols="4" colsep="0" rowsep="0">
31032 <colspec colwidth="8*" align="left"/>
31033 <colspec colwidth="6*" align="center"/>
31034 <colspec colwidth="6*" align="center"/>
31035 <colspec colwidth="6*" align="right"/>
31036 <tbody>
31037 <row>
31038 <entry><option>return_size_limit</option></entry>
31039 <entry>Use: <emphasis>main</emphasis></entry>
31040 <entry>Type: <emphasis>integer</emphasis></entry>
31041 <entry>Default: <emphasis>100K</emphasis></entry>
31042 </row>
31043 </tbody>
31044 </tgroup>
31045 </informaltable>
31046 <para>
31047 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
31048 </para>
31049 <para>
31050 <indexterm role="option">
31051 <primary><option>rfc1413_hosts</option></primary>
31052 </indexterm>
31053 </para>
31054 <informaltable frame="all">
31055 <tgroup cols="4" colsep="0" rowsep="0">
31056 <colspec colwidth="8*" align="left"/>
31057 <colspec colwidth="6*" align="center"/>
31058 <colspec colwidth="6*" align="center"/>
31059 <colspec colwidth="6*" align="right"/>
31060 <tbody>
31061 <row>
31062 <entry><option>rfc1413_hosts</option></entry>
31063 <entry>Use: <emphasis>main</emphasis></entry>
31064 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31065 <entry>Default: <emphasis>@[]</emphasis></entry>
31066 </row>
31067 </tbody>
31068 </tgroup>
31069 </informaltable>
31070 <para>
31071 <indexterm role="concept">
31072 <primary>RFC 1413</primary>
31073 </indexterm>
31074 <indexterm role="concept">
31075 <primary>host</primary>
31076 <secondary>for RFC 1413 calls</secondary>
31077 </indexterm>
31078 RFC 1413 identification calls are made to any client host which matches
31079 an item in the list.
31080 The default value specifies just this host, being any local interface
31081 for the system.
31082 </para>
31083 <para>
31084 <indexterm role="option">
31085 <primary><option>rfc1413_query_timeout</option></primary>
31086 </indexterm>
31087 </para>
31088 <informaltable frame="all">
31089 <tgroup cols="4" colsep="0" rowsep="0">
31090 <colspec colwidth="8*" align="left"/>
31091 <colspec colwidth="6*" align="center"/>
31092 <colspec colwidth="6*" align="center"/>
31093 <colspec colwidth="6*" align="right"/>
31094 <tbody>
31095 <row>
31096 <entry><option>rfc1413_query_timeout</option></entry>
31097 <entry>Use: <emphasis>main</emphasis></entry>
31098 <entry>Type: <emphasis>time</emphasis></entry>
31099 <entry>Default: <emphasis>0s</emphasis></entry>
31100 </row>
31101 </tbody>
31102 </tgroup>
31103 </informaltable>
31104 <para>
31105 <indexterm role="concept">
31106 <primary>RFC 1413</primary>
31107 <secondary>query timeout</secondary>
31108 </indexterm>
31109 <indexterm role="concept">
31110 <primary>timeout</primary>
31111 <secondary>for RFC 1413 call</secondary>
31112 </indexterm>
31113 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
31114 no RFC 1413 calls are ever made.
31115 </para>
31116 <para>
31117 <indexterm role="option">
31118 <primary><option>sender_unqualified_hosts</option></primary>
31119 </indexterm>
31120 </para>
31121 <informaltable frame="all">
31122 <tgroup cols="4" colsep="0" rowsep="0">
31123 <colspec colwidth="8*" align="left"/>
31124 <colspec colwidth="6*" align="center"/>
31125 <colspec colwidth="6*" align="center"/>
31126 <colspec colwidth="6*" align="right"/>
31127 <tbody>
31128 <row>
31129 <entry><option>sender_unqualified_hosts</option></entry>
31130 <entry>Use: <emphasis>main</emphasis></entry>
31131 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31132 <entry>Default: <emphasis>unset</emphasis></entry>
31133 </row>
31134 </tbody>
31135 </tgroup>
31136 </informaltable>
31137 <para>
31138 <indexterm role="concept">
31139 <primary>unqualified addresses</primary>
31140 </indexterm>
31141 <indexterm role="concept">
31142 <primary>host</primary>
31143 <secondary>unqualified addresses from</secondary>
31144 </indexterm>
31145 This option lists those hosts from which Exim is prepared to accept unqualified
31146 sender addresses. The addresses are made fully qualified by the addition of
31147 <option>qualify_domain</option>. This option also affects message header lines. Exim does
31148 not reject unqualified addresses in headers that contain sender addresses, but
31149 it qualifies them only if the message came from a host that matches
31150 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
31151 using TCP/IP), and the <option>-bnq</option> option was not set.
31152 </para>
31153 <para>
31154 <indexterm role="option">
31155 <primary><option>slow_lookup_log</option></primary>
31156 </indexterm>
31157 </para>
31158 <informaltable frame="all">
31159 <tgroup cols="4" colsep="0" rowsep="0">
31160 <colspec colwidth="8*" align="left"/>
31161 <colspec colwidth="6*" align="center"/>
31162 <colspec colwidth="6*" align="center"/>
31163 <colspec colwidth="6*" align="right"/>
31164 <tbody>
31165 <row>
31166 <entry><option>slow_lookup_log</option></entry>
31167 <entry>Use: <emphasis>main</emphasis></entry>
31168 <entry>Type: <emphasis>integer</emphasis></entry>
31169 <entry>Default: <emphasis>0</emphasis></entry>
31170 </row>
31171 </tbody>
31172 </tgroup>
31173 </informaltable>
31174 <para>
31175 <indexterm role="concept">
31176 <primary>logging</primary>
31177 <secondary>slow lookups</secondary>
31178 </indexterm>
31179 <indexterm role="concept">
31180 <primary>dns</primary>
31181 <secondary>logging slow lookups</secondary>
31182 </indexterm>
31183 This option controls logging of slow lookups.
31184 If the value is nonzero it is taken as a number of milliseconds
31185 and lookups taking longer than this are logged.
31186 Currently this applies only to DNS lookups.
31187 </para>
31188 <para>
31189 <indexterm role="option">
31190 <primary><option>smtp_accept_keepalive</option></primary>
31191 </indexterm>
31192 </para>
31193 <informaltable frame="all">
31194 <tgroup cols="4" colsep="0" rowsep="0">
31195 <colspec colwidth="8*" align="left"/>
31196 <colspec colwidth="6*" align="center"/>
31197 <colspec colwidth="6*" align="center"/>
31198 <colspec colwidth="6*" align="right"/>
31199 <tbody>
31200 <row>
31201 <entry><option>smtp_accept_keepalive</option></entry>
31202 <entry>Use: <emphasis>main</emphasis></entry>
31203 <entry>Type: <emphasis>boolean</emphasis></entry>
31204 <entry>Default: <emphasis>true</emphasis></entry>
31205 </row>
31206 </tbody>
31207 </tgroup>
31208 </informaltable>
31209 <para>
31210 <indexterm role="concept">
31211 <primary>keepalive</primary>
31212 <secondary>on incoming connection</secondary>
31213 </indexterm>
31214 This option controls the setting of the SO_KEEPALIVE option on incoming
31215 TCP/IP socket connections. When set, it causes the kernel to probe idle
31216 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
31217 other end of the connection should send an acknowledgment if the connection is
31218 still okay or a reset if the connection has been aborted. The reason for doing
31219 this is that it has the beneficial effect of freeing up certain types of
31220 connection that can get stuck when the remote host is disconnected without
31221 tidying up the TCP/IP call properly. The keepalive mechanism takes several
31222 hours to detect unreachable hosts.
31223 </para>
31224 <para>
31225 <indexterm role="option">
31226 <primary><option>smtp_accept_max</option></primary>
31227 </indexterm>
31228 </para>
31229 <informaltable frame="all">
31230 <tgroup cols="4" colsep="0" rowsep="0">
31231 <colspec colwidth="8*" align="left"/>
31232 <colspec colwidth="6*" align="center"/>
31233 <colspec colwidth="6*" align="center"/>
31234 <colspec colwidth="6*" align="right"/>
31235 <tbody>
31236 <row>
31237 <entry><option>smtp_accept_max</option></entry>
31238 <entry>Use: <emphasis>main</emphasis></entry>
31239 <entry>Type: <emphasis>integer</emphasis></entry>
31240 <entry>Default: <emphasis>20</emphasis></entry>
31241 </row>
31242 </tbody>
31243 </tgroup>
31244 </informaltable>
31245 <para>
31246 <indexterm role="concept">
31247 <primary>limit</primary>
31248 <secondary>incoming SMTP connections</secondary>
31249 </indexterm>
31250 <indexterm role="concept">
31251 <primary>SMTP</primary>
31252 <secondary>incoming connection count</secondary>
31253 </indexterm>
31254 <indexterm role="concept">
31255 <primary>inetd</primary>
31256 </indexterm>
31257 This option specifies the maximum number of simultaneous incoming SMTP calls
31258 that Exim will accept. It applies only to the listening daemon; there is no
31259 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
31260 value is set to zero, no limit is applied. However, it is required to be
31261 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
31262 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
31263 </para>
31264 <para>
31265 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
31266 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
31267 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
31268 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
31269 </para>
31270 <para>
31271 <indexterm role="option">
31272 <primary><option>smtp_accept_max_nonmail</option></primary>
31273 </indexterm>
31274 </para>
31275 <informaltable frame="all">
31276 <tgroup cols="4" colsep="0" rowsep="0">
31277 <colspec colwidth="8*" align="left"/>
31278 <colspec colwidth="6*" align="center"/>
31279 <colspec colwidth="6*" align="center"/>
31280 <colspec colwidth="6*" align="right"/>
31281 <tbody>
31282 <row>
31283 <entry><option>smtp_accept_max_nonmail</option></entry>
31284 <entry>Use: <emphasis>main</emphasis></entry>
31285 <entry>Type: <emphasis>integer</emphasis></entry>
31286 <entry>Default: <emphasis>10</emphasis></entry>
31287 </row>
31288 </tbody>
31289 </tgroup>
31290 </informaltable>
31291 <para>
31292 <indexterm role="concept">
31293 <primary>limit</primary>
31294 <secondary>non-mail SMTP commands</secondary>
31295 </indexterm>
31296 <indexterm role="concept">
31297 <primary>SMTP</primary>
31298 <secondary>limiting non-mail commands</secondary>
31299 </indexterm>
31300 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
31301 the connection if there are too many. This option defines <quote>too many</quote>. The
31302 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
31303 client looping sending EHLO, for example. The check is applied only if the
31304 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
31305 </para>
31306 <para>
31307 When a new message is expected, one occurrence of RSET is not counted. This
31308 allows a client to send one RSET between messages (this is not necessary,
31309 but some clients do it). Exim also allows one uncounted occurrence of HELO
31310 or EHLO, and one occurrence of STARTTLS between messages. After
31311 starting up a TLS session, another EHLO is expected, and so it too is not
31312 counted. The first occurrence of AUTH in a connection, or immediately
31313 following STARTTLS is not counted. Otherwise, all commands other than
31314 MAIL, RCPT, DATA, and QUIT are counted.
31315 </para>
31316 <para>
31317 <indexterm role="option">
31318 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
31319 </indexterm>
31320 </para>
31321 <informaltable frame="all">
31322 <tgroup cols="4" colsep="0" rowsep="0">
31323 <colspec colwidth="8*" align="left"/>
31324 <colspec colwidth="6*" align="center"/>
31325 <colspec colwidth="6*" align="center"/>
31326 <colspec colwidth="6*" align="right"/>
31327 <tbody>
31328 <row>
31329 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
31330 <entry>Use: <emphasis>main</emphasis></entry>
31331 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31332 <entry>Default: <emphasis>*</emphasis></entry>
31333 </row>
31334 </tbody>
31335 </tgroup>
31336 </informaltable>
31337 <para>
31338 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
31339 check by setting this option. The default value makes it apply to all hosts. By
31340 changing the value, you can exclude any badly-behaved hosts that you have to
31341 live with.
31342 </para>
31343 <para>
31344 <indexterm role="option">
31345 <primary><option>smtp_accept_max_per_connection</option></primary>
31346 </indexterm>
31347 </para>
31348 <informaltable frame="all">
31349 <tgroup cols="4" colsep="0" rowsep="0">
31350 <colspec colwidth="8*" align="left"/>
31351 <colspec colwidth="6*" align="center"/>
31352 <colspec colwidth="6*" align="center"/>
31353 <colspec colwidth="6*" align="right"/>
31354 <tbody>
31355 <row>
31356 <entry><option>smtp_accept_max_per_connection</option></entry>
31357 <entry>Use: <emphasis>main</emphasis></entry>
31358 <entry>Type: <emphasis>integer</emphasis></entry>
31359 <entry>Default: <emphasis>1000</emphasis></entry>
31360 </row>
31361 </tbody>
31362 </tgroup>
31363 </informaltable>
31364 <para>
31365 <indexterm role="concept">
31366 <primary>SMTP</primary>
31367 <secondary>limiting incoming message count</secondary>
31368 </indexterm>
31369 <indexterm role="concept">
31370 <primary>limit</primary>
31371 <secondary>messages per SMTP connection</secondary>
31372 </indexterm>
31373 The value of this option limits the number of MAIL commands that Exim is
31374 prepared to accept over a single SMTP connection, whether or not each command
31375 results in the transfer of a message. After the limit is reached, a 421
31376 response is given to subsequent MAIL commands. This limit is a safety
31377 precaution against a client that goes mad (incidents of this type have been
31378 seen).
31379 </para>
31380 <para>
31381 <indexterm role="option">
31382 <primary><option>smtp_accept_max_per_host</option></primary>
31383 </indexterm>
31384 </para>
31385 <informaltable frame="all">
31386 <tgroup cols="4" colsep="0" rowsep="0">
31387 <colspec colwidth="8*" align="left"/>
31388 <colspec colwidth="6*" align="center"/>
31389 <colspec colwidth="6*" align="center"/>
31390 <colspec colwidth="6*" align="right"/>
31391 <tbody>
31392 <row>
31393 <entry><option>smtp_accept_max_per_host</option></entry>
31394 <entry>Use: <emphasis>main</emphasis></entry>
31395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31396 <entry>Default: <emphasis>unset</emphasis></entry>
31397 </row>
31398 </tbody>
31399 </tgroup>
31400 </informaltable>
31401 <para>
31402 <indexterm role="concept">
31403 <primary>limit</primary>
31404 <secondary>SMTP connections from one host</secondary>
31405 </indexterm>
31406 <indexterm role="concept">
31407 <primary>host</primary>
31408 <secondary>limiting SMTP connections from</secondary>
31409 </indexterm>
31410 This option restricts the number of simultaneous IP connections from a single
31411 host (strictly, from a single IP address) to the Exim daemon. The option is
31412 expanded, to enable different limits to be applied to different hosts by
31413 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
31414 connection attempts from the same host are rejected with error code 421. This
31415 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
31416 of zero imposes no limit. If this option is set greater than zero, it is
31417 required that <option>smtp_accept_max</option> be non-zero.
31418 </para>
31419 <para>
31420 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
31421 constructions that take an appreciable amount of time. The expansion and test
31422 happen in the main daemon loop, in order to reject additional connections
31423 without forking additional processes (otherwise a denial-of-service attack
31424 could cause a vast number or processes to be created). While the daemon is
31425 doing this processing, it cannot accept any other incoming connections.
31426 </para>
31427 <para>
31428 <indexterm role="option">
31429 <primary><option>smtp_accept_queue</option></primary>
31430 </indexterm>
31431 </para>
31432 <informaltable frame="all">
31433 <tgroup cols="4" colsep="0" rowsep="0">
31434 <colspec colwidth="8*" align="left"/>
31435 <colspec colwidth="6*" align="center"/>
31436 <colspec colwidth="6*" align="center"/>
31437 <colspec colwidth="6*" align="right"/>
31438 <tbody>
31439 <row>
31440 <entry><option>smtp_accept_queue</option></entry>
31441 <entry>Use: <emphasis>main</emphasis></entry>
31442 <entry>Type: <emphasis>integer</emphasis></entry>
31443 <entry>Default: <emphasis>0</emphasis></entry>
31444 </row>
31445 </tbody>
31446 </tgroup>
31447 </informaltable>
31448 <para>
31449 <indexterm role="concept">
31450 <primary>SMTP</primary>
31451 <secondary>incoming connection count</secondary>
31452 </indexterm>
31453 <indexterm role="concept">
31454 <primary>queueing incoming messages</primary>
31455 </indexterm>
31456 <indexterm role="concept">
31457 <primary>message</primary>
31458 <secondary>queueing by SMTP connection count</secondary>
31459 </indexterm>
31460 If the number of simultaneous incoming SMTP connections being handled via the
31461 listening daemon exceeds this value, messages received by SMTP are just placed
31462 in the queue; no delivery processes are started automatically. The count is
31463 fixed at the start of an SMTP connection. It cannot be updated in the
31464 subprocess that receives messages, and so the queueing or not queueing applies
31465 to all messages received in the same connection.
31466 </para>
31467 <para>
31468 A value of zero implies no limit, and clearly any non-zero value is useful only
31469 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
31470 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
31471 various <option>-od</option><emphasis>x</emphasis> command line options.
31472 </para>
31473 <para>
31474 <indexterm role="option">
31475 <primary><option>smtp_accept_queue_per_connection</option></primary>
31476 </indexterm>
31477 </para>
31478 <informaltable frame="all">
31479 <tgroup cols="4" colsep="0" rowsep="0">
31480 <colspec colwidth="8*" align="left"/>
31481 <colspec colwidth="6*" align="center"/>
31482 <colspec colwidth="6*" align="center"/>
31483 <colspec colwidth="6*" align="right"/>
31484 <tbody>
31485 <row>
31486 <entry><option>smtp_accept_queue_per_connection</option></entry>
31487 <entry>Use: <emphasis>main</emphasis></entry>
31488 <entry>Type: <emphasis>integer</emphasis></entry>
31489 <entry>Default: <emphasis>10</emphasis></entry>
31490 </row>
31491 </tbody>
31492 </tgroup>
31493 </informaltable>
31494 <para>
31495 <indexterm role="concept">
31496 <primary>queueing incoming messages</primary>
31497 </indexterm>
31498 <indexterm role="concept">
31499 <primary>message</primary>
31500 <secondary>queueing by message count</secondary>
31501 </indexterm>
31502 This option limits the number of delivery processes that Exim starts
31503 automatically when receiving messages via SMTP, whether via the daemon or by
31504 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
31505 and the number of messages received in a single SMTP session exceeds this
31506 number, subsequent messages are placed in the queue, but no delivery processes
31507 are started. This helps to limit the number of Exim processes when a server
31508 restarts after downtime and there is a lot of mail waiting for it on other
31509 systems. On large systems, the default should probably be increased, and on
31510 dial-in client systems it should probably be set to zero (that is, disabled).
31511 </para>
31512 <para>
31513 <indexterm role="option">
31514 <primary><option>smtp_accept_reserve</option></primary>
31515 </indexterm>
31516 </para>
31517 <informaltable frame="all">
31518 <tgroup cols="4" colsep="0" rowsep="0">
31519 <colspec colwidth="8*" align="left"/>
31520 <colspec colwidth="6*" align="center"/>
31521 <colspec colwidth="6*" align="center"/>
31522 <colspec colwidth="6*" align="right"/>
31523 <tbody>
31524 <row>
31525 <entry><option>smtp_accept_reserve</option></entry>
31526 <entry>Use: <emphasis>main</emphasis></entry>
31527 <entry>Type: <emphasis>integer</emphasis></entry>
31528 <entry>Default: <emphasis>0</emphasis></entry>
31529 </row>
31530 </tbody>
31531 </tgroup>
31532 </informaltable>
31533 <para>
31534 <indexterm role="concept">
31535 <primary>SMTP</primary>
31536 <secondary>incoming call count</secondary>
31537 </indexterm>
31538 <indexterm role="concept">
31539 <primary>host</primary>
31540 <secondary>reserved</secondary>
31541 </indexterm>
31542 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
31543 number of SMTP connections that are reserved for connections from the hosts
31544 that are specified in <option>smtp_reserve_hosts</option>. The value set in
31545 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
31546 restricted to this number of connections; the option specifies a minimum number
31547 of connection slots for them, not a maximum. It is a guarantee that this group
31548 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
31549 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
31550 individual host.
31551 </para>
31552 <para>
31553 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
31554 set to 5, once there are 45 active connections (from any hosts), new
31555 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
31556 provided the other criteria for acceptance are met.
31557 </para>
31558 <para>
31559 <indexterm role="option">
31560 <primary><option>smtp_active_hostname</option></primary>
31561 </indexterm>
31562 </para>
31563 <informaltable frame="all">
31564 <tgroup cols="4" colsep="0" rowsep="0">
31565 <colspec colwidth="8*" align="left"/>
31566 <colspec colwidth="6*" align="center"/>
31567 <colspec colwidth="6*" align="center"/>
31568 <colspec colwidth="6*" align="right"/>
31569 <tbody>
31570 <row>
31571 <entry><option>smtp_active_hostname</option></entry>
31572 <entry>Use: <emphasis>main</emphasis></entry>
31573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31574 <entry>Default: <emphasis>unset</emphasis></entry>
31575 </row>
31576 </tbody>
31577 </tgroup>
31578 </informaltable>
31579 <para>
31580 <indexterm role="concept">
31581 <primary>host</primary>
31582 <secondary>name in SMTP responses</secondary>
31583 </indexterm>
31584 <indexterm role="concept">
31585 <primary>SMTP</primary>
31586 <secondary>host name in responses</secondary>
31587 </indexterm>
31588 <indexterm role="variable">
31589 <primary><varname>$primary_hostname</varname></primary>
31590 </indexterm>
31591 This option is provided for multi-homed servers that want to masquerade as
31592 several different hosts. At the start of an incoming SMTP connection, its value
31593 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
31594 responses. For example, it is used as domain name in the response to an
31595 incoming HELO or EHLO command.
31596 </para>
31597 <para>
31598 <indexterm role="variable">
31599 <primary><varname>$smtp_active_hostname</varname></primary>
31600 </indexterm>
31601 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
31602 is saved with any messages that are received. It is therefore available for use
31603 in routers and transports when the message is later delivered.
31604 </para>
31605 <para>
31606 If this option is unset, or if its expansion is forced to fail, or if the
31607 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
31608 used. Other expansion failures cause a message to be written to the main and
31609 panic logs, and the SMTP command receives a temporary error. Typically, the
31610 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
31611 For example:
31612 </para>
31613 <literallayout class="monospaced">
31614 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
31615   {cox.mydomain}{box.mydomain}}
31616 </literallayout>
31617 <para>
31618 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
31619 messages, it is also used as the default for HELO commands in callout
31620 verification if there is no remote transport from which to obtain a
31621 <option>helo_data</option> value.
31622 </para>
31623 <para>
31624 <indexterm role="option">
31625 <primary><option>smtp_banner</option></primary>
31626 </indexterm>
31627 </para>
31628 <informaltable frame="all">
31629 <tgroup cols="4" colsep="0" rowsep="0">
31630 <colspec colwidth="8*" align="left"/>
31631 <colspec colwidth="6*" align="center"/>
31632 <colspec colwidth="6*" align="center"/>
31633 <colspec colwidth="6*" align="right"/>
31634 <tbody>
31635 <row>
31636 <entry><option>smtp_banner</option></entry>
31637 <entry>Use: <emphasis>main</emphasis></entry>
31638 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31639 <entry>Default: <emphasis>see below</emphasis></entry>
31640 </row>
31641 </tbody>
31642 </tgroup>
31643 </informaltable>
31644 <para>
31645 <indexterm role="concept">
31646 <primary>SMTP</primary>
31647 <secondary>welcome banner</secondary>
31648 </indexterm>
31649 <indexterm role="concept">
31650 <primary>banner for SMTP</primary>
31651 </indexterm>
31652 <indexterm role="concept">
31653 <primary>welcome banner for SMTP</primary>
31654 </indexterm>
31655 <indexterm role="concept">
31656 <primary>customizing</primary>
31657 <secondary>SMTP banner</secondary>
31658 </indexterm>
31659 This string, which is expanded every time it is used, is output as the initial
31660 positive response to an SMTP connection. The default setting is:
31661 </para>
31662 <literallayout class="monospaced">
31663 smtp_banner = $smtp_active_hostname ESMTP Exim \
31664   $version_number $tod_full
31665 </literallayout>
31666 <para>
31667 Failure to expand the string causes a panic error. If you want to create a
31668 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
31669 appropriate points, but not at the end. Note that the 220 code is not included
31670 in this string. Exim adds it automatically (several times in the case of a
31671 multiline response).
31672 </para>
31673 <para>
31674 <indexterm role="option">
31675 <primary><option>smtp_check_spool_space</option></primary>
31676 </indexterm>
31677 </para>
31678 <informaltable frame="all">
31679 <tgroup cols="4" colsep="0" rowsep="0">
31680 <colspec colwidth="8*" align="left"/>
31681 <colspec colwidth="6*" align="center"/>
31682 <colspec colwidth="6*" align="center"/>
31683 <colspec colwidth="6*" align="right"/>
31684 <tbody>
31685 <row>
31686 <entry><option>smtp_check_spool_space</option></entry>
31687 <entry>Use: <emphasis>main</emphasis></entry>
31688 <entry>Type: <emphasis>boolean</emphasis></entry>
31689 <entry>Default: <emphasis>true</emphasis></entry>
31690 </row>
31691 </tbody>
31692 </tgroup>
31693 </informaltable>
31694 <para>
31695 <indexterm role="concept">
31696 <primary>checking disk space</primary>
31697 </indexterm>
31698 <indexterm role="concept">
31699 <primary>disk space, checking</primary>
31700 </indexterm>
31701 <indexterm role="concept">
31702 <primary>spool directory</primary>
31703 <secondary>checking space</secondary>
31704 </indexterm>
31705 When this option is set, if an incoming SMTP session encounters the SIZE
31706 option on a MAIL command, it checks that there is enough space in the
31707 spool directory&#x2019;s partition to accept a message of that size, while still
31708 leaving free the amount specified by <option>check_spool_space</option> (even if that value
31709 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
31710 </para>
31711 <para>
31712 <indexterm role="option">
31713 <primary><option>smtp_connect_backlog</option></primary>
31714 </indexterm>
31715 </para>
31716 <informaltable frame="all">
31717 <tgroup cols="4" colsep="0" rowsep="0">
31718 <colspec colwidth="8*" align="left"/>
31719 <colspec colwidth="6*" align="center"/>
31720 <colspec colwidth="6*" align="center"/>
31721 <colspec colwidth="6*" align="right"/>
31722 <tbody>
31723 <row>
31724 <entry><option>smtp_connect_backlog</option></entry>
31725 <entry>Use: <emphasis>main</emphasis></entry>
31726 <entry>Type: <emphasis>integer</emphasis></entry>
31727 <entry>Default: <emphasis>20</emphasis></entry>
31728 </row>
31729 </tbody>
31730 </tgroup>
31731 </informaltable>
31732 <para>
31733 <indexterm role="concept">
31734 <primary>connection backlog</primary>
31735 </indexterm>
31736 <indexterm role="concept">
31737 <primary>SMTP</primary>
31738 <secondary>connection backlog</secondary>
31739 </indexterm>
31740 <indexterm role="concept">
31741 <primary>backlog of connections</primary>
31742 </indexterm>
31743 This option specifies a maximum number of waiting SMTP connections. Exim passes
31744 this value to the TCP/IP system when it sets up its listener. Once this number
31745 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
31746 attempts are refused at the TCP/IP level. At least, that is what the manuals
31747 say; in some circumstances such connection attempts have been observed to time
31748 out instead. For large systems it is probably a good idea to increase the
31749 value (to 50, say). It also gives some protection against denial-of-service
31750 attacks by SYN flooding.
31751 </para>
31752 <para>
31753 <indexterm role="option">
31754 <primary><option>smtp_enforce_sync</option></primary>
31755 </indexterm>
31756 </para>
31757 <informaltable frame="all">
31758 <tgroup cols="4" colsep="0" rowsep="0">
31759 <colspec colwidth="8*" align="left"/>
31760 <colspec colwidth="6*" align="center"/>
31761 <colspec colwidth="6*" align="center"/>
31762 <colspec colwidth="6*" align="right"/>
31763 <tbody>
31764 <row>
31765 <entry><option>smtp_enforce_sync</option></entry>
31766 <entry>Use: <emphasis>main</emphasis></entry>
31767 <entry>Type: <emphasis>boolean</emphasis></entry>
31768 <entry>Default: <emphasis>true</emphasis></entry>
31769 </row>
31770 </tbody>
31771 </tgroup>
31772 </informaltable>
31773 <para>
31774 <indexterm role="concept">
31775 <primary>SMTP</primary>
31776 <secondary>synchronization checking</secondary>
31777 </indexterm>
31778 <indexterm role="concept">
31779 <primary>synchronization checking in SMTP</primary>
31780 </indexterm>
31781 The SMTP protocol specification requires the client to wait for a response from
31782 the server at certain points in the dialogue. Without PIPELINING these
31783 synchronization points are after every command; with PIPELINING they are
31784 fewer, but they still exist.
31785 </para>
31786 <para>
31787 Some spamming sites send out a complete set of SMTP commands without waiting
31788 for any response. Exim protects against this by rejecting a message if the
31789 client has sent further input when it should not have. The error response <quote>554
31790 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
31791 for this error cannot be perfect because of transmission delays (unexpected
31792 input may be on its way but not yet received when Exim checks). However, it
31793 does detect many instances.
31794 </para>
31795 <para>
31796 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
31797 If you want to disable the check selectively (for example, only for certain
31798 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
31799 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
31800 </para>
31801 <para>
31802 <indexterm role="option">
31803 <primary><option>smtp_etrn_command</option></primary>
31804 </indexterm>
31805 </para>
31806 <informaltable frame="all">
31807 <tgroup cols="4" colsep="0" rowsep="0">
31808 <colspec colwidth="8*" align="left"/>
31809 <colspec colwidth="6*" align="center"/>
31810 <colspec colwidth="6*" align="center"/>
31811 <colspec colwidth="6*" align="right"/>
31812 <tbody>
31813 <row>
31814 <entry><option>smtp_etrn_command</option></entry>
31815 <entry>Use: <emphasis>main</emphasis></entry>
31816 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31817 <entry>Default: <emphasis>unset</emphasis></entry>
31818 </row>
31819 </tbody>
31820 </tgroup>
31821 </informaltable>
31822 <para>
31823 <indexterm role="concept">
31824 <primary>ETRN</primary>
31825 <secondary>command to be run</secondary>
31826 </indexterm>
31827 <indexterm role="concept">
31828 <primary>ESMTP extensions</primary>
31829 <secondary>ETRN</secondary>
31830 </indexterm>
31831 <indexterm role="variable">
31832 <primary><varname>$domain</varname></primary>
31833 </indexterm>
31834 If this option is set, the given command is run whenever an SMTP ETRN
31835 command is received from a host that is permitted to issue such commands (see
31836 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
31837 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
31838 argument of the ETRN command, and no syntax checking is done on it. For
31839 example:
31840 </para>
31841 <literallayout class="monospaced">
31842 smtp_etrn_command = /etc/etrn_command $domain \
31843                     $sender_host_address
31844 </literallayout>
31845 <para revisionflag="changed">
31846 If the option is not set, the argument for the ETRN command must
31847 be a <emphasis>#</emphasis> followed by an address string.
31848 In this case an <emphasis>exim -R &lt;string&gt;</emphasis> command is used;
31849 if the ETRN ACL has set up a named-queue then <emphasis>-MCG &lt;queue&gt;</emphasis> is appended.
31850 </para>
31851 <para>
31852 A new process is created to run the command, but Exim does not wait for it to
31853 complete. Consequently, its status cannot be checked. If the command cannot be
31854 run, a line is written to the panic log, but the ETRN caller still receives
31855 a 250 success response. Exim is normally running under its own uid when
31856 receiving SMTP, so it is not possible for it to change the uid before running
31857 the command.
31858 </para>
31859 <para>
31860 <indexterm role="option">
31861 <primary><option>smtp_etrn_serialize</option></primary>
31862 </indexterm>
31863 </para>
31864 <informaltable frame="all">
31865 <tgroup cols="4" colsep="0" rowsep="0">
31866 <colspec colwidth="8*" align="left"/>
31867 <colspec colwidth="6*" align="center"/>
31868 <colspec colwidth="6*" align="center"/>
31869 <colspec colwidth="6*" align="right"/>
31870 <tbody>
31871 <row>
31872 <entry><option>smtp_etrn_serialize</option></entry>
31873 <entry>Use: <emphasis>main</emphasis></entry>
31874 <entry>Type: <emphasis>boolean</emphasis></entry>
31875 <entry>Default: <emphasis>true</emphasis></entry>
31876 </row>
31877 </tbody>
31878 </tgroup>
31879 </informaltable>
31880 <para>
31881 <indexterm role="concept">
31882 <primary>ETRN</primary>
31883 <secondary>serializing</secondary>
31884 </indexterm>
31885 When this option is set, it prevents the simultaneous execution of more than
31886 one identical command as a result of ETRN in an SMTP connection. See
31887 section <xref linkend="SECTETRN"/> for details.
31888 </para>
31889 <para>
31890 <indexterm role="option">
31891 <primary><option>smtp_load_reserve</option></primary>
31892 </indexterm>
31893 </para>
31894 <informaltable frame="all">
31895 <tgroup cols="4" colsep="0" rowsep="0">
31896 <colspec colwidth="8*" align="left"/>
31897 <colspec colwidth="6*" align="center"/>
31898 <colspec colwidth="6*" align="center"/>
31899 <colspec colwidth="6*" align="right"/>
31900 <tbody>
31901 <row>
31902 <entry><option>smtp_load_reserve</option></entry>
31903 <entry>Use: <emphasis>main</emphasis></entry>
31904 <entry>Type: <emphasis>fixed-point</emphasis></entry>
31905 <entry>Default: <emphasis>unset</emphasis></entry>
31906 </row>
31907 </tbody>
31908 </tgroup>
31909 </informaltable>
31910 <para>
31911 <indexterm role="concept">
31912 <primary>load average</primary>
31913 </indexterm>
31914 If the system load average ever gets higher than this, incoming SMTP calls are
31915 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
31916 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
31917 the load is over the limit. The option has no effect on ancient operating
31918 systems on which Exim cannot determine the load average. See also
31919 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
31920 </para>
31921 <para>
31922 <indexterm role="option">
31923 <primary><option>smtp_max_synprot_errors</option></primary>
31924 </indexterm>
31925 </para>
31926 <informaltable frame="all">
31927 <tgroup cols="4" colsep="0" rowsep="0">
31928 <colspec colwidth="8*" align="left"/>
31929 <colspec colwidth="6*" align="center"/>
31930 <colspec colwidth="6*" align="center"/>
31931 <colspec colwidth="6*" align="right"/>
31932 <tbody>
31933 <row>
31934 <entry><option>smtp_max_synprot_errors</option></entry>
31935 <entry>Use: <emphasis>main</emphasis></entry>
31936 <entry>Type: <emphasis>integer</emphasis></entry>
31937 <entry>Default: <emphasis>3</emphasis></entry>
31938 </row>
31939 </tbody>
31940 </tgroup>
31941 </informaltable>
31942 <para>
31943 <indexterm role="concept">
31944 <primary>SMTP</primary>
31945 <secondary>limiting syntax and protocol errors</secondary>
31946 </indexterm>
31947 <indexterm role="concept">
31948 <primary>limit</primary>
31949 <secondary>SMTP syntax and protocol errors</secondary>
31950 </indexterm>
31951 Exim rejects SMTP commands that contain syntax or protocol errors. In
31952 particular, a syntactically invalid email address, as in this command:
31953 </para>
31954 <literallayout class="monospaced">
31955 RCPT TO:&lt;abc xyz@a.b.c&gt;
31956 </literallayout>
31957 <para>
31958 causes immediate rejection of the command, before any other tests are done.
31959 (The ACL cannot be run if there is no valid address to set up for it.) An
31960 example of a protocol error is receiving RCPT before MAIL. If there are
31961 too many syntax or protocol errors in one SMTP session, the connection is
31962 dropped. The limit is set by this option.
31963 </para>
31964 <para>
31965 <indexterm role="concept">
31966 <primary>PIPELINING</primary>
31967 <secondary>expected errors</secondary>
31968 </indexterm>
31969 When the PIPELINING extension to SMTP is in use, some protocol errors are
31970 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
31971 Exim assumes that PIPELINING will be used if it advertises it (see
31972 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
31973 not count towards the limit.
31974 </para>
31975 <para>
31976 <indexterm role="option">
31977 <primary><option>smtp_max_unknown_commands</option></primary>
31978 </indexterm>
31979 </para>
31980 <informaltable frame="all">
31981 <tgroup cols="4" colsep="0" rowsep="0">
31982 <colspec colwidth="8*" align="left"/>
31983 <colspec colwidth="6*" align="center"/>
31984 <colspec colwidth="6*" align="center"/>
31985 <colspec colwidth="6*" align="right"/>
31986 <tbody>
31987 <row>
31988 <entry><option>smtp_max_unknown_commands</option></entry>
31989 <entry>Use: <emphasis>main</emphasis></entry>
31990 <entry>Type: <emphasis>integer</emphasis></entry>
31991 <entry>Default: <emphasis>3</emphasis></entry>
31992 </row>
31993 </tbody>
31994 </tgroup>
31995 </informaltable>
31996 <para>
31997 <indexterm role="concept">
31998 <primary>SMTP</primary>
31999 <secondary>limiting unknown commands</secondary>
32000 </indexterm>
32001 <indexterm role="concept">
32002 <primary>limit</primary>
32003 <secondary>unknown SMTP commands</secondary>
32004 </indexterm>
32005 If there are too many unrecognized commands in an incoming SMTP session, an
32006 Exim server drops the connection. This is a defence against some kinds of abuse
32007 that subvert web
32008 clients
32009 into making connections to SMTP ports; in these circumstances, a number of
32010 non-SMTP command lines are sent first.
32011 </para>
32012 <para>
32013 <indexterm role="option">
32014 <primary><option>smtp_ratelimit_hosts</option></primary>
32015 </indexterm>
32016 </para>
32017 <informaltable frame="all">
32018 <tgroup cols="4" colsep="0" rowsep="0">
32019 <colspec colwidth="8*" align="left"/>
32020 <colspec colwidth="6*" align="center"/>
32021 <colspec colwidth="6*" align="center"/>
32022 <colspec colwidth="6*" align="right"/>
32023 <tbody>
32024 <row>
32025 <entry><option>smtp_ratelimit_hosts</option></entry>
32026 <entry>Use: <emphasis>main</emphasis></entry>
32027 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32028 <entry>Default: <emphasis>unset</emphasis></entry>
32029 </row>
32030 </tbody>
32031 </tgroup>
32032 </informaltable>
32033 <para>
32034 <indexterm role="concept">
32035 <primary>SMTP</primary>
32036 <secondary>rate limiting</secondary>
32037 </indexterm>
32038 <indexterm role="concept">
32039 <primary>limit</primary>
32040 <secondary>rate of message arrival</secondary>
32041 </indexterm>
32042 <indexterm role="concept">
32043 <primary>RCPT</primary>
32044 <secondary>rate limiting</secondary>
32045 </indexterm>
32046 Some sites find it helpful to be able to limit the rate at which certain hosts
32047 can send them messages, and the rate at which an individual message can specify
32048 recipients.
32049 </para>
32050 <para>
32051 Exim has two rate-limiting facilities. This section describes the older
32052 facility, which can limit rates within a single connection. The newer
32053 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
32054 <xref linkend="SECTratelimiting"/> for details of the newer facility.
32055 </para>
32056 <para>
32057 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
32058 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
32059 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
32060 respectively. Each option, if set, must contain a set of four comma-separated
32061 values:
32062 </para>
32063 <itemizedlist>
32064 <listitem>
32065 <para>
32066 A threshold, before which there is no rate limiting.
32067 </para>
32068 </listitem>
32069 <listitem>
32070 <para>
32071 An initial time delay. Unlike other times in Exim, numbers with decimal
32072 fractional parts are allowed here.
32073 </para>
32074 </listitem>
32075 <listitem>
32076 <para>
32077 A factor by which to increase the delay each time.
32078 </para>
32079 </listitem>
32080 <listitem>
32081 <para>
32082 A maximum value for the delay. This should normally be less than 5 minutes,
32083 because after that time, the client is liable to timeout the SMTP command.
32084 </para>
32085 </listitem>
32086 </itemizedlist>
32087 <para>
32088 For example, these settings have been used successfully at the site which
32089 first suggested this feature, for controlling mail from their customers:
32090 </para>
32091 <literallayout class="monospaced">
32092 smtp_ratelimit_mail = 2,0.5s,1.05,4m
32093 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
32094 </literallayout>
32095 <para>
32096 The first setting specifies delays that are applied to MAIL commands after
32097 two have been received over a single connection. The initial delay is 0.5
32098 seconds, increasing by a factor of 1.05 each time. The second setting applies
32099 delays to RCPT commands when more than four occur in a single message.
32100 </para>
32101 <para>
32102 <indexterm role="option">
32103 <primary><option>smtp_ratelimit_mail</option></primary>
32104 </indexterm>
32105 </para>
32106 <informaltable frame="all">
32107 <tgroup cols="4" colsep="0" rowsep="0">
32108 <colspec colwidth="8*" align="left"/>
32109 <colspec colwidth="6*" align="center"/>
32110 <colspec colwidth="6*" align="center"/>
32111 <colspec colwidth="6*" align="right"/>
32112 <tbody>
32113 <row>
32114 <entry><option>smtp_ratelimit_mail</option></entry>
32115 <entry>Use: <emphasis>main</emphasis></entry>
32116 <entry>Type: <emphasis>string</emphasis></entry>
32117 <entry>Default: <emphasis>unset</emphasis></entry>
32118 </row>
32119 </tbody>
32120 </tgroup>
32121 </informaltable>
32122 <para>
32123 See <option>smtp_ratelimit_hosts</option> above.
32124 </para>
32125 <para>
32126 <indexterm role="option">
32127 <primary><option>smtp_ratelimit_rcpt</option></primary>
32128 </indexterm>
32129 </para>
32130 <informaltable frame="all">
32131 <tgroup cols="4" colsep="0" rowsep="0">
32132 <colspec colwidth="8*" align="left"/>
32133 <colspec colwidth="6*" align="center"/>
32134 <colspec colwidth="6*" align="center"/>
32135 <colspec colwidth="6*" align="right"/>
32136 <tbody>
32137 <row>
32138 <entry><option>smtp_ratelimit_rcpt</option></entry>
32139 <entry>Use: <emphasis>main</emphasis></entry>
32140 <entry>Type: <emphasis>string</emphasis></entry>
32141 <entry>Default: <emphasis>unset</emphasis></entry>
32142 </row>
32143 </tbody>
32144 </tgroup>
32145 </informaltable>
32146 <para>
32147 See <option>smtp_ratelimit_hosts</option> above.
32148 </para>
32149 <para>
32150 <indexterm role="option">
32151 <primary><option>smtp_receive_timeout</option></primary>
32152 </indexterm>
32153 </para>
32154 <informaltable frame="all">
32155 <tgroup cols="4" colsep="0" rowsep="0">
32156 <colspec colwidth="8*" align="left"/>
32157 <colspec colwidth="6*" align="center"/>
32158 <colspec colwidth="6*" align="center"/>
32159 <colspec colwidth="6*" align="right"/>
32160 <tbody>
32161 <row>
32162 <entry><option>smtp_receive_timeout</option></entry>
32163 <entry>Use: <emphasis>main</emphasis></entry>
32164 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
32165 <entry>Default: <emphasis>5m</emphasis></entry>
32166 </row>
32167 </tbody>
32168 </tgroup>
32169 </informaltable>
32170 <para>
32171 <indexterm role="concept">
32172 <primary>timeout</primary>
32173 <secondary>for SMTP input</secondary>
32174 </indexterm>
32175 <indexterm role="concept">
32176 <primary>SMTP</primary>
32177 <secondary>input timeout</secondary>
32178 </indexterm>
32179 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
32180 input, including batch SMTP. If a line of input (either an SMTP command or a
32181 data line) is not received within this time, the SMTP connection is dropped and
32182 the message is abandoned.
32183 A line is written to the log containing one of the following messages:
32184 </para>
32185 <literallayout class="monospaced">
32186 SMTP command timeout on connection from...
32187 SMTP data timeout on connection from...
32188 </literallayout>
32189 <para>
32190 The former means that Exim was expecting to read an SMTP command; the latter
32191 means that it was in the DATA phase, reading the contents of a message.
32192 </para>
32193 <para>
32194 If the first character of the option is a <quote>$</quote> the option is
32195 expanded before use and may depend on
32196 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
32197 </para>
32198 <para>
32199 <indexterm role="option">
32200 <primary><option>-os</option></primary>
32201 </indexterm>
32202 The value set by this option can be overridden by the
32203 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
32204 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
32205 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
32206 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
32207 </para>
32208 <para>
32209 <indexterm role="option">
32210 <primary><option>smtp_reserve_hosts</option></primary>
32211 </indexterm>
32212 </para>
32213 <informaltable frame="all">
32214 <tgroup cols="4" colsep="0" rowsep="0">
32215 <colspec colwidth="8*" align="left"/>
32216 <colspec colwidth="6*" align="center"/>
32217 <colspec colwidth="6*" align="center"/>
32218 <colspec colwidth="6*" align="right"/>
32219 <tbody>
32220 <row>
32221 <entry><option>smtp_reserve_hosts</option></entry>
32222 <entry>Use: <emphasis>main</emphasis></entry>
32223 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32224 <entry>Default: <emphasis>unset</emphasis></entry>
32225 </row>
32226 </tbody>
32227 </tgroup>
32228 </informaltable>
32229 <para>
32230 This option defines hosts for which SMTP connections are reserved; see
32231 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
32232 </para>
32233 <para>
32234 <indexterm role="option">
32235 <primary><option>smtp_return_error_details</option></primary>
32236 </indexterm>
32237 </para>
32238 <informaltable frame="all">
32239 <tgroup cols="4" colsep="0" rowsep="0">
32240 <colspec colwidth="8*" align="left"/>
32241 <colspec colwidth="6*" align="center"/>
32242 <colspec colwidth="6*" align="center"/>
32243 <colspec colwidth="6*" align="right"/>
32244 <tbody>
32245 <row>
32246 <entry><option>smtp_return_error_details</option></entry>
32247 <entry>Use: <emphasis>main</emphasis></entry>
32248 <entry>Type: <emphasis>boolean</emphasis></entry>
32249 <entry>Default: <emphasis>false</emphasis></entry>
32250 </row>
32251 </tbody>
32252 </tgroup>
32253 </informaltable>
32254 <para>
32255 <indexterm role="concept">
32256 <primary>SMTP</primary>
32257 <secondary>details policy failures</secondary>
32258 </indexterm>
32259 <indexterm role="concept">
32260 <primary>policy control</primary>
32261 <secondary>rejection, returning details</secondary>
32262 </indexterm>
32263 In the default state, Exim uses bland messages such as
32264 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
32265 reasons. Many sysadmins like this because it gives away little information
32266 to spammers. However, some other sysadmins who are applying strict checking
32267 policies want to give out much fuller information about failures. Setting
32268 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
32269 example, instead of <quote>Administrative prohibition</quote>, it might give:
32270 </para>
32271 <literallayout class="monospaced">
32272 550-Rejected after DATA: '&gt;' missing at end of address:
32273 550 failing address in "From" header is: &lt;user@dom.ain
32274 </literallayout>
32275 <para>
32276 <indexterm role="option">
32277 <primary><option>smtputf8_advertise_hosts</option></primary>
32278 </indexterm>
32279 </para>
32280 <informaltable frame="all">
32281 <tgroup cols="4" colsep="0" rowsep="0">
32282 <colspec colwidth="8*" align="left"/>
32283 <colspec colwidth="6*" align="center"/>
32284 <colspec colwidth="6*" align="center"/>
32285 <colspec colwidth="6*" align="right"/>
32286 <tbody>
32287 <row>
32288 <entry><option>smtputf8_advertise_hosts</option></entry>
32289 <entry>Use: <emphasis>main</emphasis></entry>
32290 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32291 <entry>Default: <emphasis>*</emphasis></entry>
32292 </row>
32293 </tbody>
32294 </tgroup>
32295 </informaltable>
32296 <para>
32297 <indexterm role="concept">
32298 <primary>SMTPUTF8</primary>
32299 <secondary>ESMTP extension, advertising</secondary>
32300 </indexterm>
32301 <indexterm role="concept">
32302 <primary>ESMTP extensions</primary>
32303 <secondary>SMTPUTF8</secondary>
32304 </indexterm>
32305 When Exim is built with support for internationalised mail names,
32306 the availability thereof is advertised in
32307 response to EHLO only to those client hosts that match this option. See
32308 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
32309 </para>
32310 <para>
32311 <indexterm role="option">
32312 <primary><option>spamd_address</option></primary>
32313 </indexterm>
32314 </para>
32315 <informaltable frame="all">
32316 <tgroup cols="4" colsep="0" rowsep="0">
32317 <colspec colwidth="8*" align="left"/>
32318 <colspec colwidth="6*" align="center"/>
32319 <colspec colwidth="6*" align="center"/>
32320 <colspec colwidth="6*" align="right"/>
32321 <tbody>
32322 <row>
32323 <entry><option>spamd_address</option></entry>
32324 <entry>Use: <emphasis>main</emphasis></entry>
32325 <entry>Type: <emphasis>string</emphasis></entry>
32326 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
32327 </row>
32328 </tbody>
32329 </tgroup>
32330 </informaltable>
32331 <para>
32332 This option is available when Exim is compiled with the content-scanning
32333 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
32334 See section <xref linkend="SECTscanspamass"/> for more details.
32335 </para>
32336 <para>
32337 <indexterm role="option">
32338 <primary><option>spf_guess</option></primary>
32339 </indexterm>
32340 </para>
32341 <informaltable frame="all">
32342 <tgroup cols="4" colsep="0" rowsep="0">
32343 <colspec colwidth="8*" align="left"/>
32344 <colspec colwidth="6*" align="center"/>
32345 <colspec colwidth="6*" align="center"/>
32346 <colspec colwidth="6*" align="right"/>
32347 <tbody>
32348 <row>
32349 <entry><option>spf_guess</option></entry>
32350 <entry>Use: <emphasis>main</emphasis></entry>
32351 <entry>Type: <emphasis>string</emphasis></entry>
32352 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
32353 </row>
32354 </tbody>
32355 </tgroup>
32356 </informaltable>
32357 <para>
32358 This option is available when Exim is compiled with SPF support.
32359 See section <xref linkend="SECSPF"/> for more details.
32360 </para>
32361 <para revisionflag="changed">
32362 <indexterm role="option">
32363 <primary><option>spf_smtp_comment_template</option></primary>
32364 </indexterm>
32365 </para>
32366 <informaltable frame="all" revisionflag="changed">
32367 <tgroup cols="4" colsep="0" rowsep="0">
32368 <colspec colwidth="8*" align="left"/>
32369 <colspec colwidth="6*" align="center"/>
32370 <colspec colwidth="6*" align="center"/>
32371 <colspec colwidth="6*" align="right"/>
32372 <tbody>
32373 <row>
32374 <entry><option>spf_smtp_comment_template</option></entry>
32375 <entry>Use: <emphasis>main</emphasis></entry>
32376 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32377 <entry>Default: <emphasis>Please%_see%_http://www.open-spf.org/Why</emphasis></entry>
32378 </row>
32379 </tbody>
32380 </tgroup>
32381 </informaltable>
32382 <para revisionflag="changed">
32383 This option is available when Exim is compiled with SPF support.  It
32384 allows the customisation of the SMTP comment that the SPF library
32385 generates.  You are strongly encouraged to link to your own explanative
32386 site. The template must not contain spaces. If you need spaces in the
32387 output, use the proper placeholder. If libspf2 can not parse the
32388 template, it uses a built-in default broken link. The following placeholders
32389 (along with Exim variables (but see below)) are allowed in the template:
32390 </para>
32391 <itemizedlist revisionflag="changed">
32392 <listitem>
32393 <para revisionflag="changed">
32394 <emphasis role="bold">%_</emphasis>: A space.
32395 </para>
32396 </listitem>
32397 <listitem>
32398 <para revisionflag="changed">
32399 <emphasis role="bold">%{L}</emphasis>: Envelope sender&#x2019;s local part.
32400 </para>
32401 </listitem>
32402 <listitem>
32403 <para revisionflag="changed">
32404 <emphasis role="bold">%{S}</emphasis>: Envelope sender.
32405 </para>
32406 </listitem>
32407 <listitem>
32408 <para revisionflag="changed">
32409 <emphasis role="bold">%{O}</emphasis>: Envelope sender&#x2019;s domain.
32410 </para>
32411 </listitem>
32412 <listitem>
32413 <para revisionflag="changed">
32414 <emphasis role="bold">%{D}</emphasis>: Current(?) domain.
32415 </para>
32416 </listitem>
32417 <listitem>
32418 <para revisionflag="changed">
32419 <emphasis role="bold">%{I}</emphasis>: SMTP client Ip.
32420 </para>
32421 </listitem>
32422 <listitem>
32423 <para revisionflag="changed">
32424 <emphasis role="bold">%{C}</emphasis>: SMTP client pretty IP.
32425 </para>
32426 </listitem>
32427 <listitem>
32428 <para revisionflag="changed">
32429 <emphasis role="bold">%{T}</emphasis>: Epoch time (UTC).
32430 </para>
32431 </listitem>
32432 <listitem>
32433 <para revisionflag="changed">
32434 <emphasis role="bold">%{P}</emphasis>: SMTP client domain name.
32435 </para>
32436 </listitem>
32437 <listitem>
32438 <para revisionflag="changed">
32439 <emphasis role="bold">%{V}</emphasis>: IP version.
32440 </para>
32441 </listitem>
32442 <listitem>
32443 <para revisionflag="changed">
32444 <emphasis role="bold">%{H}</emphasis>: EHLO/HELO domain.
32445 </para>
32446 </listitem>
32447 <listitem>
32448 <para revisionflag="changed">
32449 <emphasis role="bold">%{R}</emphasis>: Receiving domain.
32450 </para>
32451 </listitem>
32452 </itemizedlist>
32453 <para revisionflag="changed">
32454 The capitalized placeholders do proper URL encoding, if you use them
32455 lowercased, no encoding takes place.  This list was compiled from the
32456 libspf2 sources.
32457 </para>
32458 <para revisionflag="changed">
32459 A note on using Exim variables: As
32460 currently the SPF library is initialized before the SMTP EHLO phase,
32461 the variables useful for expansion are quite limited.
32462 </para>
32463 <para>
32464 <indexterm role="option">
32465 <primary><option>split_spool_directory</option></primary>
32466 </indexterm>
32467 </para>
32468 <informaltable frame="all">
32469 <tgroup cols="4" colsep="0" rowsep="0">
32470 <colspec colwidth="8*" align="left"/>
32471 <colspec colwidth="6*" align="center"/>
32472 <colspec colwidth="6*" align="center"/>
32473 <colspec colwidth="6*" align="right"/>
32474 <tbody>
32475 <row>
32476 <entry><option>split_spool_directory</option></entry>
32477 <entry>Use: <emphasis>main</emphasis></entry>
32478 <entry>Type: <emphasis>boolean</emphasis></entry>
32479 <entry>Default: <emphasis>false</emphasis></entry>
32480 </row>
32481 </tbody>
32482 </tgroup>
32483 </informaltable>
32484 <para>
32485 <indexterm role="concept">
32486 <primary>multiple spool directories</primary>
32487 </indexterm>
32488 <indexterm role="concept">
32489 <primary>spool directory</primary>
32490 <secondary>split</secondary>
32491 </indexterm>
32492 <indexterm role="concept">
32493 <primary>directories, multiple</primary>
32494 </indexterm>
32495 If this option is set, it causes Exim to split its input directory into 62
32496 subdirectories, each with a single alphanumeric character as its name. The
32497 sixth character of the message id is used to allocate messages to
32498 subdirectories; this is the least significant base-62 digit of the time of
32499 arrival of the message.
32500 </para>
32501 <para>
32502 Splitting up the spool in this way may provide better performance on systems
32503 where there are long mail queues, by reducing the number of files in any one
32504 directory. The msglog directory is also split up in a similar way to the input
32505 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
32506 are still placed in the single directory <filename>msglog.OLD</filename>.
32507 </para>
32508 <para>
32509 It is not necessary to take any special action for existing messages when
32510 changing <option>split_spool_directory</option>. Exim notices messages that are in the
32511 <quote>wrong</quote> place, and continues to process them. If the option is turned off
32512 after a period of being on, the subdirectories will eventually empty and be
32513 automatically deleted.
32514 </para>
32515 <para>
32516 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
32517 changes. Instead of creating a list of all messages in the queue, and then
32518 trying to deliver each one, in turn, it constructs a list of those in one
32519 sub-directory and tries to deliver them, before moving on to the next
32520 sub-directory. The sub-directories are processed in a random order. This
32521 spreads out the scanning of the input directories, and uses less memory. It is
32522 particularly beneficial when there are lots of messages in the queue. However,
32523 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
32524 entire queue has to be scanned and sorted before any deliveries can start.
32525 </para>
32526 <para>
32527 <indexterm role="option">
32528 <primary><option>spool_directory</option></primary>
32529 </indexterm>
32530 </para>
32531 <informaltable frame="all">
32532 <tgroup cols="4" colsep="0" rowsep="0">
32533 <colspec colwidth="8*" align="left"/>
32534 <colspec colwidth="6*" align="center"/>
32535 <colspec colwidth="6*" align="center"/>
32536 <colspec colwidth="6*" align="right"/>
32537 <tbody>
32538 <row>
32539 <entry><option>spool_directory</option></entry>
32540 <entry>Use: <emphasis>main</emphasis></entry>
32541 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32542 <entry>Default: <emphasis>set at compile time</emphasis></entry>
32543 </row>
32544 </tbody>
32545 </tgroup>
32546 </informaltable>
32547 <para>
32548 <indexterm role="concept">
32549 <primary>spool directory</primary>
32550 <secondary>path to</secondary>
32551 </indexterm>
32552 This defines the directory in which Exim keeps its spool, that is, the messages
32553 it is waiting to deliver. The default value is taken from the compile-time
32554 configuration setting, if there is one. If not, this option must be set. The
32555 string is expanded, so it can contain, for example, a reference to
32556 <varname>$primary_hostname</varname>.
32557 </para>
32558 <para>
32559 If the spool directory name is fixed on your installation, it is recommended
32560 that you set it at build time rather than from this option, particularly if the
32561 log files are being written to the spool directory (see <option>log_file_path</option>).
32562 Otherwise log files cannot be used for errors that are detected early on, such
32563 as failures in the configuration file.
32564 </para>
32565 <para>
32566 By using this option to override the compiled-in path, it is possible to run
32567 tests of Exim without using the standard spool.
32568 </para>
32569 <para>
32570 <indexterm role="option">
32571 <primary><option>spool_wireformat</option></primary>
32572 </indexterm>
32573 </para>
32574 <informaltable frame="all">
32575 <tgroup cols="4" colsep="0" rowsep="0">
32576 <colspec colwidth="8*" align="left"/>
32577 <colspec colwidth="6*" align="center"/>
32578 <colspec colwidth="6*" align="center"/>
32579 <colspec colwidth="6*" align="right"/>
32580 <tbody>
32581 <row>
32582 <entry><option>spool_wireformat</option></entry>
32583 <entry>Use: <emphasis>main</emphasis></entry>
32584 <entry>Type: <emphasis>boolean</emphasis></entry>
32585 <entry>Default: <emphasis>false</emphasis></entry>
32586 </row>
32587 </tbody>
32588 </tgroup>
32589 </informaltable>
32590 <para>
32591 <indexterm role="concept">
32592 <primary>spool directory</primary>
32593 <secondary>file formats</secondary>
32594 </indexterm>
32595 If this option is set, Exim may for some messages use an alternative format
32596 for data-files in the spool which matches the wire format.
32597 Doing this permits more efficient message reception and transmission.
32598 Currently it is only done for messages received using the ESMTP CHUNKING
32599 option.
32600 </para>
32601 <para>
32602 The following variables will not have useful values:
32603 </para>
32604 <literallayout class="monospaced">
32605 $max_received_linelength
32606 $body_linecount
32607 $body_zerocount
32608 </literallayout>
32609 <para>
32610 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
32611 and any external programs which are passed a reference to a message data file
32612 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
32613 will need to be aware of the different formats potentially available.
32614 </para>
32615 <para>
32616 Using any of the ACL conditions noted will negate the reception benefit
32617 (as a Unix-mbox-format file is constructed for them).
32618 The transmission benefit is maintained.
32619 </para>
32620 <para>
32621 <indexterm role="option">
32622 <primary><option>sqlite_lock_timeout</option></primary>
32623 </indexterm>
32624 </para>
32625 <informaltable frame="all">
32626 <tgroup cols="4" colsep="0" rowsep="0">
32627 <colspec colwidth="8*" align="left"/>
32628 <colspec colwidth="6*" align="center"/>
32629 <colspec colwidth="6*" align="center"/>
32630 <colspec colwidth="6*" align="right"/>
32631 <tbody>
32632 <row>
32633 <entry><option>sqlite_lock_timeout</option></entry>
32634 <entry>Use: <emphasis>main</emphasis></entry>
32635 <entry>Type: <emphasis>time</emphasis></entry>
32636 <entry>Default: <emphasis>5s</emphasis></entry>
32637 </row>
32638 </tbody>
32639 </tgroup>
32640 </informaltable>
32641 <para>
32642 <indexterm role="concept">
32643 <primary>sqlite lookup type</primary>
32644 <secondary>lock timeout</secondary>
32645 </indexterm>
32646 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
32647 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
32648 </para>
32649 <para>
32650 <indexterm role="option">
32651 <primary><option>strict_acl_vars</option></primary>
32652 </indexterm>
32653 </para>
32654 <informaltable frame="all">
32655 <tgroup cols="4" colsep="0" rowsep="0">
32656 <colspec colwidth="8*" align="left"/>
32657 <colspec colwidth="6*" align="center"/>
32658 <colspec colwidth="6*" align="center"/>
32659 <colspec colwidth="6*" align="right"/>
32660 <tbody>
32661 <row>
32662 <entry><option>strict_acl_vars</option></entry>
32663 <entry>Use: <emphasis>main</emphasis></entry>
32664 <entry>Type: <emphasis>boolean</emphasis></entry>
32665 <entry>Default: <emphasis>false</emphasis></entry>
32666 </row>
32667 </tbody>
32668 </tgroup>
32669 </informaltable>
32670 <para>
32671 <indexterm role="concept">
32672 <primary>access control lists (ACLs)</primary>
32673 <secondary>variables, handling unset</secondary>
32674 </indexterm>
32675 This option controls what happens if a syntactically valid but undefined ACL
32676 variable is referenced. If it is false (the default), an empty string
32677 is substituted; if it is true, an error is generated. See section
32678 <xref linkend="SECTaclvariables"/> for details of ACL variables.
32679 </para>
32680 <para>
32681 <indexterm role="option">
32682 <primary><option>strip_excess_angle_brackets</option></primary>
32683 </indexterm>
32684 </para>
32685 <informaltable frame="all">
32686 <tgroup cols="4" colsep="0" rowsep="0">
32687 <colspec colwidth="8*" align="left"/>
32688 <colspec colwidth="6*" align="center"/>
32689 <colspec colwidth="6*" align="center"/>
32690 <colspec colwidth="6*" align="right"/>
32691 <tbody>
32692 <row>
32693 <entry><option>strip_excess_angle_brackets</option></entry>
32694 <entry>Use: <emphasis>main</emphasis></entry>
32695 <entry>Type: <emphasis>boolean</emphasis></entry>
32696 <entry>Default: <emphasis>false</emphasis></entry>
32697 </row>
32698 </tbody>
32699 </tgroup>
32700 </informaltable>
32701 <para>
32702 <indexterm role="concept">
32703 <primary>angle brackets, excess</primary>
32704 </indexterm>
32705 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
32706 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
32707 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
32708 passed on to another MTA, the excess angle brackets are not passed on. If this
32709 option is not set, multiple pairs of angle brackets cause a syntax error.
32710 </para>
32711 <para>
32712 <indexterm role="option">
32713 <primary><option>strip_trailing_dot</option></primary>
32714 </indexterm>
32715 </para>
32716 <informaltable frame="all">
32717 <tgroup cols="4" colsep="0" rowsep="0">
32718 <colspec colwidth="8*" align="left"/>
32719 <colspec colwidth="6*" align="center"/>
32720 <colspec colwidth="6*" align="center"/>
32721 <colspec colwidth="6*" align="right"/>
32722 <tbody>
32723 <row>
32724 <entry><option>strip_trailing_dot</option></entry>
32725 <entry>Use: <emphasis>main</emphasis></entry>
32726 <entry>Type: <emphasis>boolean</emphasis></entry>
32727 <entry>Default: <emphasis>false</emphasis></entry>
32728 </row>
32729 </tbody>
32730 </tgroup>
32731 </informaltable>
32732 <para>
32733 <indexterm role="concept">
32734 <primary>trailing dot on domain</primary>
32735 </indexterm>
32736 <indexterm role="concept">
32737 <primary>dot</primary>
32738 <secondary>trailing on domain</secondary>
32739 </indexterm>
32740 If this option is set, a trailing dot at the end of a domain in an address is
32741 ignored. If this is in the envelope and the message is passed on to another
32742 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
32743 domain causes a syntax error.
32744 However, addresses in header lines are checked only when an ACL requests header
32745 syntax checking.
32746 </para>
32747 <para>
32748 <indexterm role="option">
32749 <primary><option>syslog_duplication</option></primary>
32750 </indexterm>
32751 </para>
32752 <informaltable frame="all">
32753 <tgroup cols="4" colsep="0" rowsep="0">
32754 <colspec colwidth="8*" align="left"/>
32755 <colspec colwidth="6*" align="center"/>
32756 <colspec colwidth="6*" align="center"/>
32757 <colspec colwidth="6*" align="right"/>
32758 <tbody>
32759 <row>
32760 <entry><option>syslog_duplication</option></entry>
32761 <entry>Use: <emphasis>main</emphasis></entry>
32762 <entry>Type: <emphasis>boolean</emphasis></entry>
32763 <entry>Default: <emphasis>true</emphasis></entry>
32764 </row>
32765 </tbody>
32766 </tgroup>
32767 </informaltable>
32768 <para>
32769 <indexterm role="concept">
32770 <primary>syslog</primary>
32771 <secondary>duplicate log lines; suppressing</secondary>
32772 </indexterm>
32773 When Exim is logging to syslog, it writes the log lines for its three
32774 separate logs at different syslog priorities so that they can in principle
32775 be separated on the logging hosts. Some installations do not require this
32776 separation, and in those cases, the duplication of certain log lines is a
32777 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
32778 particular log line is written to syslog. For lines that normally go to
32779 both the main log and the reject log, the reject log version (possibly
32780 containing message header lines) is written, at LOG_NOTICE priority.
32781 Lines that normally go to both the main and the panic log are written at
32782 the LOG_ALERT priority.
32783 </para>
32784 <para>
32785 <indexterm role="option">
32786 <primary><option>syslog_facility</option></primary>
32787 </indexterm>
32788 </para>
32789 <informaltable frame="all">
32790 <tgroup cols="4" colsep="0" rowsep="0">
32791 <colspec colwidth="8*" align="left"/>
32792 <colspec colwidth="6*" align="center"/>
32793 <colspec colwidth="6*" align="center"/>
32794 <colspec colwidth="6*" align="right"/>
32795 <tbody>
32796 <row>
32797 <entry><option>syslog_facility</option></entry>
32798 <entry>Use: <emphasis>main</emphasis></entry>
32799 <entry>Type: <emphasis>string</emphasis></entry>
32800 <entry>Default: <emphasis>unset</emphasis></entry>
32801 </row>
32802 </tbody>
32803 </tgroup>
32804 </informaltable>
32805 <para>
32806 <indexterm role="concept">
32807 <primary>syslog</primary>
32808 <secondary>facility; setting</secondary>
32809 </indexterm>
32810 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
32811 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
32812 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
32813 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
32814 details of Exim&#x2019;s logging.
32815 </para>
32816 <para>
32817 <indexterm role="option">
32818 <primary><option>syslog_pid</option></primary>
32819 </indexterm>
32820 </para>
32821 <informaltable frame="all">
32822 <tgroup cols="4" colsep="0" rowsep="0">
32823 <colspec colwidth="8*" align="left"/>
32824 <colspec colwidth="6*" align="center"/>
32825 <colspec colwidth="6*" align="center"/>
32826 <colspec colwidth="6*" align="right"/>
32827 <tbody>
32828 <row>
32829 <entry><option>syslog_pid</option></entry>
32830 <entry>Use: <emphasis>main</emphasis></entry>
32831 <entry>Type: <emphasis>boolean</emphasis></entry>
32832 <entry>Default: <emphasis>true</emphasis></entry>
32833 </row>
32834 </tbody>
32835 </tgroup>
32836 </informaltable>
32837 <para>
32838 <indexterm role="concept">
32839 <primary>syslog</primary>
32840 <secondary>pid</secondary>
32841 </indexterm>
32842 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
32843 omitted when these lines are sent to syslog. (Syslog normally prefixes
32844 the log lines with the PID of the logging process automatically.) You need
32845 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
32846 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
32847 </para>
32848 <para>
32849 <indexterm role="option">
32850 <primary><option>syslog_processname</option></primary>
32851 </indexterm>
32852 </para>
32853 <informaltable frame="all">
32854 <tgroup cols="4" colsep="0" rowsep="0">
32855 <colspec colwidth="8*" align="left"/>
32856 <colspec colwidth="6*" align="center"/>
32857 <colspec colwidth="6*" align="center"/>
32858 <colspec colwidth="6*" align="right"/>
32859 <tbody>
32860 <row>
32861 <entry><option>syslog_processname</option></entry>
32862 <entry>Use: <emphasis>main</emphasis></entry>
32863 <entry>Type: <emphasis>string</emphasis></entry>
32864 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
32865 </row>
32866 </tbody>
32867 </tgroup>
32868 </informaltable>
32869 <para>
32870 <indexterm role="concept">
32871 <primary>syslog</primary>
32872 <secondary>process name; setting</secondary>
32873 </indexterm>
32874 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
32875 syslog. The value must be no longer than 32 characters. See chapter
32876 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
32877 </para>
32878 <para>
32879 <indexterm role="option">
32880 <primary><option>syslog_timestamp</option></primary>
32881 </indexterm>
32882 </para>
32883 <informaltable frame="all">
32884 <tgroup cols="4" colsep="0" rowsep="0">
32885 <colspec colwidth="8*" align="left"/>
32886 <colspec colwidth="6*" align="center"/>
32887 <colspec colwidth="6*" align="center"/>
32888 <colspec colwidth="6*" align="right"/>
32889 <tbody>
32890 <row>
32891 <entry><option>syslog_timestamp</option></entry>
32892 <entry>Use: <emphasis>main</emphasis></entry>
32893 <entry>Type: <emphasis>boolean</emphasis></entry>
32894 <entry>Default: <emphasis>true</emphasis></entry>
32895 </row>
32896 </tbody>
32897 </tgroup>
32898 </informaltable>
32899 <para>
32900 <indexterm role="concept">
32901 <primary>syslog</primary>
32902 <secondary>timestamps</secondary>
32903 </indexterm>
32904 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
32905 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
32906 details of Exim&#x2019;s logging.
32907 </para>
32908 <para>
32909 <indexterm role="option">
32910 <primary><option>system_filter</option></primary>
32911 </indexterm>
32912 </para>
32913 <informaltable frame="all">
32914 <tgroup cols="4" colsep="0" rowsep="0">
32915 <colspec colwidth="8*" align="left"/>
32916 <colspec colwidth="6*" align="center"/>
32917 <colspec colwidth="6*" align="center"/>
32918 <colspec colwidth="6*" align="right"/>
32919 <tbody>
32920 <row>
32921 <entry><option>system_filter</option></entry>
32922 <entry>Use: <emphasis>main</emphasis></entry>
32923 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32924 <entry>Default: <emphasis>unset</emphasis></entry>
32925 </row>
32926 </tbody>
32927 </tgroup>
32928 </informaltable>
32929 <para>
32930 <indexterm role="concept">
32931 <primary>filter</primary>
32932 <secondary>system filter</secondary>
32933 </indexterm>
32934 <indexterm role="concept">
32935 <primary>system filter</primary>
32936 <secondary>specifying</secondary>
32937 </indexterm>
32938 <indexterm role="concept">
32939 <primary>Sieve filter</primary>
32940 <secondary>not available for system filter</secondary>
32941 </indexterm>
32942 This option specifies an Exim filter file that is applied to all messages at
32943 the start of each delivery attempt, before any routing is done. System filters
32944 must be Exim filters; they cannot be Sieve filters. If the system filter
32945 generates any deliveries to files or pipes, or any new mail messages, the
32946 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
32947 which transports are to be used. Details of this facility are given in chapter
32948 <xref linkend="CHAPsystemfilter"/>.
32949 A forced expansion failure results in no filter operation.
32950 </para>
32951 <para>
32952 <indexterm role="option">
32953 <primary><option>system_filter_directory_transport</option></primary>
32954 </indexterm>
32955 </para>
32956 <informaltable frame="all">
32957 <tgroup cols="4" colsep="0" rowsep="0">
32958 <colspec colwidth="8*" align="left"/>
32959 <colspec colwidth="6*" align="center"/>
32960 <colspec colwidth="6*" align="center"/>
32961 <colspec colwidth="6*" align="right"/>
32962 <tbody>
32963 <row>
32964 <entry><option>system_filter_directory_transport</option></entry>
32965 <entry>Use: <emphasis>main</emphasis></entry>
32966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32967 <entry>Default: <emphasis>unset</emphasis></entry>
32968 </row>
32969 </tbody>
32970 </tgroup>
32971 </informaltable>
32972 <para>
32973 <indexterm role="variable">
32974 <primary><varname>$address_file</varname></primary>
32975 </indexterm>
32976 This sets the name of the transport driver that is to be used when the
32977 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
32978 implying delivery of each message into a separate file in some directory.
32979 During the delivery, the variable <varname>$address_file</varname> contains the path name.
32980 </para>
32981 <para>
32982 <indexterm role="option">
32983 <primary><option>system_filter_file_transport</option></primary>
32984 </indexterm>
32985 </para>
32986 <informaltable frame="all">
32987 <tgroup cols="4" colsep="0" rowsep="0">
32988 <colspec colwidth="8*" align="left"/>
32989 <colspec colwidth="6*" align="center"/>
32990 <colspec colwidth="6*" align="center"/>
32991 <colspec colwidth="6*" align="right"/>
32992 <tbody>
32993 <row>
32994 <entry><option>system_filter_file_transport</option></entry>
32995 <entry>Use: <emphasis>main</emphasis></entry>
32996 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32997 <entry>Default: <emphasis>unset</emphasis></entry>
32998 </row>
32999 </tbody>
33000 </tgroup>
33001 </informaltable>
33002 <para>
33003 <indexterm role="concept">
33004 <primary>file</primary>
33005 <secondary>transport for system filter</secondary>
33006 </indexterm>
33007 This sets the name of the transport driver that is to be used when the <option>save</option>
33008 command in a system message filter specifies a path not ending in <quote>/</quote>. During
33009 the delivery, the variable <varname>$address_file</varname> contains the path name.
33010 </para>
33011 <para>
33012 <indexterm role="option">
33013 <primary><option>system_filter_group</option></primary>
33014 </indexterm>
33015 </para>
33016 <informaltable frame="all">
33017 <tgroup cols="4" colsep="0" rowsep="0">
33018 <colspec colwidth="8*" align="left"/>
33019 <colspec colwidth="6*" align="center"/>
33020 <colspec colwidth="6*" align="center"/>
33021 <colspec colwidth="6*" align="right"/>
33022 <tbody>
33023 <row>
33024 <entry><option>system_filter_group</option></entry>
33025 <entry>Use: <emphasis>main</emphasis></entry>
33026 <entry>Type: <emphasis>string</emphasis></entry>
33027 <entry>Default: <emphasis>unset</emphasis></entry>
33028 </row>
33029 </tbody>
33030 </tgroup>
33031 </informaltable>
33032 <para>
33033 <indexterm role="concept">
33034 <primary>gid (group id)</primary>
33035 <secondary>system filter</secondary>
33036 </indexterm>
33037 This option is used only when <option>system_filter_user</option> is also set. It sets the
33038 gid under which the system filter is run, overriding any gid that is associated
33039 with the user. The value may be numerical or symbolic.
33040 </para>
33041 <para>
33042 <indexterm role="option">
33043 <primary><option>system_filter_pipe_transport</option></primary>
33044 </indexterm>
33045 </para>
33046 <informaltable frame="all">
33047 <tgroup cols="4" colsep="0" rowsep="0">
33048 <colspec colwidth="8*" align="left"/>
33049 <colspec colwidth="6*" align="center"/>
33050 <colspec colwidth="6*" align="center"/>
33051 <colspec colwidth="6*" align="right"/>
33052 <tbody>
33053 <row>
33054 <entry><option>system_filter_pipe_transport</option></entry>
33055 <entry>Use: <emphasis>main</emphasis></entry>
33056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33057 <entry>Default: <emphasis>unset</emphasis></entry>
33058 </row>
33059 </tbody>
33060 </tgroup>
33061 </informaltable>
33062 <para>
33063 <indexterm role="concept">
33064 <primary><command>pipe</command> transport</primary>
33065 <secondary>for system filter</secondary>
33066 </indexterm>
33067 <indexterm role="variable">
33068 <primary><varname>$address_pipe</varname></primary>
33069 </indexterm>
33070 This specifies the transport driver that is to be used when a <option>pipe</option> command
33071 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
33072 contains the pipe command.
33073 </para>
33074 <para>
33075 <indexterm role="option">
33076 <primary><option>system_filter_reply_transport</option></primary>
33077 </indexterm>
33078 </para>
33079 <informaltable frame="all">
33080 <tgroup cols="4" colsep="0" rowsep="0">
33081 <colspec colwidth="8*" align="left"/>
33082 <colspec colwidth="6*" align="center"/>
33083 <colspec colwidth="6*" align="center"/>
33084 <colspec colwidth="6*" align="right"/>
33085 <tbody>
33086 <row>
33087 <entry><option>system_filter_reply_transport</option></entry>
33088 <entry>Use: <emphasis>main</emphasis></entry>
33089 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33090 <entry>Default: <emphasis>unset</emphasis></entry>
33091 </row>
33092 </tbody>
33093 </tgroup>
33094 </informaltable>
33095 <para>
33096 <indexterm role="concept">
33097 <primary><command>autoreply</command> transport</primary>
33098 <secondary>for system filter</secondary>
33099 </indexterm>
33100 This specifies the transport driver that is to be used when a <option>mail</option> command
33101 is used in a system filter.
33102 </para>
33103 <para>
33104 <indexterm role="option">
33105 <primary><option>system_filter_user</option></primary>
33106 </indexterm>
33107 </para>
33108 <informaltable frame="all">
33109 <tgroup cols="4" colsep="0" rowsep="0">
33110 <colspec colwidth="8*" align="left"/>
33111 <colspec colwidth="6*" align="center"/>
33112 <colspec colwidth="6*" align="center"/>
33113 <colspec colwidth="6*" align="right"/>
33114 <tbody>
33115 <row>
33116 <entry><option>system_filter_user</option></entry>
33117 <entry>Use: <emphasis>main</emphasis></entry>
33118 <entry>Type: <emphasis>string</emphasis></entry>
33119 <entry>Default: <emphasis>unset</emphasis></entry>
33120 </row>
33121 </tbody>
33122 </tgroup>
33123 </informaltable>
33124 <para>
33125 <indexterm role="concept">
33126 <primary>uid (user id)</primary>
33127 <secondary>system filter</secondary>
33128 </indexterm>
33129 If this option is set to root, the system filter is run in the main Exim
33130 delivery process, as root.  Otherwise, the system filter runs in a separate
33131 process, as the given user, defaulting to the Exim run-time user.
33132 Unless the string consists entirely of digits, it
33133 is looked up in the password data. Failure to find the named user causes a
33134 configuration error. The gid is either taken from the password data, or
33135 specified by <option>system_filter_group</option>. When the uid is specified numerically,
33136 <option>system_filter_group</option> is required to be set.
33137 </para>
33138 <para>
33139 If the system filter generates any pipe, file, or reply deliveries, the uid
33140 under which the filter is run is used when transporting them, unless a
33141 transport option overrides.
33142 </para>
33143 <para>
33144 <indexterm role="option">
33145 <primary><option>tcp_nodelay</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>tcp_nodelay</option></entry>
33157 <entry>Use: <emphasis>main</emphasis></entry>
33158 <entry>Type: <emphasis>boolean</emphasis></entry>
33159 <entry>Default: <emphasis>true</emphasis></entry>
33160 </row>
33161 </tbody>
33162 </tgroup>
33163 </informaltable>
33164 <para>
33165 <indexterm role="concept">
33166 <primary>daemon</primary>
33167 <secondary>TCP_NODELAY on sockets</secondary>
33168 </indexterm>
33169 <indexterm role="concept">
33170 <primary>Nagle algorithm</primary>
33171 </indexterm>
33172 <indexterm role="concept">
33173 <primary>TCP_NODELAY on listening sockets</primary>
33174 </indexterm>
33175 If this option is set false, it stops the Exim daemon setting the
33176 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
33177 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
33178 performance in interactive (character-by-character) situations. Turning it off
33179 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
33180 However, it appears that some broken clients cannot cope, and time out. Hence
33181 this option. It affects only those sockets that are set up for listening by the
33182 daemon. Sockets created by the smtp transport for delivering mail always set
33183 TCP_NODELAY.
33184 </para>
33185 <para>
33186 <indexterm role="option">
33187 <primary><option>timeout_frozen_after</option></primary>
33188 </indexterm>
33189 </para>
33190 <informaltable frame="all">
33191 <tgroup cols="4" colsep="0" rowsep="0">
33192 <colspec colwidth="8*" align="left"/>
33193 <colspec colwidth="6*" align="center"/>
33194 <colspec colwidth="6*" align="center"/>
33195 <colspec colwidth="6*" align="right"/>
33196 <tbody>
33197 <row>
33198 <entry><option>timeout_frozen_after</option></entry>
33199 <entry>Use: <emphasis>main</emphasis></entry>
33200 <entry>Type: <emphasis>time</emphasis></entry>
33201 <entry>Default: <emphasis>0s</emphasis></entry>
33202 </row>
33203 </tbody>
33204 </tgroup>
33205 </informaltable>
33206 <para>
33207 <indexterm role="concept">
33208 <primary>frozen messages</primary>
33209 <secondary>timing out</secondary>
33210 </indexterm>
33211 <indexterm role="concept">
33212 <primary>timeout</primary>
33213 <secondary>frozen messages</secondary>
33214 </indexterm>
33215 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
33216 message of any kind that has been in the queue for longer than the given time
33217 is automatically cancelled at the next queue run. If the frozen message is a
33218 bounce message, it is just discarded; otherwise, a bounce is sent to the
33219 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
33220 If you want to timeout frozen bounce messages earlier than other kinds of
33221 frozen message, see <option>ignore_bounce_errors_after</option>.
33222 </para>
33223 <para>
33224 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
33225 frozen messages remain in the queue forever (except for any frozen bounce
33226 messages that are released by <option>ignore_bounce_errors_after</option>).
33227 </para>
33228 <para>
33229 <indexterm role="option">
33230 <primary><option>timezone</option></primary>
33231 </indexterm>
33232 </para>
33233 <informaltable frame="all">
33234 <tgroup cols="4" colsep="0" rowsep="0">
33235 <colspec colwidth="8*" align="left"/>
33236 <colspec colwidth="6*" align="center"/>
33237 <colspec colwidth="6*" align="center"/>
33238 <colspec colwidth="6*" align="right"/>
33239 <tbody>
33240 <row>
33241 <entry><option>timezone</option></entry>
33242 <entry>Use: <emphasis>main</emphasis></entry>
33243 <entry>Type: <emphasis>string</emphasis></entry>
33244 <entry>Default: <emphasis>unset</emphasis></entry>
33245 </row>
33246 </tbody>
33247 </tgroup>
33248 </informaltable>
33249 <para>
33250 <indexterm role="concept">
33251 <primary>timezone, setting</primary>
33252 </indexterm>
33253 <indexterm role="concept">
33254 <primary>environment</primary>
33255 <secondary>values from</secondary>
33256 </indexterm>
33257 The value of <option>timezone</option> is used to set the environment variable TZ while
33258 running Exim (if it is different on entry). This ensures that all timestamps
33259 created by Exim are in the required timezone. If you want all your timestamps
33260 to be in UTC (aka GMT) you should set
33261 </para>
33262 <literallayout class="monospaced">
33263 timezone = UTC
33264 </literallayout>
33265 <para>
33266 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
33267 or, if that is not set, from the value of the TZ environment variable when Exim
33268 is built. If <option>timezone</option> is set to the empty string, either at build or run
33269 time, any existing TZ variable is removed from the environment when Exim
33270 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
33271 unfortunately not all, operating systems.
33272 </para>
33273 <para>
33274 <indexterm role="option">
33275 <primary><option>tls_advertise_hosts</option></primary>
33276 </indexterm>
33277 </para>
33278 <informaltable frame="all">
33279 <tgroup cols="4" colsep="0" rowsep="0">
33280 <colspec colwidth="8*" align="left"/>
33281 <colspec colwidth="6*" align="center"/>
33282 <colspec colwidth="6*" align="center"/>
33283 <colspec colwidth="6*" align="right"/>
33284 <tbody>
33285 <row>
33286 <entry><option>tls_advertise_hosts</option></entry>
33287 <entry>Use: <emphasis>main</emphasis></entry>
33288 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33289 <entry>Default: <emphasis>*</emphasis></entry>
33290 </row>
33291 </tbody>
33292 </tgroup>
33293 </informaltable>
33294 <para>
33295 <indexterm role="concept">
33296 <primary>TLS</primary>
33297 <secondary>advertising</secondary>
33298 </indexterm>
33299 <indexterm role="concept">
33300 <primary>encryption</primary>
33301 <secondary>on SMTP connection</secondary>
33302 </indexterm>
33303 <indexterm role="concept">
33304 <primary>SMTP</primary>
33305 <secondary>encrypted connection</secondary>
33306 </indexterm>
33307 <indexterm role="concept">
33308 <primary>ESMTP extensions</primary>
33309 <secondary>STARTTLS</secondary>
33310 </indexterm>
33311 When Exim is built with support for TLS encrypted connections, the availability
33312 of the STARTTLS command to set up an encrypted session is advertised in
33313 response to EHLO only to those client hosts that match this option. See
33314 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
33315 Note that the default value requires that a certificate be supplied
33316 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
33317 is not required the <option>tls_advertise_hosts</option> option should be set empty.
33318 </para>
33319 <para>
33320 <indexterm role="option">
33321 <primary><option>unset</option></primary>
33322 </indexterm>
33323 </para>
33324 <informaltable frame="all">
33325 <tgroup cols="4" colsep="0" rowsep="0">
33326 <colspec colwidth="8*" align="left"/>
33327 <colspec colwidth="6*" align="center"/>
33328 <colspec colwidth="6*" align="center"/>
33329 <colspec colwidth="6*" align="right"/>
33330 <tbody>
33331 <row>
33332 <entry><option>tls_certificate</option></entry>
33333 <entry>Use: <emphasis>main</emphasis></entry>
33334 <entry>Type: <emphasis>string</emphasis></entry>
33335 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33336 </row>
33337 </tbody>
33338 </tgroup>
33339 </informaltable>
33340 <para>
33341 <indexterm role="concept">
33342 <primary>TLS</primary>
33343 <secondary>server certificate; location of</secondary>
33344 </indexterm>
33345 <indexterm role="concept">
33346 <primary>certificate</primary>
33347 <secondary>server, location of</secondary>
33348 </indexterm>
33349 The value of this option is expanded, and must then be a list of absolute paths to
33350 files which contain the server&#x2019;s certificates (in PEM format).
33351 Commonly only one file is needed.
33352 The server&#x2019;s private key is also
33353 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
33354 <xref linkend="CHAPTLS"/> for further details.
33355 </para>
33356 <para>
33357 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
33358 receiving incoming messages as a server. If you want to supply certificates for
33359 use when sending messages as a client, you must set the <option>tls_certificate</option>
33360 option in the relevant <command>smtp</command> transport.
33361 </para>
33362 <para>
33363 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
33364 separator in the usual way (<xref linkend="SECTlistsepchange"/>) to avoid confusion under IPv6.
33365 </para>
33366 <para>
33367 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
33368 when a list of more than one
33369 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
33370 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
33371 </para>
33372 <para>
33373 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
33374 if the OpenSSL build supports TLS extensions and the TLS client sends the
33375 Server Name Indication extension, then this option and others documented in
33376 <xref linkend="SECTtlssni"/> will be re-expanded.
33377 </para>
33378 <para>
33379 If this option is unset or empty a fresh self-signed certificate will be
33380 generated for every connection.
33381 </para>
33382 <para>
33383 <indexterm role="option">
33384 <primary><option>tls_crl</option></primary>
33385 </indexterm>
33386 </para>
33387 <informaltable frame="all">
33388 <tgroup cols="4" colsep="0" rowsep="0">
33389 <colspec colwidth="8*" align="left"/>
33390 <colspec colwidth="6*" align="center"/>
33391 <colspec colwidth="6*" align="center"/>
33392 <colspec colwidth="6*" align="right"/>
33393 <tbody>
33394 <row>
33395 <entry><option>tls_crl</option></entry>
33396 <entry>Use: <emphasis>main</emphasis></entry>
33397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33398 <entry>Default: <emphasis>unset</emphasis></entry>
33399 </row>
33400 </tbody>
33401 </tgroup>
33402 </informaltable>
33403 <para>
33404 <indexterm role="concept">
33405 <primary>TLS</primary>
33406 <secondary>server certificate revocation list</secondary>
33407 </indexterm>
33408 <indexterm role="concept">
33409 <primary>certificate</primary>
33410 <secondary>revocation list for server</secondary>
33411 </indexterm>
33412 This option specifies a certificate revocation list. The expanded value must
33413 be the name of a file that contains CRLs in PEM format.
33414 </para>
33415 <para>
33416 Under OpenSSL the option can specify a directory with CRL files.
33417 </para>
33418 <para>
33419 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
33420 for each signing element of the certificate chain (i.e. all but the leaf).
33421 For the file variant this can be multiple PEM blocks in the one file.
33422 </para>
33423 <para>
33424 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33425 </para>
33426 <para>
33427 <indexterm role="option">
33428 <primary><option>tls_dh_max_bits</option></primary>
33429 </indexterm>
33430 </para>
33431 <informaltable frame="all">
33432 <tgroup cols="4" colsep="0" rowsep="0">
33433 <colspec colwidth="8*" align="left"/>
33434 <colspec colwidth="6*" align="center"/>
33435 <colspec colwidth="6*" align="center"/>
33436 <colspec colwidth="6*" align="right"/>
33437 <tbody>
33438 <row>
33439 <entry><option>tls_dh_max_bits</option></entry>
33440 <entry>Use: <emphasis>main</emphasis></entry>
33441 <entry>Type: <emphasis>integer</emphasis></entry>
33442 <entry>Default: <emphasis>2236</emphasis></entry>
33443 </row>
33444 </tbody>
33445 </tgroup>
33446 </informaltable>
33447 <para>
33448 <indexterm role="concept">
33449 <primary>TLS</primary>
33450 <secondary>D-H bit count</secondary>
33451 </indexterm>
33452 The number of bits used for Diffie-Hellman key-exchange may be suggested by
33453 the chosen TLS library.  That value might prove to be too high for
33454 interoperability.  This option provides a maximum clamp on the value
33455 suggested, trading off security for interoperability.
33456 </para>
33457 <para>
33458 The value must be at least 1024.
33459 </para>
33460 <para>
33461 The value 2236 was chosen because, at time of adding the option, it was the
33462 hard-coded maximum value supported by the NSS cryptographic library, as used
33463 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
33464 </para>
33465 <para>
33466 If you prefer more security and are willing to break some clients, raise this
33467 number.
33468 </para>
33469 <para>
33470 Note that the value passed to GnuTLS for *generating* a new prime may be a
33471 little less than this figure, because GnuTLS is inexact and may produce a
33472 larger prime than requested.
33473 </para>
33474 <para>
33475 <indexterm role="option">
33476 <primary><option>tls_dhparam</option></primary>
33477 </indexterm>
33478 </para>
33479 <informaltable frame="all">
33480 <tgroup cols="4" colsep="0" rowsep="0">
33481 <colspec colwidth="8*" align="left"/>
33482 <colspec colwidth="6*" align="center"/>
33483 <colspec colwidth="6*" align="center"/>
33484 <colspec colwidth="6*" align="right"/>
33485 <tbody>
33486 <row>
33487 <entry><option>tls_dhparam</option></entry>
33488 <entry>Use: <emphasis>main</emphasis></entry>
33489 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33490 <entry>Default: <emphasis>unset</emphasis></entry>
33491 </row>
33492 </tbody>
33493 </tgroup>
33494 </informaltable>
33495 <para>
33496 <indexterm role="concept">
33497 <primary>TLS</primary>
33498 <secondary>D-H parameters for server</secondary>
33499 </indexterm>
33500 The value of this option is expanded and indicates the source of DH parameters
33501 to be used by Exim.
33502 </para>
33503 <para>
33504 This option is ignored for GnuTLS version 3.6.0 and later.
33505 The library manages parameter negotiation internally.
33506 </para>
33507 <para>
33508 <emphasis role="bold">Note: The Exim Maintainers strongly recommend,
33509 for other TLS library versions,
33510 using a filename with site-generated
33511 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
33512 other specific constants available are a fallback so that even when
33513 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
33514 </para>
33515 <para>
33516 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
33517 then it names a file from which DH
33518 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
33519 PKCS#3 representation of the DH prime.  If the file does not exist, for
33520 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
33521 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
33522 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
33523 and treated as though the <option>tls_dhparam</option> were set to "none".
33524 </para>
33525 <para>
33526 If this option expands to the string "none", then no DH parameters will be
33527 loaded by Exim.
33528 </para>
33529 <para>
33530 If this option expands to the string "historic" and Exim is using GnuTLS, then
33531 Exim will attempt to load a file from inside the spool directory.  If the file
33532 does not exist, Exim will attempt to create it.
33533 See section <xref linkend="SECTgnutlsparam"/> for further details.
33534 </para>
33535 <para>
33536 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
33537 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
33538 </para>
33539 <para>
33540 In older versions of Exim the default was the 2048 bit prime described in section
33541 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
33542 in IKE is assigned number 23.
33543 </para>
33544 <para>
33545 Otherwise, the option must expand to the name used by Exim for any of a number
33546 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
33547 sources.  As names, Exim uses a standard specified name, else "ike" followed by
33548 the number used by IKE, or "default" which corresponds to
33549 <literal>exim.dev.20160529.3</literal>.
33550 </para>
33551 <para>
33552 The available standard primes are:
33553 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
33554 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
33555 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
33556 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
33557 </para>
33558 <para>
33559 The available additional primes are:
33560 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
33561 </para>
33562 <para>
33563 Some of these will be too small to be accepted by clients.
33564 Some may be too large to be accepted by clients.
33565 The open cryptographic community has suspicions about the integrity of some
33566 of the later IKE values, which led into RFC7919 providing new fixed constants
33567 (the "ffdhe" identifiers).
33568 </para>
33569 <para>
33570 At this point, all of the "ike" values should be considered obsolete;
33571 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
33572 candidates for removal the next time we have backwards-incompatible changes.
33573 </para>
33574 <para>
33575 The TLS protocol does not negotiate an acceptable size for this; clients tend
33576 to hard-drop connections if what is offered by the server is unacceptable,
33577 whether too large or too small, and there&#x2019;s no provision for the client to
33578 tell the server what these constraints are.  Thus, as a server operator, you
33579 need to make an educated guess as to what is most likely to work for your
33580 userbase.
33581 </para>
33582 <para>
33583 Some known size constraints suggest that a bit-size in the range 2048 to 2236
33584 is most likely to maximise interoperability.  The upper bound comes from
33585 applications using the Mozilla Network Security Services (NSS) library, which
33586 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
33587 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
33588 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
33589 acceptable bound from 1024 to 2048.
33590 </para>
33591 <para>
33592 <indexterm role="option">
33593 <primary><option>tls_eccurve</option></primary>
33594 </indexterm>
33595 </para>
33596 <informaltable frame="all">
33597 <tgroup cols="4" colsep="0" rowsep="0">
33598 <colspec colwidth="8*" align="left"/>
33599 <colspec colwidth="6*" align="center"/>
33600 <colspec colwidth="6*" align="center"/>
33601 <colspec colwidth="6*" align="right"/>
33602 <tbody>
33603 <row>
33604 <entry><option>tls_eccurve</option></entry>
33605 <entry>Use: <emphasis>main</emphasis></entry>
33606 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33607 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
33608 </row>
33609 </tbody>
33610 </tgroup>
33611 </informaltable>
33612 <para>
33613 <indexterm role="concept">
33614 <primary>TLS</primary>
33615 <secondary>EC cryptography</secondary>
33616 </indexterm>
33617 This option selects a EC curve for use by Exim when used with OpenSSL.
33618 It has no effect when Exim is used with GnuTLS.
33619 </para>
33620 <para>
33621 After expansion it must contain a valid EC curve parameter, such as
33622 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
33623 for valid selections.
33624 </para>
33625 <para>
33626 For OpenSSL versions before (and not including) 1.0.2, the string
33627 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
33628 <literal>auto</literal> tells the library to choose.
33629 </para>
33630 <para>
33631 If the option expands to an empty string, no EC curves will be enabled.
33632 </para>
33633 <para>
33634 <indexterm role="option">
33635 <primary><option>tls_ocsp_file</option></primary>
33636 </indexterm>
33637 </para>
33638 <informaltable frame="all">
33639 <tgroup cols="4" colsep="0" rowsep="0">
33640 <colspec colwidth="8*" align="left"/>
33641 <colspec colwidth="6*" align="center"/>
33642 <colspec colwidth="6*" align="center"/>
33643 <colspec colwidth="6*" align="right"/>
33644 <tbody>
33645 <row>
33646 <entry><option>tls_ocsp_file</option></entry>
33647 <entry>Use: <emphasis>main</emphasis></entry>
33648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33649 <entry>Default: <emphasis>unset</emphasis></entry>
33650 </row>
33651 </tbody>
33652 </tgroup>
33653 </informaltable>
33654 <para>
33655 <indexterm role="concept">
33656 <primary>TLS</primary>
33657 <secondary>certificate status</secondary>
33658 </indexterm>
33659 <indexterm role="concept">
33660 <primary>TLS</primary>
33661 <secondary>OCSP proof file</secondary>
33662 </indexterm>
33663 This option
33664 must if set expand to the absolute path to a file which contains a current
33665 status proof for the server&#x2019;s certificate, as obtained from the
33666 Certificate Authority.
33667 </para>
33668 <para>
33669 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
33670 The macro "_HAVE_TLS_OCSP" will be defined for those versions.
33671 </para>
33672 <para>
33673 For OpenSSL 1.1.0 or later, and
33674 for GnuTLS 3.5.6 or later the expanded value of this option can be a list
33675 of files, to match a list given for the <option>tls_certificate</option> option.
33676 The ordering of the two lists must match.
33677 The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions.
33678 </para>
33679 <para>
33680 The file(s) should be in DER format,
33681 except for GnuTLS 3.6.3 or later
33682 or for OpenSSL,
33683 when an optional filetype prefix can be used.
33684 The prefix must be one of "DER" or "PEM", followed by
33685 a single space.  If one is used it sets the format for subsequent
33686 files in the list; the initial format is DER.
33687 If multiple proofs are wanted, for multiple chain elements
33688 (this only works under TLS1.3)
33689 they must be coded as a combined OCSP response.
33690 </para>
33691 <para>
33692 Although GnuTLS will accept PEM files with multiple separate
33693 PEM blobs (ie. separate OCSP responses), it sends them in the
33694 TLS Certificate record interleaved with the certificates of the chain;
33695 although a GnuTLS client is happy with that, an OpenSSL client is not.
33696 </para>
33697 <para>
33698 <indexterm role="option">
33699 <primary><option>tls_on_connect_ports</option></primary>
33700 </indexterm>
33701 </para>
33702 <informaltable frame="all">
33703 <tgroup cols="4" colsep="0" rowsep="0">
33704 <colspec colwidth="8*" align="left"/>
33705 <colspec colwidth="6*" align="center"/>
33706 <colspec colwidth="6*" align="center"/>
33707 <colspec colwidth="6*" align="right"/>
33708 <tbody>
33709 <row>
33710 <entry><option>tls_on_connect_ports</option></entry>
33711 <entry>Use: <emphasis>main</emphasis></entry>
33712 <entry>Type: <emphasis>string list</emphasis></entry>
33713 <entry>Default: <emphasis>unset</emphasis></entry>
33714 </row>
33715 </tbody>
33716 </tgroup>
33717 </informaltable>
33718 <para>
33719 <indexterm role="concept">
33720 <primary>SSMTP</primary>
33721 </indexterm>
33722 <indexterm role="concept">
33723 <primary>SMTPS</primary>
33724 </indexterm>
33725 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
33726 operate the SSMTP (SMTPS) protocol, where a TLS session is immediately
33727 set up without waiting for the client to issue a STARTTLS command. For
33728 further details, see section <xref linkend="SECTsupobssmt"/>.
33729 </para>
33730 <para>
33731 <indexterm role="option">
33732 <primary><option>unset</option></primary>
33733 </indexterm>
33734 </para>
33735 <informaltable frame="all">
33736 <tgroup cols="4" colsep="0" rowsep="0">
33737 <colspec colwidth="8*" align="left"/>
33738 <colspec colwidth="6*" align="center"/>
33739 <colspec colwidth="6*" align="center"/>
33740 <colspec colwidth="6*" align="right"/>
33741 <tbody>
33742 <row>
33743 <entry><option>tls_privatekey</option></entry>
33744 <entry>Use: <emphasis>main</emphasis></entry>
33745 <entry>Type: <emphasis>string</emphasis></entry>
33746 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33747 </row>
33748 </tbody>
33749 </tgroup>
33750 </informaltable>
33751 <para>
33752 <indexterm role="concept">
33753 <primary>TLS</primary>
33754 <secondary>server private key; location of</secondary>
33755 </indexterm>
33756 The value of this option is expanded, and must then be a list of absolute paths to
33757 files which contains the server&#x2019;s private keys.
33758 If this option is unset, or if
33759 the expansion is forced to fail, or the result is an empty string, the private
33760 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
33761 <xref linkend="CHAPTLS"/> for further details.
33762 </para>
33763 <para>
33764 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33765 </para>
33766 <para>
33767 <indexterm role="option">
33768 <primary><option>tls_remember_esmtp</option></primary>
33769 </indexterm>
33770 </para>
33771 <informaltable frame="all">
33772 <tgroup cols="4" colsep="0" rowsep="0">
33773 <colspec colwidth="8*" align="left"/>
33774 <colspec colwidth="6*" align="center"/>
33775 <colspec colwidth="6*" align="center"/>
33776 <colspec colwidth="6*" align="right"/>
33777 <tbody>
33778 <row>
33779 <entry><option>tls_remember_esmtp</option></entry>
33780 <entry>Use: <emphasis>main</emphasis></entry>
33781 <entry>Type: <emphasis>boolean</emphasis></entry>
33782 <entry>Default: <emphasis>false</emphasis></entry>
33783 </row>
33784 </tbody>
33785 </tgroup>
33786 </informaltable>
33787 <para>
33788 <indexterm role="concept">
33789 <primary>TLS</primary>
33790 <secondary>esmtp state; remembering</secondary>
33791 </indexterm>
33792 <indexterm role="concept">
33793 <primary>TLS</primary>
33794 <secondary>broken clients</secondary>
33795 </indexterm>
33796 If this option is set true, Exim violates the RFCs by remembering that it is in
33797 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
33798 support for broken clients that fail to send a new EHLO after starting a
33799 TLS session.
33800 </para>
33801 <para>
33802 <indexterm role="option">
33803 <primary><option>tls_require_ciphers</option></primary>
33804 </indexterm>
33805 </para>
33806 <informaltable frame="all">
33807 <tgroup cols="4" colsep="0" rowsep="0">
33808 <colspec colwidth="8*" align="left"/>
33809 <colspec colwidth="6*" align="center"/>
33810 <colspec colwidth="6*" align="center"/>
33811 <colspec colwidth="6*" align="right"/>
33812 <tbody>
33813 <row>
33814 <entry><option>tls_require_ciphers</option></entry>
33815 <entry>Use: <emphasis>main</emphasis></entry>
33816 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33817 <entry>Default: <emphasis>unset</emphasis></entry>
33818 </row>
33819 </tbody>
33820 </tgroup>
33821 </informaltable>
33822 <para>
33823 <indexterm role="concept">
33824 <primary>TLS</primary>
33825 <secondary>requiring specific ciphers</secondary>
33826 </indexterm>
33827 <indexterm role="concept">
33828 <primary>cipher</primary>
33829 <secondary>requiring specific</secondary>
33830 </indexterm>
33831 This option controls which ciphers can be used for incoming TLS connections.
33832 The <command>smtp</command> transport has an option of the same name for controlling outgoing
33833 connections. This option is expanded for each connection, so can be varied for
33834 different clients if required. The value of this option must be a list of
33835 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
33836 in somewhat different ways. If GnuTLS is being used, the client controls the
33837 preference order of the available ciphers. Details are given in sections
33838 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
33839 </para>
33840 <para>
33841 <indexterm role="option">
33842 <primary><option>tls_try_verify_hosts</option></primary>
33843 </indexterm>
33844 </para>
33845 <informaltable frame="all">
33846 <tgroup cols="4" colsep="0" rowsep="0">
33847 <colspec colwidth="8*" align="left"/>
33848 <colspec colwidth="6*" align="center"/>
33849 <colspec colwidth="6*" align="center"/>
33850 <colspec colwidth="6*" align="right"/>
33851 <tbody>
33852 <row>
33853 <entry><option>tls_try_verify_hosts</option></entry>
33854 <entry>Use: <emphasis>main</emphasis></entry>
33855 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33856 <entry>Default: <emphasis>unset</emphasis></entry>
33857 </row>
33858 </tbody>
33859 </tgroup>
33860 </informaltable>
33861 <para>
33862 <indexterm role="concept">
33863 <primary>TLS</primary>
33864 <secondary>client certificate verification</secondary>
33865 </indexterm>
33866 <indexterm role="concept">
33867 <primary>certificate</primary>
33868 <secondary>verification of client</secondary>
33869 </indexterm>
33870 See <option>tls_verify_hosts</option> below.
33871 </para>
33872 <para>
33873 <indexterm role="option">
33874 <primary><option>tls_verify_certificates</option></primary>
33875 </indexterm>
33876 </para>
33877 <informaltable frame="all">
33878 <tgroup cols="4" colsep="0" rowsep="0">
33879 <colspec colwidth="8*" align="left"/>
33880 <colspec colwidth="6*" align="center"/>
33881 <colspec colwidth="6*" align="center"/>
33882 <colspec colwidth="6*" align="right"/>
33883 <tbody>
33884 <row>
33885 <entry><option>tls_verify_certificates</option></entry>
33886 <entry>Use: <emphasis>main</emphasis></entry>
33887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33888 <entry>Default: <emphasis>system</emphasis></entry>
33889 </row>
33890 </tbody>
33891 </tgroup>
33892 </informaltable>
33893 <para>
33894 <indexterm role="concept">
33895 <primary>TLS</primary>
33896 <secondary>client certificate verification</secondary>
33897 </indexterm>
33898 <indexterm role="concept">
33899 <primary>certificate</primary>
33900 <secondary>verification of client</secondary>
33901 </indexterm>
33902 The value of this option is expanded, and must then be either the
33903 word "system"
33904 or the absolute path to
33905 a file or directory containing permitted certificates for clients that
33906 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
33907 </para>
33908 <para>
33909 The "system" value for the option will use a
33910 system default location compiled into the SSL library.
33911 This is not available for GnuTLS versions preceding 3.0.20,
33912 and will be taken as empty; an explicit location
33913 must be specified.
33914 </para>
33915 <para>
33916 The use of a directory for the option value is not available for GnuTLS versions
33917 preceding 3.3.6 and a single file must be used.
33918 </para>
33919 <para>
33920 With OpenSSL the certificates specified
33921 explicitly
33922 either by file or directory
33923 are added to those given by the system default location.
33924 </para>
33925 <para>
33926 These certificates should be for the certificate authorities trusted, rather
33927 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
33928 the value is a file then the certificates are sent by Exim as a server to
33929 connecting clients, defining the list of accepted certificate authorities.
33930 Thus the values defined should be considered public data.  To avoid this,
33931 use the explicit directory version.
33932 </para>
33933 <para>
33934 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33935 </para>
33936 <para>
33937 A forced expansion failure or setting to an empty string is equivalent to
33938 being unset.
33939 </para>
33940 <para>
33941 <indexterm role="option">
33942 <primary><option>tls_verify_hosts</option></primary>
33943 </indexterm>
33944 </para>
33945 <informaltable frame="all">
33946 <tgroup cols="4" colsep="0" rowsep="0">
33947 <colspec colwidth="8*" align="left"/>
33948 <colspec colwidth="6*" align="center"/>
33949 <colspec colwidth="6*" align="center"/>
33950 <colspec colwidth="6*" align="right"/>
33951 <tbody>
33952 <row>
33953 <entry><option>tls_verify_hosts</option></entry>
33954 <entry>Use: <emphasis>main</emphasis></entry>
33955 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33956 <entry>Default: <emphasis>unset</emphasis></entry>
33957 </row>
33958 </tbody>
33959 </tgroup>
33960 </informaltable>
33961 <para>
33962 <indexterm role="concept">
33963 <primary>TLS</primary>
33964 <secondary>client certificate verification</secondary>
33965 </indexterm>
33966 <indexterm role="concept">
33967 <primary>certificate</primary>
33968 <secondary>verification of client</secondary>
33969 </indexterm>
33970 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
33971 certificates from clients. The expected certificates are defined by
33972 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
33973 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
33974 <option>tls_verify_certificates</option> is not set.
33975 </para>
33976 <para>
33977 Any client that matches <option>tls_verify_hosts</option> is constrained by
33978 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
33979 present one of the listed certificates. If it does not, the connection is
33980 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
33981 the host to use TLS. It can still send SMTP commands through unencrypted
33982 connections. Forcing a client to use TLS has to be done separately using an
33983 ACL to reject inappropriate commands when the connection is not encrypted.
33984 </para>
33985 <para>
33986 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
33987 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
33988 certificate and checks it against <option>tls_verify_certificates</option>, but does not
33989 abort the connection if there is no certificate or if it does not match. This
33990 state can be detected in an ACL, which makes it possible to implement policies
33991 such as <quote>accept for relay only if a verified certificate has been received,
33992 but accept for local delivery if encrypted, even without a verified
33993 certificate</quote>.
33994 </para>
33995 <para>
33996 Client hosts that match neither of these lists are not asked to present
33997 certificates.
33998 </para>
33999 <para>
34000 <indexterm role="option">
34001 <primary><option>trusted_groups</option></primary>
34002 </indexterm>
34003 </para>
34004 <informaltable frame="all">
34005 <tgroup cols="4" colsep="0" rowsep="0">
34006 <colspec colwidth="8*" align="left"/>
34007 <colspec colwidth="6*" align="center"/>
34008 <colspec colwidth="6*" align="center"/>
34009 <colspec colwidth="6*" align="right"/>
34010 <tbody>
34011 <row>
34012 <entry><option>trusted_groups</option></entry>
34013 <entry>Use: <emphasis>main</emphasis></entry>
34014 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34015 <entry>Default: <emphasis>unset</emphasis></entry>
34016 </row>
34017 </tbody>
34018 </tgroup>
34019 </informaltable>
34020 <para>
34021 <indexterm role="concept">
34022 <primary>trusted groups</primary>
34023 </indexterm>
34024 <indexterm role="concept">
34025 <primary>groups</primary>
34026 <secondary>trusted</secondary>
34027 </indexterm>
34028 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
34029 option is set, any process that is running in one of the listed groups, or
34030 which has one of them as a supplementary group, is trusted. The groups can be
34031 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
34032 details of what trusted callers are permitted to do. If neither
34033 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
34034 are trusted.
34035 </para>
34036 <para>
34037 <indexterm role="option">
34038 <primary><option>trusted_users</option></primary>
34039 </indexterm>
34040 </para>
34041 <informaltable frame="all">
34042 <tgroup cols="4" colsep="0" rowsep="0">
34043 <colspec colwidth="8*" align="left"/>
34044 <colspec colwidth="6*" align="center"/>
34045 <colspec colwidth="6*" align="center"/>
34046 <colspec colwidth="6*" align="right"/>
34047 <tbody>
34048 <row>
34049 <entry><option>trusted_users</option></entry>
34050 <entry>Use: <emphasis>main</emphasis></entry>
34051 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34052 <entry>Default: <emphasis>unset</emphasis></entry>
34053 </row>
34054 </tbody>
34055 </tgroup>
34056 </informaltable>
34057 <para>
34058 <indexterm role="concept">
34059 <primary>trusted users</primary>
34060 </indexterm>
34061 <indexterm role="concept">
34062 <primary>user</primary>
34063 <secondary>trusted</secondary>
34064 </indexterm>
34065 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
34066 option is set, any process that is running as one of the listed users is
34067 trusted. The users can be specified numerically or by name. See section
34068 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
34069 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
34070 Exim user are trusted.
34071 </para>
34072 <para>
34073 <indexterm role="option">
34074 <primary><option>unknown_login</option></primary>
34075 </indexterm>
34076 </para>
34077 <informaltable frame="all">
34078 <tgroup cols="4" colsep="0" rowsep="0">
34079 <colspec colwidth="8*" align="left"/>
34080 <colspec colwidth="6*" align="center"/>
34081 <colspec colwidth="6*" align="center"/>
34082 <colspec colwidth="6*" align="right"/>
34083 <tbody>
34084 <row>
34085 <entry><option>unknown_login</option></entry>
34086 <entry>Use: <emphasis>main</emphasis></entry>
34087 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34088 <entry>Default: <emphasis>unset</emphasis></entry>
34089 </row>
34090 </tbody>
34091 </tgroup>
34092 </informaltable>
34093 <para>
34094 <indexterm role="concept">
34095 <primary>uid (user id)</primary>
34096 <secondary>unknown caller</secondary>
34097 </indexterm>
34098 <indexterm role="variable">
34099 <primary><varname>$caller_uid</varname></primary>
34100 </indexterm>
34101 This is a specialized feature for use in unusual configurations. By default, if
34102 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
34103 gives up. The <option>unknown_login</option> option can be used to set a login name to be
34104 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
34105 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
34106 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
34107 <option>-F</option> option.
34108 </para>
34109 <para>
34110 <indexterm role="option">
34111 <primary><option>unknown_username</option></primary>
34112 </indexterm>
34113 </para>
34114 <informaltable frame="all">
34115 <tgroup cols="4" colsep="0" rowsep="0">
34116 <colspec colwidth="8*" align="left"/>
34117 <colspec colwidth="6*" align="center"/>
34118 <colspec colwidth="6*" align="center"/>
34119 <colspec colwidth="6*" align="right"/>
34120 <tbody>
34121 <row>
34122 <entry><option>unknown_username</option></entry>
34123 <entry>Use: <emphasis>main</emphasis></entry>
34124 <entry>Type: <emphasis>string</emphasis></entry>
34125 <entry>Default: <emphasis>unset</emphasis></entry>
34126 </row>
34127 </tbody>
34128 </tgroup>
34129 </informaltable>
34130 <para>
34131 See <option>unknown_login</option>.
34132 </para>
34133 <para>
34134 <indexterm role="option">
34135 <primary><option>untrusted_set_sender</option></primary>
34136 </indexterm>
34137 </para>
34138 <informaltable frame="all">
34139 <tgroup cols="4" colsep="0" rowsep="0">
34140 <colspec colwidth="8*" align="left"/>
34141 <colspec colwidth="6*" align="center"/>
34142 <colspec colwidth="6*" align="center"/>
34143 <colspec colwidth="6*" align="right"/>
34144 <tbody>
34145 <row>
34146 <entry><option>untrusted_set_sender</option></entry>
34147 <entry>Use: <emphasis>main</emphasis></entry>
34148 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34149 <entry>Default: <emphasis>unset</emphasis></entry>
34150 </row>
34151 </tbody>
34152 </tgroup>
34153 </informaltable>
34154 <para>
34155 <indexterm role="concept">
34156 <primary>trusted users</primary>
34157 </indexterm>
34158 <indexterm role="concept">
34159 <primary>sender</primary>
34160 <secondary>setting by untrusted user</secondary>
34161 </indexterm>
34162 <indexterm role="concept">
34163 <primary>untrusted user setting sender</primary>
34164 </indexterm>
34165 <indexterm role="concept">
34166 <primary>user</primary>
34167 <secondary>untrusted setting sender</secondary>
34168 </indexterm>
34169 <indexterm role="concept">
34170 <primary>envelope from</primary>
34171 </indexterm>
34172 <indexterm role="concept">
34173 <primary>envelope sender</primary>
34174 </indexterm>
34175 When an untrusted user submits a message to Exim using the standard input, Exim
34176 normally creates an envelope sender address from the user&#x2019;s login and the
34177 default qualification domain. Data from the <option>-f</option> option (for setting envelope
34178 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
34179 is used) is ignored.
34180 </para>
34181 <para>
34182 However, untrusted users are permitted to set an empty envelope sender address,
34183 to declare that a message should never generate any bounces. For example:
34184 </para>
34185 <literallayout class="monospaced">
34186 exim -f '&lt;&gt;' user@domain.example
34187 </literallayout>
34188 <para>
34189 <indexterm role="variable">
34190 <primary><varname>$sender_ident</varname></primary>
34191 </indexterm>
34192 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
34193 other envelope sender addresses in a controlled way. When it is set, untrusted
34194 users are allowed to set envelope sender addresses that match any of the
34195 patterns in the list. Like all address lists, the string is expanded. The
34196 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
34197 users to setting senders that start with their login ids
34198 followed by a hyphen
34199 by a setting like this:
34200 </para>
34201 <literallayout class="monospaced">
34202 untrusted_set_sender = ^$sender_ident-
34203 </literallayout>
34204 <para>
34205 If you want to allow untrusted users to set envelope sender addresses without
34206 restriction, you can use
34207 </para>
34208 <literallayout class="monospaced">
34209 untrusted_set_sender = *
34210 </literallayout>
34211 <para>
34212 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
34213 only to the setting of the envelope sender. It does not permit untrusted users
34214 to use the other options which trusted user can use to override message
34215 parameters. Furthermore, it does not stop Exim from removing an existing
34216 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
34217 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
34218 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
34219 described in section <xref linkend="SECTthesenhea"/>.
34220 </para>
34221 <para>
34222 The log line for a message&#x2019;s arrival shows the envelope sender following
34223 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
34224 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
34225 envelope sender address, the user&#x2019;s login is shown in parentheses after the
34226 sender address.
34227 </para>
34228 <para>
34229 <indexterm role="option">
34230 <primary><option>uucp_from_pattern</option></primary>
34231 </indexterm>
34232 </para>
34233 <informaltable frame="all">
34234 <tgroup cols="4" colsep="0" rowsep="0">
34235 <colspec colwidth="8*" align="left"/>
34236 <colspec colwidth="6*" align="center"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="right"/>
34239 <tbody>
34240 <row>
34241 <entry><option>uucp_from_pattern</option></entry>
34242 <entry>Use: <emphasis>main</emphasis></entry>
34243 <entry>Type: <emphasis>string</emphasis></entry>
34244 <entry>Default: <emphasis>see below</emphasis></entry>
34245 </row>
34246 </tbody>
34247 </tgroup>
34248 </informaltable>
34249 <para>
34250 <indexterm role="concept">
34251 <primary><quote>From</quote> line</primary>
34252 </indexterm>
34253 <indexterm role="concept">
34254 <primary>UUCP</primary>
34255 <secondary><quote>From</quote> line</secondary>
34256 </indexterm>
34257 Some applications that pass messages to an MTA via a command line interface use
34258 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
34259 particular, this is used by UUCP software. Exim recognizes such a line by means
34260 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
34261 matches, the sender address is constructed by expanding the contents of
34262 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
34263 default pattern recognizes lines in the following two forms:
34264 </para>
34265 <literallayout class="monospaced">
34266 From ph10 Fri Jan  5 12:35 GMT 1996
34267 From ph10 Fri, 7 Jan 97 14:00:00 GMT
34268 </literallayout>
34269 <para>
34270 The pattern can be seen by running
34271 </para>
34272 <literallayout class="monospaced">
34273 exim -bP uucp_from_pattern
34274 </literallayout>
34275 <para>
34276 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
34277 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
34278 regular expression by a parenthesized subpattern. The default value for
34279 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
34280 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
34281 <option>ignore_fromline_hosts</option>.
34282 </para>
34283 <para>
34284 <indexterm role="option">
34285 <primary><option>uucp_from_sender</option></primary>
34286 </indexterm>
34287 </para>
34288 <informaltable frame="all">
34289 <tgroup cols="4" colsep="0" rowsep="0">
34290 <colspec colwidth="8*" align="left"/>
34291 <colspec colwidth="6*" align="center"/>
34292 <colspec colwidth="6*" align="center"/>
34293 <colspec colwidth="6*" align="right"/>
34294 <tbody>
34295 <row>
34296 <entry><option>uucp_from_sender</option></entry>
34297 <entry>Use: <emphasis>main</emphasis></entry>
34298 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34299 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
34300 </row>
34301 </tbody>
34302 </tgroup>
34303 </informaltable>
34304 <para>
34305 See <option>uucp_from_pattern</option> above.
34306 </para>
34307 <para>
34308 <indexterm role="option">
34309 <primary><option>warn_message_file</option></primary>
34310 </indexterm>
34311 </para>
34312 <informaltable frame="all">
34313 <tgroup cols="4" colsep="0" rowsep="0">
34314 <colspec colwidth="8*" align="left"/>
34315 <colspec colwidth="6*" align="center"/>
34316 <colspec colwidth="6*" align="center"/>
34317 <colspec colwidth="6*" align="right"/>
34318 <tbody>
34319 <row>
34320 <entry><option>warn_message_file</option></entry>
34321 <entry>Use: <emphasis>main</emphasis></entry>
34322 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34323 <entry>Default: <emphasis>unset</emphasis></entry>
34324 </row>
34325 </tbody>
34326 </tgroup>
34327 </informaltable>
34328 <para>
34329 <indexterm role="concept">
34330 <primary>warning of delay</primary>
34331 <secondary>customizing the message</secondary>
34332 </indexterm>
34333 <indexterm role="concept">
34334 <primary>customizing</primary>
34335 <secondary>warning message</secondary>
34336 </indexterm>
34337 This option defines a template file containing paragraphs of text to be used
34338 for constructing the warning message which is sent by Exim when a message has
34339 been in the queue for a specified amount of time, as specified by
34340 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
34341 <xref linkend="CHAPemsgcust"/>.
34342 </para>
34343 <para revisionflag="changed">
34344 <indexterm role="concept">
34345 <primary>warn_message_file</primary>
34346 <secondary>tainted data</secondary>
34347 </indexterm>
34348 The option is expanded to give the file path, which must be
34349 absolute and untainted.
34350 </para>
34351 <para>
34352 See also <option>bounce_message_file</option>.
34353 </para>
34354 <para>
34355 <indexterm role="option">
34356 <primary><option>write_rejectlog</option></primary>
34357 </indexterm>
34358 </para>
34359 <informaltable frame="all">
34360 <tgroup cols="4" colsep="0" rowsep="0">
34361 <colspec colwidth="8*" align="left"/>
34362 <colspec colwidth="6*" align="center"/>
34363 <colspec colwidth="6*" align="center"/>
34364 <colspec colwidth="6*" align="right"/>
34365 <tbody>
34366 <row>
34367 <entry><option>write_rejectlog</option></entry>
34368 <entry>Use: <emphasis>main</emphasis></entry>
34369 <entry>Type: <emphasis>boolean</emphasis></entry>
34370 <entry>Default: <emphasis>true</emphasis></entry>
34371 </row>
34372 </tbody>
34373 </tgroup>
34374 </informaltable>
34375 <para>
34376 <indexterm role="concept">
34377 <primary>reject log</primary>
34378 <secondary>disabling</secondary>
34379 </indexterm>
34380 If this option is set false, Exim no longer writes anything to the reject log.
34381 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
34382 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
34383 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
34384 </para>
34385 </section>
34386 </chapter>
34387
34388 <chapter id="CHAProutergeneric">
34389 <title>Generic options for routers</title>
34390 <para>
34391 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
34392 <primary>options</primary>
34393 <secondary>generic; for routers</secondary>
34394 </indexterm>
34395 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
34396 <primary>generic options</primary>
34397 <secondary>router</secondary>
34398 </indexterm>
34399 This chapter describes the generic options that apply to all routers.
34400 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
34401 </para>
34402 <para>
34403 For a general description of how a router operates, see sections
34404 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
34405 which the preconditions are tested. The order of expansion of the options that
34406 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
34407 <option>headers_remove</option>, <option>transport</option>.
34408 </para>
34409 <para>
34410 <indexterm role="option">
34411 <primary><option>address_data</option></primary>
34412 </indexterm>
34413 </para>
34414 <informaltable frame="all">
34415 <tgroup cols="4" colsep="0" rowsep="0">
34416 <colspec colwidth="8*" align="left"/>
34417 <colspec colwidth="6*" align="center"/>
34418 <colspec colwidth="6*" align="center"/>
34419 <colspec colwidth="6*" align="right"/>
34420 <tbody>
34421 <row>
34422 <entry><option>address_data</option></entry>
34423 <entry>Use: <emphasis>routers</emphasis></entry>
34424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34425 <entry>Default: <emphasis>unset</emphasis></entry>
34426 </row>
34427 </tbody>
34428 </tgroup>
34429 </informaltable>
34430 <para>
34431 <indexterm role="concept">
34432 <primary>router</primary>
34433 <secondary>data attached to address</secondary>
34434 </indexterm>
34435 The string is expanded just before the router is run, that is, after all the
34436 precondition tests have succeeded. If the expansion is forced to fail, the
34437 router declines, the value of <option>address_data</option> remains unchanged, and the
34438 <option>more</option> option controls what happens next. Other expansion failures cause
34439 delivery of the address to be deferred.
34440 </para>
34441 <para>
34442 <indexterm role="variable">
34443 <primary><varname>$address_data</varname></primary>
34444 </indexterm>
34445 When the expansion succeeds, the value is retained with the address, and can be
34446 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
34447 routers, and the eventual transport.
34448 </para>
34449 <para>
34450 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
34451 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
34452 in the filter. This is not normally a problem, because such data is usually
34453 either not confidential or it <quote>belongs</quote> to the current user, but if you do
34454 put confidential data into <varname>$address_data</varname> you need to remember this point.
34455 </para>
34456 <para>
34457 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
34458 with the address, though it can be changed by another <option>address_data</option> setting
34459 on a subsequent router. If a router generates child addresses, the value of
34460 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
34461 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
34462 </para>
34463 <para>
34464 The idea of <option>address_data</option> is that you can use it to look up a lot of data
34465 for the address once, and then pick out parts of the data later. For example,
34466 you could use a single LDAP lookup to return a string of the form
34467 </para>
34468 <literallayout class="monospaced">
34469 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
34470 </literallayout>
34471 <para>
34472 In the transport you could pick out the mailbox by a setting such as
34473 </para>
34474 <literallayout class="monospaced">
34475 file = ${extract{mailbox}{$address_data}}
34476 </literallayout>
34477 <para>
34478 This makes the configuration file less messy, and also reduces the number of
34479 lookups (though Exim does cache lookups).
34480 </para>
34481 <para>
34482 See also the <option>set</option> option below.
34483 </para>
34484 <para>
34485 <indexterm role="variable">
34486 <primary><varname>$sender_address_data</varname></primary>
34487 </indexterm>
34488 <indexterm role="variable">
34489 <primary><varname>$address_data</varname></primary>
34490 </indexterm>
34491 The <option>address_data</option> facility is also useful as a means of passing information
34492 from one router to another, and from a router to a transport. In addition, if
34493 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
34494 ACL, it remains available for use in the rest of the ACL statement. After
34495 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
34496 </para>
34497 <para>
34498 <indexterm role="option">
34499 <primary><option>address_test</option></primary>
34500 </indexterm>
34501 </para>
34502 <informaltable frame="all">
34503 <tgroup cols="4" colsep="0" rowsep="0">
34504 <colspec colwidth="8*" align="left"/>
34505 <colspec colwidth="6*" align="center"/>
34506 <colspec colwidth="6*" align="center"/>
34507 <colspec colwidth="6*" align="right"/>
34508 <tbody>
34509 <row>
34510 <entry><option>address_test</option></entry>
34511 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34512 <entry>Type: <emphasis>boolean</emphasis></entry>
34513 <entry>Default: <emphasis>true</emphasis></entry>
34514 </row>
34515 </tbody>
34516 </tgroup>
34517 </informaltable>
34518 <para>
34519 <indexterm role="option">
34520 <primary><option>-bt</option></primary>
34521 </indexterm>
34522 <indexterm role="concept">
34523 <primary>router</primary>
34524 <secondary>skipping when address testing</secondary>
34525 </indexterm>
34526 If this option is set false, the router is skipped when routing is being tested
34527 by means of the <option>-bt</option> command line option. This can be a convenience when
34528 your first router sends messages to an external scanner, because it saves you
34529 having to set the <quote>already scanned</quote> indicator when testing real address
34530 routing.
34531 </para>
34532 <para>
34533 <indexterm role="option">
34534 <primary><option>cannot_route_message</option></primary>
34535 </indexterm>
34536 </para>
34537 <informaltable frame="all">
34538 <tgroup cols="4" colsep="0" rowsep="0">
34539 <colspec colwidth="8*" align="left"/>
34540 <colspec colwidth="6*" align="center"/>
34541 <colspec colwidth="6*" align="center"/>
34542 <colspec colwidth="6*" align="right"/>
34543 <tbody>
34544 <row>
34545 <entry><option>cannot_route_message</option></entry>
34546 <entry>Use: <emphasis>routers</emphasis></entry>
34547 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34548 <entry>Default: <emphasis>unset</emphasis></entry>
34549 </row>
34550 </tbody>
34551 </tgroup>
34552 </informaltable>
34553 <para>
34554 <indexterm role="concept">
34555 <primary>router</primary>
34556 <secondary>customizing <quote>cannot route</quote> message</secondary>
34557 </indexterm>
34558 <indexterm role="concept">
34559 <primary>customizing</primary>
34560 <secondary><quote>cannot route</quote> message</secondary>
34561 </indexterm>
34562 This option specifies a text message that is used when an address cannot be
34563 routed because Exim has run out of routers. The default message is
34564 <quote>Unrouteable address</quote>. This option is useful only on routers that have
34565 <option>more</option> set false, or on the very last router in a configuration, because the
34566 value that is used is taken from the last router that is considered. This
34567 includes a router that is skipped because its preconditions are not met, as
34568 well as a router that declines. For example, using the default configuration,
34569 you could put:
34570 </para>
34571 <literallayout class="monospaced">
34572 cannot_route_message = Remote domain not found in DNS
34573 </literallayout>
34574 <para>
34575 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
34576 and
34577 </para>
34578 <literallayout class="monospaced">
34579 cannot_route_message = Unknown local user
34580 </literallayout>
34581 <para>
34582 on the final router that checks for local users. If string expansion fails for
34583 this option, the default message is used. Unless the expansion failure was
34584 explicitly forced, a message about the failure is written to the main and panic
34585 logs, in addition to the normal message about the routing failure.
34586 </para>
34587 <para>
34588 <indexterm role="option">
34589 <primary><option>caseful_local_part</option></primary>
34590 </indexterm>
34591 </para>
34592 <informaltable frame="all">
34593 <tgroup cols="4" colsep="0" rowsep="0">
34594 <colspec colwidth="8*" align="left"/>
34595 <colspec colwidth="6*" align="center"/>
34596 <colspec colwidth="6*" align="center"/>
34597 <colspec colwidth="6*" align="right"/>
34598 <tbody>
34599 <row>
34600 <entry><option>caseful_local_part</option></entry>
34601 <entry>Use: <emphasis>routers</emphasis></entry>
34602 <entry>Type: <emphasis>boolean</emphasis></entry>
34603 <entry>Default: <emphasis>false</emphasis></entry>
34604 </row>
34605 </tbody>
34606 </tgroup>
34607 </informaltable>
34608 <para>
34609 <indexterm role="concept">
34610 <primary>case of local parts</primary>
34611 </indexterm>
34612 <indexterm role="concept">
34613 <primary>router</primary>
34614 <secondary>case of local parts</secondary>
34615 </indexterm>
34616 By default, routers handle the local parts of addresses in a case-insensitive
34617 manner, though the actual case is preserved for transmission with the message.
34618 If you want the case of letters to be significant in a router, you must set
34619 this option true. For individual router options that contain address or local
34620 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
34621 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
34622 more details.
34623 </para>
34624 <para>
34625 <indexterm role="variable">
34626 <primary><varname>$local_part</varname></primary>
34627 </indexterm>
34628 <indexterm role="variable">
34629 <primary><varname>$original_local_part</varname></primary>
34630 </indexterm>
34631 <indexterm role="variable">
34632 <primary><varname>$parent_local_part</varname></primary>
34633 </indexterm>
34634 The value of the <varname>$local_part</varname> variable is forced to lower case while a
34635 router is running unless <option>caseful_local_part</option> is set. When a router assigns
34636 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
34637 is the same as it was in the router. Similarly, when a router generates child
34638 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
34639 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
34640 </para>
34641 <para>
34642 This option applies to the processing of an address by a router. When a
34643 recipient address is being processed in an ACL, there is a separate <option>control</option>
34644 modifier that can be used to specify case-sensitive processing within the ACL
34645 (see section <xref linkend="SECTcontrols"/>).
34646 </para>
34647 <para>
34648 <indexterm role="option">
34649 <primary><option>check_local_user</option></primary>
34650 </indexterm>
34651 </para>
34652 <informaltable frame="all">
34653 <tgroup cols="4" colsep="0" rowsep="0">
34654 <colspec colwidth="8*" align="left"/>
34655 <colspec colwidth="6*" align="center"/>
34656 <colspec colwidth="6*" align="center"/>
34657 <colspec colwidth="6*" align="right"/>
34658 <tbody>
34659 <row>
34660 <entry><option>check_local_user</option></entry>
34661 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34662 <entry>Type: <emphasis>boolean</emphasis></entry>
34663 <entry>Default: <emphasis>false</emphasis></entry>
34664 </row>
34665 </tbody>
34666 </tgroup>
34667 </informaltable>
34668 <para>
34669 <indexterm role="concept">
34670 <primary>local user, checking in router</primary>
34671 </indexterm>
34672 <indexterm role="concept">
34673 <primary>router</primary>
34674 <secondary>checking for local user</secondary>
34675 </indexterm>
34676 <indexterm role="concept">
34677 <primary><filename>/etc/passwd</filename></primary>
34678 </indexterm>
34679 <indexterm role="variable">
34680 <primary><varname>$home</varname></primary>
34681 </indexterm>
34682 When this option is true, Exim checks that the local part of the recipient
34683 address (with affixes removed if relevant) is the name of an account on the
34684 local system. The check is done by calling the <function>getpwnam()</function> function rather
34685 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
34686 holding password data (such as NIS) are supported. If the local part is a local
34687 user, <varname>$home</varname> is set from the password data, and can be tested in other
34688 preconditions that are evaluated after this one (the order of evaluation is
34689 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
34690 overridden by <option>router_home_directory</option>. If the local part is not a local user,
34691 the router is skipped.
34692 </para>
34693 <para>
34694 If you want to check that the local part is either the name of a local user
34695 or matches something else, you cannot combine <option>check_local_user</option> with a
34696 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
34697 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
34698 setting to achieve this. For example:
34699 </para>
34700 <literallayout class="monospaced">
34701 local_parts = passwd;$local_part : lsearch;/etc/other/users
34702 </literallayout>
34703 <para>
34704 Note, however, that the side effects of <option>check_local_user</option> (such as setting
34705 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
34706 <option>local_parts</option> (or any other) precondition.
34707 </para>
34708 <para>
34709 <indexterm role="option">
34710 <primary><option>condition</option></primary>
34711 </indexterm>
34712 </para>
34713 <informaltable frame="all">
34714 <tgroup cols="4" colsep="0" rowsep="0">
34715 <colspec colwidth="8*" align="left"/>
34716 <colspec colwidth="6*" align="center"/>
34717 <colspec colwidth="6*" align="center"/>
34718 <colspec colwidth="6*" align="right"/>
34719 <tbody>
34720 <row>
34721 <entry><option>condition</option></entry>
34722 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34723 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34724 <entry>Default: <emphasis>unset</emphasis></entry>
34725 </row>
34726 </tbody>
34727 </tgroup>
34728 </informaltable>
34729 <para>
34730 <indexterm role="concept">
34731 <primary>router</primary>
34732 <secondary>customized precondition</secondary>
34733 </indexterm>
34734 This option specifies a general precondition test that has to succeed for the
34735 router to be called. The <option>condition</option> option is the last precondition to be
34736 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
34737 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
34738 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
34739 router is skipped, and the address is offered to the next one.
34740 </para>
34741 <para>
34742 If the result is any other value, the router is run (as this is the last
34743 precondition to be evaluated, all the other preconditions must be true).
34744 </para>
34745 <para>
34746 This option is unusual in that multiple <option>condition</option> options may be present.
34747 All <option>condition</option> options must succeed.
34748 </para>
34749 <para>
34750 The <option>condition</option> option provides a means of applying custom conditions to the
34751 running of routers. Note that in the case of a simple conditional expansion,
34752 the default expansion values are exactly what is wanted. For example:
34753 </para>
34754 <literallayout class="monospaced">
34755 condition = ${if &gt;{$message_age}{600}}
34756 </literallayout>
34757 <para>
34758 Because of the default behaviour of the string expansion, this is equivalent to
34759 </para>
34760 <literallayout class="monospaced">
34761 condition = ${if &gt;{$message_age}{600}{true}{}}
34762 </literallayout>
34763 <para>
34764 A multiple condition example, which succeeds:
34765 </para>
34766 <literallayout class="monospaced">
34767 condition = ${if &gt;{$message_age}{600}}
34768 condition = ${if !eq{${lc:$local_part}}{postmaster}}
34769 condition = foobar
34770 </literallayout>
34771 <para>
34772 If the expansion fails (other than forced failure) delivery is deferred. Some
34773 of the other precondition options are common special cases that could in fact
34774 be specified using <option>condition</option>.
34775 </para>
34776 <para>
34777 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
34778 are far older, and use one set of semantics.  ACLs are newer and when
34779 they were created, the ACL <option>condition</option> process was given far stricter
34780 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
34781 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
34782 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
34783 Router rules processing behavior.
34784 </para>
34785 <para>
34786 This is best illustrated in an example:
34787 </para>
34788 <literallayout class="monospaced">
34789 # If used in an ACL condition will fail with a syntax error, but
34790 # in a router condition any extra characters are treated as a string
34791
34792 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
34793 true {yes} {no}}
34794
34795 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
34796  {yes} {no}}
34797 </literallayout>
34798 <para>
34799 In each example above, the <option>if</option> statement actually ends after
34800 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
34801 default <option>if</option> behavior is to return a boolean true or a null answer
34802 (which evaluates to false). The rest of the line is then treated as a
34803 string. So the first example resulted in the boolean answer <quote>true</quote>
34804 with the string <quote> {yes} {no}}</quote> appended to it. The second example
34805 resulted in the null output (indicating false) with the string
34806 <quote> {yes} {no}}</quote> appended to it.
34807 </para>
34808 <para>
34809 In fact you can put excess forward braces in too.  In the router
34810 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
34811 mean something, like after a <quote>$</quote> or when required as part of a
34812 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
34813 string characters.
34814 </para>
34815 <para>
34816 Thus, in a Router, the above expansion strings will both always evaluate
34817 true, as the result of expansion is a non-empty string which doesn&#x2019;t
34818 match an explicit false value.  This can be tricky to debug.  By
34819 contrast, in an ACL either of those strings will always result in an
34820 expansion error because the result doesn&#x2019;t look sufficiently boolean.
34821 </para>
34822 <para>
34823 <indexterm role="option">
34824 <primary><option>debug_print</option></primary>
34825 </indexterm>
34826 </para>
34827 <informaltable frame="all">
34828 <tgroup cols="4" colsep="0" rowsep="0">
34829 <colspec colwidth="8*" align="left"/>
34830 <colspec colwidth="6*" align="center"/>
34831 <colspec colwidth="6*" align="center"/>
34832 <colspec colwidth="6*" align="right"/>
34833 <tbody>
34834 <row>
34835 <entry><option>debug_print</option></entry>
34836 <entry>Use: <emphasis>routers</emphasis></entry>
34837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34838 <entry>Default: <emphasis>unset</emphasis></entry>
34839 </row>
34840 </tbody>
34841 </tgroup>
34842 </informaltable>
34843 <para>
34844 <indexterm role="concept">
34845 <primary>testing</primary>
34846 <secondary>variables in drivers</secondary>
34847 </indexterm>
34848 If this option is set and debugging is enabled (see the <option>-d</option> command line
34849 option) or in address-testing mode (see the <option>-bt</option> command line option),
34850 the string is expanded and included in the debugging output.
34851 If expansion of the string fails, the error message is written to the debugging
34852 output, and Exim carries on processing.
34853 This option is provided to help with checking out the values of variables and
34854 so on when debugging router configurations. For example, if a <option>condition</option>
34855 option appears not to be working, <option>debug_print</option> can be used to output the
34856 variables it references. The output happens after checks for <option>domains</option>,
34857 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
34858 are tested. A newline is added to the text if it does not end with one.
34859 The variable <varname>$router_name</varname> contains the name of the router.
34860 </para>
34861 <para>
34862 <indexterm role="option">
34863 <primary><option>disable_logging</option></primary>
34864 </indexterm>
34865 </para>
34866 <informaltable frame="all">
34867 <tgroup cols="4" colsep="0" rowsep="0">
34868 <colspec colwidth="8*" align="left"/>
34869 <colspec colwidth="6*" align="center"/>
34870 <colspec colwidth="6*" align="center"/>
34871 <colspec colwidth="6*" align="right"/>
34872 <tbody>
34873 <row>
34874 <entry><option>disable_logging</option></entry>
34875 <entry>Use: <emphasis>routers</emphasis></entry>
34876 <entry>Type: <emphasis>boolean</emphasis></entry>
34877 <entry>Default: <emphasis>false</emphasis></entry>
34878 </row>
34879 </tbody>
34880 </tgroup>
34881 </informaltable>
34882 <para>
34883 If this option is set true, nothing is logged for any routing errors
34884 or for any deliveries caused by this router. You should not set this option
34885 unless you really, really know what you are doing. See also the generic
34886 transport option of the same name.
34887 </para>
34888 <para>
34889 <indexterm role="option">
34890 <primary><option>dnssec_request_domains</option></primary>
34891 </indexterm>
34892 </para>
34893 <informaltable frame="all">
34894 <tgroup cols="4" colsep="0" rowsep="0">
34895 <colspec colwidth="8*" align="left"/>
34896 <colspec colwidth="6*" align="center"/>
34897 <colspec colwidth="6*" align="center"/>
34898 <colspec colwidth="6*" align="right"/>
34899 <tbody>
34900 <row>
34901 <entry><option>dnssec_request_domains</option></entry>
34902 <entry>Use: <emphasis>routers</emphasis></entry>
34903 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34904 <entry>Default: <emphasis>*</emphasis></entry>
34905 </row>
34906 </tbody>
34907 </tgroup>
34908 </informaltable>
34909 <para>
34910 <indexterm role="concept">
34911 <primary>MX record</primary>
34912 <secondary>security</secondary>
34913 </indexterm>
34914 <indexterm role="concept">
34915 <primary>DNSSEC</primary>
34916 <secondary>MX lookup</secondary>
34917 </indexterm>
34918 <indexterm role="concept">
34919 <primary>security</primary>
34920 <secondary>MX lookup</secondary>
34921 </indexterm>
34922 <indexterm role="concept">
34923 <primary>DNS</primary>
34924 <secondary>DNSSEC</secondary>
34925 </indexterm>
34926 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
34927 the dnssec request bit set.
34928 This applies to all of the SRV, MX, AAAA, A lookup sequence.
34929 </para>
34930 <para>
34931 <indexterm role="option">
34932 <primary><option>dnssec_require_domains</option></primary>
34933 </indexterm>
34934 </para>
34935 <informaltable frame="all">
34936 <tgroup cols="4" colsep="0" rowsep="0">
34937 <colspec colwidth="8*" align="left"/>
34938 <colspec colwidth="6*" align="center"/>
34939 <colspec colwidth="6*" align="center"/>
34940 <colspec colwidth="6*" align="right"/>
34941 <tbody>
34942 <row>
34943 <entry><option>dnssec_require_domains</option></entry>
34944 <entry>Use: <emphasis>routers</emphasis></entry>
34945 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34946 <entry>Default: <emphasis>unset</emphasis></entry>
34947 </row>
34948 </tbody>
34949 </tgroup>
34950 </informaltable>
34951 <para>
34952 <indexterm role="concept">
34953 <primary>MX record</primary>
34954 <secondary>security</secondary>
34955 </indexterm>
34956 <indexterm role="concept">
34957 <primary>DNSSEC</primary>
34958 <secondary>MX lookup</secondary>
34959 </indexterm>
34960 <indexterm role="concept">
34961 <primary>security</primary>
34962 <secondary>MX lookup</secondary>
34963 </indexterm>
34964 <indexterm role="concept">
34965 <primary>DNS</primary>
34966 <secondary>DNSSEC</secondary>
34967 </indexterm>
34968 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
34969 the dnssec request bit set.  Any returns not having the Authenticated Data bit
34970 (AD bit) set will be ignored and logged as a host-lookup failure.
34971 This applies to all of the SRV, MX, AAAA, A lookup sequence.
34972 </para>
34973 <para>
34974 <indexterm role="option">
34975 <primary><option>domains</option></primary>
34976 </indexterm>
34977 </para>
34978 <informaltable frame="all">
34979 <tgroup cols="4" colsep="0" rowsep="0">
34980 <colspec colwidth="8*" align="left"/>
34981 <colspec colwidth="6*" align="center"/>
34982 <colspec colwidth="6*" align="center"/>
34983 <colspec colwidth="6*" align="right"/>
34984 <tbody>
34985 <row>
34986 <entry><option>domains</option></entry>
34987 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34988 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34989 <entry>Default: <emphasis>unset</emphasis></entry>
34990 </row>
34991 </tbody>
34992 </tgroup>
34993 </informaltable>
34994 <para>
34995 <indexterm role="concept">
34996 <primary>router</primary>
34997 <secondary>restricting to specific domains</secondary>
34998 </indexterm>
34999 <indexterm role="variable">
35000 <primary><varname>$domain_data</varname></primary>
35001 </indexterm>
35002 If this option is set, the router is skipped unless the current domain matches
35003 the list. If the match is achieved by means of a file lookup, the data that the
35004 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
35005 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
35006 a list of the order in which preconditions are evaluated.
35007 </para>
35008 <para>
35009 <indexterm role="option">
35010 <primary><option>driver</option></primary>
35011 </indexterm>
35012 </para>
35013 <informaltable frame="all">
35014 <tgroup cols="4" colsep="0" rowsep="0">
35015 <colspec colwidth="8*" align="left"/>
35016 <colspec colwidth="6*" align="center"/>
35017 <colspec colwidth="6*" align="center"/>
35018 <colspec colwidth="6*" align="right"/>
35019 <tbody>
35020 <row>
35021 <entry><option>driver</option></entry>
35022 <entry>Use: <emphasis>routers</emphasis></entry>
35023 <entry>Type: <emphasis>string</emphasis></entry>
35024 <entry>Default: <emphasis>unset</emphasis></entry>
35025 </row>
35026 </tbody>
35027 </tgroup>
35028 </informaltable>
35029 <para>
35030 This option must always be set. It specifies which of the available routers is
35031 to be used.
35032 </para>
35033 <para>
35034 <indexterm role="option">
35035 <primary><option>dsn_lasthop</option></primary>
35036 </indexterm>
35037 </para>
35038 <informaltable frame="all">
35039 <tgroup cols="4" colsep="0" rowsep="0">
35040 <colspec colwidth="8*" align="left"/>
35041 <colspec colwidth="6*" align="center"/>
35042 <colspec colwidth="6*" align="center"/>
35043 <colspec colwidth="6*" align="right"/>
35044 <tbody>
35045 <row>
35046 <entry><option>dsn_lasthop</option></entry>
35047 <entry>Use: <emphasis>routers</emphasis></entry>
35048 <entry>Type: <emphasis>boolean</emphasis></entry>
35049 <entry>Default: <emphasis>false</emphasis></entry>
35050 </row>
35051 </tbody>
35052 </tgroup>
35053 </informaltable>
35054 <para>
35055 <indexterm role="concept">
35056 <primary>DSN</primary>
35057 <secondary>success</secondary>
35058 </indexterm>
35059 <indexterm role="concept">
35060 <primary>Delivery Status Notification</primary>
35061 <secondary>success</secondary>
35062 </indexterm>
35063 If this option is set true, and extended DSN (RFC3461) processing is in effect,
35064 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
35065 instead send a success DSN as if the next hop does not support DSN.
35066 Not effective on redirect routers.
35067 </para>
35068 <para>
35069 <indexterm role="option">
35070 <primary><option>errors_to</option></primary>
35071 </indexterm>
35072 </para>
35073 <informaltable frame="all">
35074 <tgroup cols="4" colsep="0" rowsep="0">
35075 <colspec colwidth="8*" align="left"/>
35076 <colspec colwidth="6*" align="center"/>
35077 <colspec colwidth="6*" align="center"/>
35078 <colspec colwidth="6*" align="right"/>
35079 <tbody>
35080 <row>
35081 <entry><option>errors_to</option></entry>
35082 <entry>Use: <emphasis>routers</emphasis></entry>
35083 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35084 <entry>Default: <emphasis>unset</emphasis></entry>
35085 </row>
35086 </tbody>
35087 </tgroup>
35088 </informaltable>
35089 <para>
35090 <indexterm role="concept">
35091 <primary>envelope from</primary>
35092 </indexterm>
35093 <indexterm role="concept">
35094 <primary>envelope sender</primary>
35095 </indexterm>
35096 <indexterm role="concept">
35097 <primary>router</primary>
35098 <secondary>changing address for errors</secondary>
35099 </indexterm>
35100 If a router successfully handles an address, it may assign the address to a
35101 transport for delivery or it may generate child addresses. In both cases, if
35102 there is a delivery problem during later processing, the resulting bounce
35103 message is sent to the address that results from expanding this string,
35104 provided that the address verifies successfully. The <option>errors_to</option> option is
35105 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
35106 </para>
35107 <para>
35108 The <option>errors_to</option> setting associated with an address can be overridden if it
35109 subsequently passes through other routers that have their own <option>errors_to</option>
35110 settings, or if the message is delivered by a transport with a <option>return_path</option>
35111 setting.
35112 </para>
35113 <para>
35114 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
35115 the expansion fails to verify, the errors address associated with the incoming
35116 address is used. At top level, this is the envelope sender. A non-forced
35117 expansion failure causes delivery to be deferred.
35118 </para>
35119 <para>
35120 If an address for which <option>errors_to</option> has been set ends up being delivered over
35121 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
35122 any bounces that are generated by other MTAs on the delivery route are also
35123 sent there. You can set <option>errors_to</option> to the empty string by either of these
35124 settings:
35125 </para>
35126 <literallayout class="monospaced">
35127 errors_to =
35128 errors_to = ""
35129 </literallayout>
35130 <para>
35131 An expansion item that yields an empty string has the same effect. If you do
35132 this, a locally detected delivery error for addresses processed by this router
35133 no longer gives rise to a bounce message; the error is discarded. If the
35134 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
35135 overridden by the <option>return_path</option> option on the transport.
35136 </para>
35137 <para>
35138 <indexterm role="variable">
35139 <primary><varname>$address_data</varname></primary>
35140 </indexterm>
35141 If for some reason you want to discard local errors, but use a non-empty
35142 MAIL command for remote delivery, you can preserve the original return
35143 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
35144 setting <option>return_path</option>.
35145 </para>
35146 <para>
35147 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
35148 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
35149 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
35150 </para>
35151 <para>
35152 <indexterm role="option">
35153 <primary><option>expn</option></primary>
35154 </indexterm>
35155 </para>
35156 <informaltable frame="all">
35157 <tgroup cols="4" colsep="0" rowsep="0">
35158 <colspec colwidth="8*" align="left"/>
35159 <colspec colwidth="6*" align="center"/>
35160 <colspec colwidth="6*" align="center"/>
35161 <colspec colwidth="6*" align="right"/>
35162 <tbody>
35163 <row>
35164 <entry><option>expn</option></entry>
35165 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35166 <entry>Type: <emphasis>boolean</emphasis></entry>
35167 <entry>Default: <emphasis>true</emphasis></entry>
35168 </row>
35169 </tbody>
35170 </tgroup>
35171 </informaltable>
35172 <para>
35173 <indexterm role="concept">
35174 <primary>address</primary>
35175 <secondary>testing</secondary>
35176 </indexterm>
35177 <indexterm role="concept">
35178 <primary>testing</primary>
35179 <secondary>addresses</secondary>
35180 </indexterm>
35181 <indexterm role="concept">
35182 <primary>EXPN</primary>
35183 <secondary>router skipping</secondary>
35184 </indexterm>
35185 <indexterm role="concept">
35186 <primary>router</primary>
35187 <secondary>skipping for EXPN</secondary>
35188 </indexterm>
35189 If this option is turned off, the router is skipped when testing an address
35190 as a result of processing an SMTP EXPN command. You might, for example,
35191 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
35192 on for the system alias file.
35193 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35194 are evaluated.
35195 </para>
35196 <para>
35197 The use of the SMTP EXPN command is controlled by an ACL (see chapter
35198 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
35199 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
35200 </para>
35201 <para>
35202 <indexterm role="option">
35203 <primary><option>fail_verify</option></primary>
35204 </indexterm>
35205 </para>
35206 <informaltable frame="all">
35207 <tgroup cols="4" colsep="0" rowsep="0">
35208 <colspec colwidth="8*" align="left"/>
35209 <colspec colwidth="6*" align="center"/>
35210 <colspec colwidth="6*" align="center"/>
35211 <colspec colwidth="6*" align="right"/>
35212 <tbody>
35213 <row>
35214 <entry><option>fail_verify</option></entry>
35215 <entry>Use: <emphasis>routers</emphasis></entry>
35216 <entry>Type: <emphasis>boolean</emphasis></entry>
35217 <entry>Default: <emphasis>false</emphasis></entry>
35218 </row>
35219 </tbody>
35220 </tgroup>
35221 </informaltable>
35222 <para>
35223 <indexterm role="concept">
35224 <primary>router</primary>
35225 <secondary>forcing verification failure</secondary>
35226 </indexterm>
35227 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
35228 <option>fail_verify_recipient</option> to the same value.
35229 </para>
35230 <para>
35231 <indexterm role="option">
35232 <primary><option>fail_verify_recipient</option></primary>
35233 </indexterm>
35234 </para>
35235 <informaltable frame="all">
35236 <tgroup cols="4" colsep="0" rowsep="0">
35237 <colspec colwidth="8*" align="left"/>
35238 <colspec colwidth="6*" align="center"/>
35239 <colspec colwidth="6*" align="center"/>
35240 <colspec colwidth="6*" align="right"/>
35241 <tbody>
35242 <row>
35243 <entry><option>fail_verify_recipient</option></entry>
35244 <entry>Use: <emphasis>routers</emphasis></entry>
35245 <entry>Type: <emphasis>boolean</emphasis></entry>
35246 <entry>Default: <emphasis>false</emphasis></entry>
35247 </row>
35248 </tbody>
35249 </tgroup>
35250 </informaltable>
35251 <para>
35252 If this option is true and an address is accepted by this router when
35253 verifying a recipient, verification fails.
35254 </para>
35255 <para>
35256 <indexterm role="option">
35257 <primary><option>fail_verify_sender</option></primary>
35258 </indexterm>
35259 </para>
35260 <informaltable frame="all">
35261 <tgroup cols="4" colsep="0" rowsep="0">
35262 <colspec colwidth="8*" align="left"/>
35263 <colspec colwidth="6*" align="center"/>
35264 <colspec colwidth="6*" align="center"/>
35265 <colspec colwidth="6*" align="right"/>
35266 <tbody>
35267 <row>
35268 <entry><option>fail_verify_sender</option></entry>
35269 <entry>Use: <emphasis>routers</emphasis></entry>
35270 <entry>Type: <emphasis>boolean</emphasis></entry>
35271 <entry>Default: <emphasis>false</emphasis></entry>
35272 </row>
35273 </tbody>
35274 </tgroup>
35275 </informaltable>
35276 <para>
35277 If this option is true and an address is accepted by this router when
35278 verifying a sender, verification fails.
35279 </para>
35280 <para>
35281 <indexterm role="option">
35282 <primary><option>fallback_hosts</option></primary>
35283 </indexterm>
35284 </para>
35285 <informaltable frame="all">
35286 <tgroup cols="4" colsep="0" rowsep="0">
35287 <colspec colwidth="8*" align="left"/>
35288 <colspec colwidth="6*" align="center"/>
35289 <colspec colwidth="6*" align="center"/>
35290 <colspec colwidth="6*" align="right"/>
35291 <tbody>
35292 <row>
35293 <entry><option>fallback_hosts</option></entry>
35294 <entry>Use: <emphasis>routers</emphasis></entry>
35295 <entry>Type: <emphasis>string list</emphasis></entry>
35296 <entry>Default: <emphasis>unset</emphasis></entry>
35297 </row>
35298 </tbody>
35299 </tgroup>
35300 </informaltable>
35301 <para>
35302 <indexterm role="concept">
35303 <primary>router</primary>
35304 <secondary>fallback hosts</secondary>
35305 </indexterm>
35306 <indexterm role="concept">
35307 <primary>fallback</primary>
35308 <secondary>hosts specified on router</secondary>
35309 </indexterm>
35310 String expansion is not applied to this option. The argument must be a
35311 colon-separated list of host names or IP addresses. The list separator can be
35312 changed (see section <xref linkend="SECTlistsepchange"/>), and a port can be specified with
35313 each name or address. In fact, the format of each item is exactly the same as
35314 defined for the list of hosts in a <command>manualroute</command> router (see section
35315 <xref linkend="SECTformatonehostitem"/>).
35316 </para>
35317 <para>
35318 If a router queues an address for a remote transport, this host list is
35319 associated with the address, and used instead of the transport&#x2019;s fallback host
35320 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
35321 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
35322 transport for further details.
35323 </para>
35324 <para>
35325 <indexterm role="option">
35326 <primary><option>group</option></primary>
35327 </indexterm>
35328 </para>
35329 <informaltable frame="all">
35330 <tgroup cols="4" colsep="0" rowsep="0">
35331 <colspec colwidth="8*" align="left"/>
35332 <colspec colwidth="6*" align="center"/>
35333 <colspec colwidth="6*" align="center"/>
35334 <colspec colwidth="6*" align="right"/>
35335 <tbody>
35336 <row>
35337 <entry><option>group</option></entry>
35338 <entry>Use: <emphasis>routers</emphasis></entry>
35339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35340 <entry>Default: <emphasis>see below</emphasis></entry>
35341 </row>
35342 </tbody>
35343 </tgroup>
35344 </informaltable>
35345 <para>
35346 <indexterm role="concept">
35347 <primary>gid (group id)</primary>
35348 <secondary>local delivery</secondary>
35349 </indexterm>
35350 <indexterm role="concept">
35351 <primary>local transports</primary>
35352 <secondary>uid and gid</secondary>
35353 </indexterm>
35354 <indexterm role="concept">
35355 <primary>transport</primary>
35356 <secondary>local</secondary>
35357 </indexterm>
35358 <indexterm role="concept">
35359 <primary>router</primary>
35360 <secondary>setting group</secondary>
35361 </indexterm>
35362 When a router queues an address for a transport, and the transport does not
35363 specify a group, the group given here is used when running the delivery
35364 process.
35365 The group may be specified numerically or by name. If expansion fails, the
35366 error is logged and delivery is deferred.
35367 The default is unset, unless <option>check_local_user</option> is set, when the default
35368 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
35369 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
35370 </para>
35371 <para>
35372 <indexterm role="option">
35373 <primary><option>headers_add</option></primary>
35374 </indexterm>
35375 </para>
35376 <informaltable frame="all">
35377 <tgroup cols="4" colsep="0" rowsep="0">
35378 <colspec colwidth="8*" align="left"/>
35379 <colspec colwidth="6*" align="center"/>
35380 <colspec colwidth="6*" align="center"/>
35381 <colspec colwidth="6*" align="right"/>
35382 <tbody>
35383 <row>
35384 <entry><option>headers_add</option></entry>
35385 <entry>Use: <emphasis>routers</emphasis></entry>
35386 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
35387 <entry>Default: <emphasis>unset</emphasis></entry>
35388 </row>
35389 </tbody>
35390 </tgroup>
35391 </informaltable>
35392 <para>
35393 <indexterm role="concept">
35394 <primary>header lines</primary>
35395 <secondary>adding</secondary>
35396 </indexterm>
35397 <indexterm role="concept">
35398 <primary>router</primary>
35399 <secondary>adding header lines</secondary>
35400 </indexterm>
35401 This option specifies a list of text headers,
35402 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
35403 that is associated with any addresses that are accepted by the router.
35404 Each item is separately expanded, at routing time.  However, this
35405 option has no effect when an address is just being verified. The way in which
35406 the text is used to add header lines at transport time is described in section
35407 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
35408 message is in the process of being transported. This means that references to
35409 header lines in string expansions in the transport&#x2019;s configuration do not
35410 <quote>see</quote> the added header lines.
35411 </para>
35412 <para>
35413 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
35414 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
35415 an item expansion is forced to fail, the item has no effect. Other expansion
35416 failures are treated as configuration errors.
35417 </para>
35418 <para>
35419 Unlike most options, <option>headers_add</option> can be specified multiple times
35420 for a router; all listed headers are added.
35421 </para>
35422 <para>
35423 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
35424 router that has the <option>one_time</option> option set.
35425 </para>
35426 <para>
35427 <indexterm role="concept">
35428 <primary>duplicate addresses</primary>
35429 </indexterm>
35430 <indexterm role="option">
35431 <primary><option>unseen</option></primary>
35432 </indexterm>
35433 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
35434 additions are deleted when the address is passed on to subsequent routers.
35435 For a <option>redirect</option> router, if a generated address is the same as the incoming
35436 address, this can lead to duplicate addresses with different header
35437 modifications. Exim does not do duplicate deliveries (except, in certain
35438 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
35439 which of the duplicates is discarded, so this ambiguous situation should be
35440 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
35441 </para>
35442 <para>
35443 <indexterm role="option">
35444 <primary><option>headers_remove</option></primary>
35445 </indexterm>
35446 </para>
35447 <informaltable frame="all">
35448 <tgroup cols="4" colsep="0" rowsep="0">
35449 <colspec colwidth="8*" align="left"/>
35450 <colspec colwidth="6*" align="center"/>
35451 <colspec colwidth="6*" align="center"/>
35452 <colspec colwidth="6*" align="right"/>
35453 <tbody>
35454 <row>
35455 <entry><option>headers_remove</option></entry>
35456 <entry>Use: <emphasis>routers</emphasis></entry>
35457 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
35458 <entry>Default: <emphasis>unset</emphasis></entry>
35459 </row>
35460 </tbody>
35461 </tgroup>
35462 </informaltable>
35463 <para>
35464 <indexterm role="concept">
35465 <primary>header lines</primary>
35466 <secondary>removing</secondary>
35467 </indexterm>
35468 <indexterm role="concept">
35469 <primary>router</primary>
35470 <secondary>removing header lines</secondary>
35471 </indexterm>
35472 This option specifies a list of text headers,
35473 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
35474 that is associated with any addresses that are accepted by the router.
35475 However, the option has no effect when an address is just being verified.
35476 Each list item is separately expanded, at transport time.
35477 </para>
35478 <para revisionflag="changed">
35479 If an item ends in *, it will match any header with the given prefix.
35480 </para>
35481 <para>
35482 The way in which
35483 the text is used to remove header lines at transport time is described in
35484 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
35485 the message is in the process of being transported. This means that references
35486 to header lines in string expansions in the transport&#x2019;s configuration still
35487 <quote>see</quote> the original header lines.
35488 </para>
35489 <para>
35490 The <option>headers_remove</option> option is handled after <option>errors_to</option> and
35491 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
35492 the item has no effect. Other expansion failures are treated as configuration
35493 errors.
35494 </para>
35495 <para>
35496 Unlike most options, <option>headers_remove</option> can be specified multiple times
35497 for a router; all listed headers are removed.
35498 </para>
35499 <para>
35500 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
35501 router that has the <option>one_time</option> option set.
35502 </para>
35503 <para>
35504 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
35505 removal requests are deleted when the address is passed on to subsequent
35506 routers, and this can lead to problems with duplicates -- see the similar
35507 warning for <option>headers_add</option> above.
35508 </para>
35509 <para>
35510 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
35511 items that contain a list separator must have it doubled.
35512 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
35513 </para>
35514 <para>
35515 <indexterm role="option">
35516 <primary><option>ignore_target_hosts</option></primary>
35517 </indexterm>
35518 </para>
35519 <informaltable frame="all">
35520 <tgroup cols="4" colsep="0" rowsep="0">
35521 <colspec colwidth="8*" align="left"/>
35522 <colspec colwidth="6*" align="center"/>
35523 <colspec colwidth="6*" align="center"/>
35524 <colspec colwidth="6*" align="right"/>
35525 <tbody>
35526 <row>
35527 <entry><option>ignore_target_hosts</option></entry>
35528 <entry>Use: <emphasis>routers</emphasis></entry>
35529 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35530 <entry>Default: <emphasis>unset</emphasis></entry>
35531 </row>
35532 </tbody>
35533 </tgroup>
35534 </informaltable>
35535 <para>
35536 <indexterm role="concept">
35537 <primary>IP address</primary>
35538 <secondary>discarding</secondary>
35539 </indexterm>
35540 <indexterm role="concept">
35541 <primary>router</primary>
35542 <secondary>discarding IP addresses</secondary>
35543 </indexterm>
35544 Although this option is a host list, it should normally contain IP address
35545 entries rather than names. If any host that is looked up by the router has an
35546 IP address that matches an item in this list, Exim behaves as if that IP
35547 address did not exist. This option allows you to cope with rogue DNS entries
35548 like
35549 </para>
35550 <literallayout class="monospaced">
35551 remote.domain.example.  A  127.0.0.1
35552 </literallayout>
35553 <para>
35554 by setting
35555 </para>
35556 <literallayout class="monospaced">
35557 ignore_target_hosts = 127.0.0.1
35558 </literallayout>
35559 <para>
35560 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
35561 discarded in this way, the router declines. In a conventional configuration, an
35562 attempt to mail to such a domain would normally provoke the <quote>unrouteable
35563 domain</quote> error, and an attempt to verify an address in the domain would fail.
35564 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
35565 router declines if presented with one of the listed addresses.
35566 </para>
35567 <para>
35568 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
35569 means of the first or the second of the following settings, respectively:
35570 </para>
35571 <literallayout class="monospaced">
35572 ignore_target_hosts = 0.0.0.0/0
35573 ignore_target_hosts = &lt;; 0::0/0
35574 </literallayout>
35575 <para>
35576 The pattern in the first line matches all IPv4 addresses, whereas the pattern
35577 in the second line matches all IPv6 addresses.
35578 </para>
35579 <para>
35580 This option may also be useful for ignoring link-local and site-local IPv6
35581 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
35582 is expanded before use as a list, it is possible to make it dependent on the
35583 domain that is being routed.
35584 </para>
35585 <para>
35586 <indexterm role="variable">
35587 <primary><varname>$host_address</varname></primary>
35588 </indexterm>
35589 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
35590 checked.
35591 </para>
35592 <para>
35593 <indexterm role="option">
35594 <primary><option>initgroups</option></primary>
35595 </indexterm>
35596 </para>
35597 <informaltable frame="all">
35598 <tgroup cols="4" colsep="0" rowsep="0">
35599 <colspec colwidth="8*" align="left"/>
35600 <colspec colwidth="6*" align="center"/>
35601 <colspec colwidth="6*" align="center"/>
35602 <colspec colwidth="6*" align="right"/>
35603 <tbody>
35604 <row>
35605 <entry><option>initgroups</option></entry>
35606 <entry>Use: <emphasis>routers</emphasis></entry>
35607 <entry>Type: <emphasis>boolean</emphasis></entry>
35608 <entry>Default: <emphasis>false</emphasis></entry>
35609 </row>
35610 </tbody>
35611 </tgroup>
35612 </informaltable>
35613 <para>
35614 <indexterm role="concept">
35615 <primary>additional groups</primary>
35616 </indexterm>
35617 <indexterm role="concept">
35618 <primary>groups</primary>
35619 <secondary>additional</secondary>
35620 </indexterm>
35621 <indexterm role="concept">
35622 <primary>local transports</primary>
35623 <secondary>uid and gid</secondary>
35624 </indexterm>
35625 <indexterm role="concept">
35626 <primary>transport</primary>
35627 <secondary>local</secondary>
35628 </indexterm>
35629 If the router queues an address for a transport, and this option is true, and
35630 the uid supplied by the router is not overridden by the transport, the
35631 <function>initgroups()</function> function is called when running the transport to ensure that
35632 any additional groups associated with the uid are set up. See also <option>group</option>
35633 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
35634 </para>
35635 <para>
35636 <indexterm role="option">
35637 <primary><option>local_part_prefix</option></primary>
35638 </indexterm>
35639 </para>
35640 <informaltable frame="all">
35641 <tgroup cols="4" colsep="0" rowsep="0">
35642 <colspec colwidth="8*" align="left"/>
35643 <colspec colwidth="6*" align="center"/>
35644 <colspec colwidth="6*" align="center"/>
35645 <colspec colwidth="6*" align="right"/>
35646 <tbody>
35647 <row>
35648 <entry><option>local_part_prefix</option></entry>
35649 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35650 <entry>Type: <emphasis>string list</emphasis></entry>
35651 <entry>Default: <emphasis>unset</emphasis></entry>
35652 </row>
35653 </tbody>
35654 </tgroup>
35655 </informaltable>
35656 <para>
35657 <indexterm role="concept">
35658 <primary>affix</primary>
35659 <secondary>router precondition</secondary>
35660 </indexterm>
35661 <indexterm role="concept">
35662 <primary>router</primary>
35663 <secondary>prefix for local part</secondary>
35664 </indexterm>
35665 <indexterm role="concept">
35666 <primary>prefix</primary>
35667 <secondary>for local part, used in router</secondary>
35668 </indexterm>
35669 If this option is set, the router is skipped unless the local part starts with
35670 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
35671 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
35672 evaluated.
35673 </para>
35674 <para>
35675 The list is scanned from left to right, and the first prefix that matches is
35676 used. A limited form of wildcard is available; if the prefix begins with an
35677 asterisk, it matches the longest possible sequence of arbitrary characters at
35678 the start of the local part. An asterisk should therefore always be followed by
35679 some character that does not occur in normal local parts.
35680 <indexterm role="concept">
35681 <primary>multiple mailboxes</primary>
35682 </indexterm>
35683 <indexterm role="concept">
35684 <primary>mailbox</primary>
35685 <secondary>multiple</secondary>
35686 </indexterm>
35687 Wildcarding can be used to set up multiple user mailboxes, as described in
35688 section <xref linkend="SECTmulbox"/>.
35689 </para>
35690 <para>
35691 <indexterm role="variable">
35692 <primary><varname>$local_part</varname></primary>
35693 </indexterm>
35694 <indexterm role="variable">
35695 <primary><varname>$local_part_prefix</varname></primary>
35696 </indexterm>
35697 During the testing of the <option>local_parts</option> option, and while the router is
35698 running, the prefix is removed from the local part, and is available in the
35699 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
35700 the router accepts the address, this remains true during subsequent delivery by
35701 a transport. In particular, the local part that is transmitted in the RCPT
35702 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
35703 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
35704 the relevant transport.
35705 </para>
35706 <para revisionflag="changed">
35707 <indexterm role="variable">
35708 <primary><varname>$local_part_prefix_v</varname></primary>
35709 </indexterm>
35710 If wildcarding (above) was used then the part of the prefix matching the
35711 wildcard is available in <varname>$local_part_prefix_v</varname>.
35712 </para>
35713 <para>
35714 When an address is being verified, <option>local_part_prefix</option> affects only the
35715 behaviour of the router. If the callout feature of verification is in use, this
35716 means that the full address, including the prefix, will be used during the
35717 callout.
35718 </para>
35719 <para>
35720 The prefix facility is commonly used to handle local parts of the form
35721 <option>owner-something</option>. Another common use is to support local parts of the form
35722 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
35723 to tell a user their forwarding is broken &ndash; by placing a router like this one
35724 immediately before the router that handles <filename>.forward</filename> files:
35725 </para>
35726 <literallayout class="monospaced">
35727 real_localuser:
35728   driver = accept
35729   local_part_prefix = real-
35730   check_local_user
35731   transport = local_delivery
35732 </literallayout>
35733 <para>
35734 For security, it would probably be a good idea to restrict the use of this
35735 router to locally-generated messages, using a condition such as this:
35736 </para>
35737 <literallayout class="monospaced">
35738   condition = ${if match {$sender_host_address}\
35739                          {\N^(|127\.0\.0\.1)$\N}}
35740 </literallayout>
35741 <para>
35742 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
35743 both conditions must be met if not optional. Care must be taken if wildcards
35744 are used in both a prefix and a suffix on the same router. Different
35745 separator characters must be used to avoid ambiguity.
35746 </para>
35747 <para>
35748 <indexterm role="option">
35749 <primary><option>local_part_prefix_optional</option></primary>
35750 </indexterm>
35751 </para>
35752 <informaltable frame="all">
35753 <tgroup cols="4" colsep="0" rowsep="0">
35754 <colspec colwidth="8*" align="left"/>
35755 <colspec colwidth="6*" align="center"/>
35756 <colspec colwidth="6*" align="center"/>
35757 <colspec colwidth="6*" align="right"/>
35758 <tbody>
35759 <row>
35760 <entry><option>local_part_prefix_optional</option></entry>
35761 <entry>Use: <emphasis>routers</emphasis></entry>
35762 <entry>Type: <emphasis>boolean</emphasis></entry>
35763 <entry>Default: <emphasis>false</emphasis></entry>
35764 </row>
35765 </tbody>
35766 </tgroup>
35767 </informaltable>
35768 <para>
35769 See <option>local_part_prefix</option> above.
35770 </para>
35771 <para>
35772 <indexterm role="option">
35773 <primary><option>local_part_suffix</option></primary>
35774 </indexterm>
35775 </para>
35776 <informaltable frame="all">
35777 <tgroup cols="4" colsep="0" rowsep="0">
35778 <colspec colwidth="8*" align="left"/>
35779 <colspec colwidth="6*" align="center"/>
35780 <colspec colwidth="6*" align="center"/>
35781 <colspec colwidth="6*" align="right"/>
35782 <tbody>
35783 <row>
35784 <entry><option>local_part_suffix</option></entry>
35785 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35786 <entry>Type: <emphasis>string list</emphasis></entry>
35787 <entry>Default: <emphasis>unset</emphasis></entry>
35788 </row>
35789 </tbody>
35790 </tgroup>
35791 </informaltable>
35792 <para>
35793 <indexterm role="concept">
35794 <primary>router</primary>
35795 <secondary>suffix for local part</secondary>
35796 </indexterm>
35797 <indexterm role="concept">
35798 <primary>suffix for local part</primary>
35799 <secondary>used in router</secondary>
35800 </indexterm>
35801 This option operates in the same way as <option>local_part_prefix</option>, except that the
35802 local part must end (rather than start) with the given string, the
35803 <option>local_part_suffix_optional</option> option determines whether the suffix is
35804 mandatory, and the wildcard * character, if present, must be the last
35805 character of the suffix. This option facility is commonly used to handle local
35806 parts of the form <option>something-request</option> and multiple user mailboxes of the form
35807 <option>username-foo</option>.
35808 </para>
35809 <para>
35810 <indexterm role="option">
35811 <primary><option>local_part_suffix_optional</option></primary>
35812 </indexterm>
35813 </para>
35814 <informaltable frame="all">
35815 <tgroup cols="4" colsep="0" rowsep="0">
35816 <colspec colwidth="8*" align="left"/>
35817 <colspec colwidth="6*" align="center"/>
35818 <colspec colwidth="6*" align="center"/>
35819 <colspec colwidth="6*" align="right"/>
35820 <tbody>
35821 <row>
35822 <entry><option>local_part_suffix_optional</option></entry>
35823 <entry>Use: <emphasis>routers</emphasis></entry>
35824 <entry>Type: <emphasis>boolean</emphasis></entry>
35825 <entry>Default: <emphasis>false</emphasis></entry>
35826 </row>
35827 </tbody>
35828 </tgroup>
35829 </informaltable>
35830 <para>
35831 See <option>local_part_suffix</option> above.
35832 </para>
35833 <para>
35834 <indexterm role="option">
35835 <primary><option>local_parts</option></primary>
35836 </indexterm>
35837 </para>
35838 <informaltable frame="all">
35839 <tgroup cols="4" colsep="0" rowsep="0">
35840 <colspec colwidth="8*" align="left"/>
35841 <colspec colwidth="6*" align="center"/>
35842 <colspec colwidth="6*" align="center"/>
35843 <colspec colwidth="6*" align="right"/>
35844 <tbody>
35845 <row>
35846 <entry><option>local_parts</option></entry>
35847 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35848 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
35849 <entry>Default: <emphasis>unset</emphasis></entry>
35850 </row>
35851 </tbody>
35852 </tgroup>
35853 </informaltable>
35854 <para>
35855 <indexterm role="concept">
35856 <primary>router</primary>
35857 <secondary>restricting to specific local parts</secondary>
35858 </indexterm>
35859 <indexterm role="concept">
35860 <primary>local part</primary>
35861 <secondary>checking in router</secondary>
35862 </indexterm>
35863 The router is run only if the local part of the address matches the list.
35864 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35865 are evaluated, and
35866 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
35867 string is expanded, it is possible to make it depend on the domain, for
35868 example:
35869 </para>
35870 <literallayout class="monospaced">
35871 local_parts = dbm;/usr/local/specials/$domain
35872 </literallayout>
35873 <para>
35874 <indexterm role="variable">
35875 <primary><varname>$local_part_data</varname></primary>
35876 </indexterm>
35877 If the match is achieved by a lookup, the data that the lookup returned
35878 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
35879 expansions of the router&#x2019;s private options. You might use this option, for
35880 example, if you have a large number of local virtual domains, and you want to
35881 send all postmaster mail to the same place without having to set up an alias in
35882 each virtual domain:
35883 </para>
35884 <literallayout class="monospaced">
35885 postmaster:
35886   driver = redirect
35887   local_parts = postmaster
35888   data = postmaster@real.domain.example
35889 </literallayout>
35890 <para>
35891 <indexterm role="option">
35892 <primary><option>log_as_local</option></primary>
35893 </indexterm>
35894 </para>
35895 <informaltable frame="all">
35896 <tgroup cols="4" colsep="0" rowsep="0">
35897 <colspec colwidth="8*" align="left"/>
35898 <colspec colwidth="6*" align="center"/>
35899 <colspec colwidth="6*" align="center"/>
35900 <colspec colwidth="6*" align="right"/>
35901 <tbody>
35902 <row>
35903 <entry><option>log_as_local</option></entry>
35904 <entry>Use: <emphasis>routers</emphasis></entry>
35905 <entry>Type: <emphasis>boolean</emphasis></entry>
35906 <entry>Default: <emphasis>see below</emphasis></entry>
35907 </row>
35908 </tbody>
35909 </tgroup>
35910 </informaltable>
35911 <para>
35912 <indexterm role="concept">
35913 <primary>log</primary>
35914 <secondary>delivery line</secondary>
35915 </indexterm>
35916 <indexterm role="concept">
35917 <primary>delivery</primary>
35918 <secondary>log line format</secondary>
35919 </indexterm>
35920 Exim has two logging styles for delivery, the idea being to make local
35921 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
35922 recipient address is given just as the local part, without a domain. The use of
35923 this style is controlled by this option. It defaults to true for the <command>accept</command>
35924 router, and false for all the others. This option applies only when a
35925 router assigns an address to a transport. It has no effect on routers that
35926 redirect addresses.
35927 </para>
35928 <para>
35929 <indexterm role="option">
35930 <primary><option>more</option></primary>
35931 </indexterm>
35932 </para>
35933 <informaltable frame="all">
35934 <tgroup cols="4" colsep="0" rowsep="0">
35935 <colspec colwidth="8*" align="left"/>
35936 <colspec colwidth="6*" align="center"/>
35937 <colspec colwidth="6*" align="center"/>
35938 <colspec colwidth="6*" align="right"/>
35939 <tbody>
35940 <row>
35941 <entry><option>more</option></entry>
35942 <entry>Use: <emphasis>routers</emphasis></entry>
35943 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
35944 <entry>Default: <emphasis>true</emphasis></entry>
35945 </row>
35946 </tbody>
35947 </tgroup>
35948 </informaltable>
35949 <para>
35950 The result of string expansion for this option must be a valid boolean value,
35951 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
35952 result causes an error, and delivery is deferred. If the expansion is forced to
35953 fail, the default value for the option (true) is used. Other failures cause
35954 delivery to be deferred.
35955 </para>
35956 <para>
35957 If this option is set false, and the router declines to handle the address, no
35958 further routers are tried, routing fails, and the address is bounced.
35959 <indexterm role="option">
35960 <primary><option>self</option></primary>
35961 </indexterm>
35962 However, if the router explicitly passes an address to the following router by
35963 means of the setting
35964 </para>
35965 <literallayout class="monospaced">
35966 self = pass
35967 </literallayout>
35968 <para>
35969 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
35970 does not affect the behaviour if one of the precondition tests fails. In that
35971 case, the address is always passed to the next router.
35972 </para>
35973 <para>
35974 Note that <option>address_data</option> is not considered to be a precondition. If its
35975 expansion is forced to fail, the router declines, and the value of <option>more</option>
35976 controls what happens next.
35977 </para>
35978 <para>
35979 <indexterm role="option">
35980 <primary><option>pass_on_timeout</option></primary>
35981 </indexterm>
35982 </para>
35983 <informaltable frame="all">
35984 <tgroup cols="4" colsep="0" rowsep="0">
35985 <colspec colwidth="8*" align="left"/>
35986 <colspec colwidth="6*" align="center"/>
35987 <colspec colwidth="6*" align="center"/>
35988 <colspec colwidth="6*" align="right"/>
35989 <tbody>
35990 <row>
35991 <entry><option>pass_on_timeout</option></entry>
35992 <entry>Use: <emphasis>routers</emphasis></entry>
35993 <entry>Type: <emphasis>boolean</emphasis></entry>
35994 <entry>Default: <emphasis>false</emphasis></entry>
35995 </row>
35996 </tbody>
35997 </tgroup>
35998 </informaltable>
35999 <para>
36000 <indexterm role="concept">
36001 <primary>timeout</primary>
36002 <secondary>of router</secondary>
36003 </indexterm>
36004 <indexterm role="concept">
36005 <primary>router</primary>
36006 <secondary>timeout</secondary>
36007 </indexterm>
36008 If a router times out during a host lookup, it normally causes deferral of the
36009 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
36010 router, overriding <option>no_more</option>. This may be helpful for systems that are
36011 intermittently connected to the Internet, or those that want to pass to a smart
36012 host any messages that cannot immediately be delivered.
36013 </para>
36014 <para>
36015 There are occasional other temporary errors that can occur while doing DNS
36016 lookups. They are treated in the same way as a timeout, and this option
36017 applies to all of them.
36018 </para>
36019 <para>
36020 <indexterm role="option">
36021 <primary><option>pass_router</option></primary>
36022 </indexterm>
36023 </para>
36024 <informaltable frame="all">
36025 <tgroup cols="4" colsep="0" rowsep="0">
36026 <colspec colwidth="8*" align="left"/>
36027 <colspec colwidth="6*" align="center"/>
36028 <colspec colwidth="6*" align="center"/>
36029 <colspec colwidth="6*" align="right"/>
36030 <tbody>
36031 <row>
36032 <entry><option>pass_router</option></entry>
36033 <entry>Use: <emphasis>routers</emphasis></entry>
36034 <entry>Type: <emphasis>string</emphasis></entry>
36035 <entry>Default: <emphasis>unset</emphasis></entry>
36036 </row>
36037 </tbody>
36038 </tgroup>
36039 </informaltable>
36040 <para>
36041 <indexterm role="concept">
36042 <primary>router</primary>
36043 <secondary>go to after <quote>pass</quote></secondary>
36044 </indexterm>
36045 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
36046 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
36047 routing to continue, and overriding a false setting of <option>more</option>. When one of
36048 these routers returns <quote>pass</quote>, the address is normally handed on to the next
36049 router in sequence. This can be changed by setting <option>pass_router</option> to the name
36050 of another router. However (unlike <option>redirect_router</option>) the named router must
36051 be below the current router, to avoid loops. Note that this option applies only
36052 to the special case of <quote>pass</quote>. It does not apply when a router returns
36053 <quote>decline</quote> because it cannot handle an address.
36054 </para>
36055 <para>
36056 <indexterm role="option">
36057 <primary><option>redirect_router</option></primary>
36058 </indexterm>
36059 </para>
36060 <informaltable frame="all">
36061 <tgroup cols="4" colsep="0" rowsep="0">
36062 <colspec colwidth="8*" align="left"/>
36063 <colspec colwidth="6*" align="center"/>
36064 <colspec colwidth="6*" align="center"/>
36065 <colspec colwidth="6*" align="right"/>
36066 <tbody>
36067 <row>
36068 <entry><option>redirect_router</option></entry>
36069 <entry>Use: <emphasis>routers</emphasis></entry>
36070 <entry>Type: <emphasis>string</emphasis></entry>
36071 <entry>Default: <emphasis>unset</emphasis></entry>
36072 </row>
36073 </tbody>
36074 </tgroup>
36075 </informaltable>
36076 <para>
36077 <indexterm role="concept">
36078 <primary>router</primary>
36079 <secondary>start at after redirection</secondary>
36080 </indexterm>
36081 Sometimes an administrator knows that it is pointless to reprocess addresses
36082 generated from alias or forward files with the same router again. For
36083 example, if an alias file translates real names into login ids there is no
36084 point searching the alias file a second time, especially if it is a large file.
36085 </para>
36086 <para>
36087 The <option>redirect_router</option> option can be set to the name of any router instance.
36088 It causes the routing of any generated addresses to start at the named router
36089 instead of at the first router. This option has no effect if the router in
36090 which it is set does not generate new addresses.
36091 </para>
36092 <para>
36093 <indexterm role="option">
36094 <primary><option>require_files</option></primary>
36095 </indexterm>
36096 </para>
36097 <informaltable frame="all">
36098 <tgroup cols="4" colsep="0" rowsep="0">
36099 <colspec colwidth="8*" align="left"/>
36100 <colspec colwidth="6*" align="center"/>
36101 <colspec colwidth="6*" align="center"/>
36102 <colspec colwidth="6*" align="right"/>
36103 <tbody>
36104 <row>
36105 <entry><option>require_files</option></entry>
36106 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36107 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
36108 <entry>Default: <emphasis>unset</emphasis></entry>
36109 </row>
36110 </tbody>
36111 </tgroup>
36112 </informaltable>
36113 <para>
36114 <indexterm role="concept">
36115 <primary>file</primary>
36116 <secondary>requiring for router</secondary>
36117 </indexterm>
36118 <indexterm role="concept">
36119 <primary>router</primary>
36120 <secondary>requiring file existence</secondary>
36121 </indexterm>
36122 This option provides a general mechanism for predicating the running of a
36123 router on the existence or non-existence of certain files or directories.
36124 Before running a router, as one of its precondition tests, Exim works its way
36125 through the <option>require_files</option> list, expanding each item separately.
36126 </para>
36127 <para>
36128 Because the list is split before expansion, any colons in expansion items must
36129 be doubled, or the facility for using a different list separator must be used
36130 (<xref linkend="SECTlistsepchange"/>).
36131 If any expansion is forced to fail, the item is ignored. Other expansion
36132 failures cause routing of the address to be deferred.
36133 </para>
36134 <para>
36135 If any expanded string is empty, it is ignored. Otherwise, except as described
36136 below, each string must be a fully qualified file path, optionally preceded by
36137 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
36138 existence of the files or directories. The router is skipped if any paths not
36139 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
36140 </para>
36141 <para>
36142 <indexterm role="concept">
36143 <primary>NFS</primary>
36144 </indexterm>
36145 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
36146 the message is deferred. This can happen when NFS-mounted filesystems are
36147 unavailable.
36148 </para>
36149 <para>
36150 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
36151 options, so you cannot use it to check for the existence of a file in which to
36152 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
36153 full list of the order in which preconditions are evaluated.) However, as
36154 these options are all expanded, you can use the <option>exists</option> expansion condition
36155 to make such tests. The <option>require_files</option> option is intended for checking files
36156 that the router may be going to use internally, or which are needed by a
36157 transport (e.g., <filename>.procmailrc</filename>).
36158 </para>
36159 <para>
36160 During delivery, the <function>stat()</function> function is run as root, but there is a
36161 facility for some checking of the accessibility of a file by another user.
36162 This is not a proper permissions check, but just a <quote>rough</quote> check that
36163 operates as follows:
36164 </para>
36165 <para>
36166 If an item in a <option>require_files</option> list does not contain any forward slash
36167 characters, it is taken to be the user (and optional group, separated by a
36168 comma) to be checked for subsequent files in the list. If no group is specified
36169 but the user is specified symbolically, the gid associated with the uid is
36170 used. For example:
36171 </para>
36172 <literallayout class="monospaced">
36173 require_files = mail:/some/file
36174 require_files = $local_part_data:$home/.procmailrc
36175 </literallayout>
36176 <para>
36177 If a user or group name in a <option>require_files</option> list does not exist, the
36178 <option>require_files</option> condition fails.
36179 </para>
36180 <para>
36181 Exim performs the check by scanning along the components of the file path, and
36182 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
36183 directories, and <quote>r</quote> access on the final file. Note that this means that file
36184 access control lists, if the operating system has them, are ignored.
36185 </para>
36186 <para>
36187 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
36188 incoming SMTP message, Exim is not running as root, but under its own uid. This
36189 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
36190 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
36191 user is not permitted to read one of the directories on the file&#x2019;s path.
36192 </para>
36193 <para>
36194 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
36195 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
36196 without root access. In this case, if a check for access by a particular user
36197 is requested, Exim creates a subprocess that runs as that user, and tries the
36198 check again in that process.
36199 </para>
36200 <para>
36201 The default action for handling an unresolved EACCES is to consider it to
36202 be caused by a configuration error, and routing is deferred because the
36203 existence or non-existence of the file cannot be determined. However, in some
36204 circumstances it may be desirable to treat this condition as if the file did
36205 not exist. If the filename (or the exclamation mark that precedes the filename
36206 for non-existence) is preceded by a plus sign, the EACCES error is treated
36207 as if the file did not exist. For example:
36208 </para>
36209 <literallayout class="monospaced">
36210 require_files = +/some/file
36211 </literallayout>
36212 <para>
36213 If the router is not an essential part of verification (for example, it
36214 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
36215 option false so that the router is skipped when verifying.
36216 </para>
36217 <para>
36218 <indexterm role="option">
36219 <primary><option>retry_use_local_part</option></primary>
36220 </indexterm>
36221 </para>
36222 <informaltable frame="all">
36223 <tgroup cols="4" colsep="0" rowsep="0">
36224 <colspec colwidth="8*" align="left"/>
36225 <colspec colwidth="6*" align="center"/>
36226 <colspec colwidth="6*" align="center"/>
36227 <colspec colwidth="6*" align="right"/>
36228 <tbody>
36229 <row>
36230 <entry><option>retry_use_local_part</option></entry>
36231 <entry>Use: <emphasis>routers</emphasis></entry>
36232 <entry>Type: <emphasis>boolean</emphasis></entry>
36233 <entry>Default: <emphasis>see below</emphasis></entry>
36234 </row>
36235 </tbody>
36236 </tgroup>
36237 </informaltable>
36238 <para>
36239 <indexterm role="concept">
36240 <primary>hints database</primary>
36241 <secondary>retry keys</secondary>
36242 </indexterm>
36243 <indexterm role="concept">
36244 <primary>local part</primary>
36245 <secondary>in retry keys</secondary>
36246 </indexterm>
36247 When a delivery suffers a temporary routing failure, a retry record is created
36248 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
36249 domain, the key for the retry record should not involve the local part, but for
36250 other addresses, both the domain and the local part should be included.
36251 Usually, remote routing is of the former kind, and local routing is of the
36252 latter kind.
36253 </para>
36254 <para>
36255 This option controls whether the local part is used to form the key for retry
36256 hints for addresses that suffer temporary errors while being handled by this
36257 router. The default value is true for any router that has any of
36258 <option>check_local_user</option>,
36259 <option>local_parts</option>,
36260 <option>condition</option>,
36261 <option>local_part_prefix</option>,
36262 <option>local_part_suffix</option>,
36263 <option>senders</option> or
36264 <option>require_files</option>
36265 set, and false otherwise. Note that this option does not apply to hints keys
36266 for transport delays; they are controlled by a generic transport option of the
36267 same name.
36268 </para>
36269 <para>
36270 Failing to set this option when it is needed
36271 (because a remote router handles only some of the local-parts for a domain)
36272 can result in incorrect error messages being generated.
36273 </para>
36274 <para>
36275 The setting of <option>retry_use_local_part</option> applies only to the router on which it
36276 appears. If the router generates child addresses, they are routed
36277 independently; this setting does not become attached to them.
36278 </para>
36279 <para>
36280 <indexterm role="option">
36281 <primary><option>router_home_directory</option></primary>
36282 </indexterm>
36283 </para>
36284 <informaltable frame="all">
36285 <tgroup cols="4" colsep="0" rowsep="0">
36286 <colspec colwidth="8*" align="left"/>
36287 <colspec colwidth="6*" align="center"/>
36288 <colspec colwidth="6*" align="center"/>
36289 <colspec colwidth="6*" align="right"/>
36290 <tbody>
36291 <row>
36292 <entry><option>router_home_directory</option></entry>
36293 <entry>Use: <emphasis>routers</emphasis></entry>
36294 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36295 <entry>Default: <emphasis>unset</emphasis></entry>
36296 </row>
36297 </tbody>
36298 </tgroup>
36299 </informaltable>
36300 <para>
36301 <indexterm role="concept">
36302 <primary>router</primary>
36303 <secondary>home directory for</secondary>
36304 </indexterm>
36305 <indexterm role="concept">
36306 <primary>home directory</primary>
36307 <secondary>for router</secondary>
36308 </indexterm>
36309 <indexterm role="variable">
36310 <primary><varname>$home</varname></primary>
36311 </indexterm>
36312 This option sets a home directory for use while the router is running. (Compare
36313 <option>transport_home_directory</option>, which sets a home directory for later
36314 transporting.) In particular, if used on a <command>redirect</command> router, this option
36315 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
36316 forced expansion failure causes the option to be ignored &ndash; other failures
36317 cause the router to defer.
36318 </para>
36319 <para>
36320 Expansion of <option>router_home_directory</option> happens immediately after the
36321 <option>check_local_user</option> test (if configured), before any further expansions take
36322 place.
36323 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36324 are evaluated.)
36325 While the router is running, <option>router_home_directory</option> overrides the value of
36326 <varname>$home</varname> that came from <option>check_local_user</option>.
36327 </para>
36328 <para>
36329 When a router accepts an address and assigns it to a local transport (including
36330 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
36331 delivery), the home directory setting for the transport is taken from the first
36332 of these values that is set:
36333 </para>
36334 <itemizedlist>
36335 <listitem>
36336 <para>
36337 The <option>home_directory</option> option on the transport;
36338 </para>
36339 </listitem>
36340 <listitem>
36341 <para>
36342 The <option>transport_home_directory</option> option on the router;
36343 </para>
36344 </listitem>
36345 <listitem>
36346 <para>
36347 The password data if <option>check_local_user</option> is set on the router;
36348 </para>
36349 </listitem>
36350 <listitem>
36351 <para>
36352 The <option>router_home_directory</option> option on the router.
36353 </para>
36354 </listitem>
36355 </itemizedlist>
36356 <para>
36357 In other words, <option>router_home_directory</option> overrides the password data for the
36358 router, but not for the transport.
36359 </para>
36360 <para>
36361 <indexterm role="option">
36362 <primary><option>self</option></primary>
36363 </indexterm>
36364 </para>
36365 <informaltable frame="all">
36366 <tgroup cols="4" colsep="0" rowsep="0">
36367 <colspec colwidth="8*" align="left"/>
36368 <colspec colwidth="6*" align="center"/>
36369 <colspec colwidth="6*" align="center"/>
36370 <colspec colwidth="6*" align="right"/>
36371 <tbody>
36372 <row>
36373 <entry><option>self</option></entry>
36374 <entry>Use: <emphasis>routers</emphasis></entry>
36375 <entry>Type: <emphasis>string</emphasis></entry>
36376 <entry>Default: <emphasis>freeze</emphasis></entry>
36377 </row>
36378 </tbody>
36379 </tgroup>
36380 </informaltable>
36381 <para>
36382 <indexterm role="concept">
36383 <primary>MX record</primary>
36384 <secondary>pointing to local host</secondary>
36385 </indexterm>
36386 <indexterm role="concept">
36387 <primary>local host</primary>
36388 <secondary>MX pointing to</secondary>
36389 </indexterm>
36390 This option applies to those routers that use a recipient address to find a
36391 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
36392 and <command>manualroute</command> routers.
36393 Certain configurations of the <command>queryprogram</command> router can also specify a list
36394 of remote hosts.
36395 Usually such routers are configured to send the message to a remote host via an
36396 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
36397 host on the list turns out to be the local host.
36398 The way in which Exim checks for the local host is described in section
36399 <xref linkend="SECTreclocipadd"/>.
36400 </para>
36401 <para>
36402 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
36403 example, the router should be configured not to process this domain), or an
36404 error in the DNS (for example, the MX should not point to this host). For this
36405 reason, the default action is to log the incident, defer the address, and
36406 freeze the message. The following alternatives are provided for use in special
36407 cases:
36408 </para>
36409 <variablelist>
36410 <varlistentry>
36411 <term><option>defer</option></term>
36412 <listitem>
36413 <para>
36414 Delivery of the message is tried again later, but the message is not frozen.
36415 </para>
36416 </listitem></varlistentry>
36417 <varlistentry>
36418 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
36419 <listitem>
36420 <para>
36421 The domain is changed to the given domain, and the address is passed back to
36422 be reprocessed by the routers. No rewriting of headers takes place. This
36423 behaviour is essentially a redirection.
36424 </para>
36425 </listitem></varlistentry>
36426 <varlistentry>
36427 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
36428 <listitem>
36429 <para>
36430 The domain is changed to the given domain, and the address is passed back to be
36431 reprocessed by the routers. Any headers that contain the original domain are
36432 rewritten.
36433 </para>
36434 </listitem></varlistentry>
36435 <varlistentry>
36436 <term><option>pass</option></term>
36437 <listitem>
36438 <para>
36439 <indexterm role="option">
36440 <primary><option>more</option></primary>
36441 </indexterm>
36442 <indexterm role="variable">
36443 <primary><varname>$self_hostname</varname></primary>
36444 </indexterm>
36445 The router passes the address to the next router, or to the router named in the
36446 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
36447 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
36448 name of the local host that the router encountered. This can be used to
36449 distinguish between different cases for hosts with multiple names. The
36450 combination
36451 </para>
36452 <literallayout class="monospaced">
36453 self = pass
36454 no_more
36455 </literallayout>
36456 <para>
36457 ensures that only those addresses that routed to the local host are passed on.
36458 Without <option>no_more</option>, addresses that were declined for other reasons would also
36459 be passed to the next router.
36460 </para>
36461 </listitem></varlistentry>
36462 <varlistentry>
36463 <term><option>fail</option></term>
36464 <listitem>
36465 <para>
36466 Delivery fails and an error report is generated.
36467 </para>
36468 </listitem></varlistentry>
36469 <varlistentry>
36470 <term><option>send</option></term>
36471 <listitem>
36472 <para>
36473 <indexterm role="concept">
36474 <primary>local host</primary>
36475 <secondary>sending to</secondary>
36476 </indexterm>
36477 The anomaly is ignored and the address is queued for the transport. This
36478 setting should be used with extreme caution. For an <command>smtp</command> transport, it
36479 makes sense only in cases where the program that is listening on the SMTP port
36480 is not this version of Exim. That is, it must be some other MTA, or Exim with a
36481 different configuration file that handles the domain in another way.
36482 </para>
36483 </listitem></varlistentry>
36484 </variablelist>
36485 <para>
36486 <indexterm role="option">
36487 <primary><option>senders</option></primary>
36488 </indexterm>
36489 </para>
36490 <informaltable frame="all">
36491 <tgroup cols="4" colsep="0" rowsep="0">
36492 <colspec colwidth="8*" align="left"/>
36493 <colspec colwidth="6*" align="center"/>
36494 <colspec colwidth="6*" align="center"/>
36495 <colspec colwidth="6*" align="right"/>
36496 <tbody>
36497 <row>
36498 <entry><option>senders</option></entry>
36499 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36500 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
36501 <entry>Default: <emphasis>unset</emphasis></entry>
36502 </row>
36503 </tbody>
36504 </tgroup>
36505 </informaltable>
36506 <para>
36507 <indexterm role="concept">
36508 <primary>router</primary>
36509 <secondary>checking senders</secondary>
36510 </indexterm>
36511 If this option is set, the router is skipped unless the message&#x2019;s sender
36512 address matches something on the list.
36513 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36514 are evaluated.
36515 </para>
36516 <para>
36517 There are issues concerning verification when the running of routers is
36518 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
36519 setting, it sets the sender to the null string. When using the <option>-bt</option> option
36520 to check a configuration file, it is necessary also to use the <option>-f</option> option to
36521 set an appropriate sender. For incoming mail, the sender is unset when
36522 verifying the sender, but is available when verifying any recipients. If the
36523 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
36524 matters.
36525 </para>
36526 <para>
36527 <indexterm role="option">
36528 <primary><option>set</option></primary>
36529 </indexterm>
36530 </para>
36531 <informaltable frame="all">
36532 <tgroup cols="4" colsep="0" rowsep="0">
36533 <colspec colwidth="8*" align="left"/>
36534 <colspec colwidth="6*" align="center"/>
36535 <colspec colwidth="6*" align="center"/>
36536 <colspec colwidth="6*" align="right"/>
36537 <tbody>
36538 <row>
36539 <entry><option>set</option></entry>
36540 <entry>Use: <emphasis>routers</emphasis></entry>
36541 <entry>Type: <emphasis>string list</emphasis></entry>
36542 <entry>Default: <emphasis>unset</emphasis></entry>
36543 </row>
36544 </tbody>
36545 </tgroup>
36546 </informaltable>
36547 <para>
36548 <indexterm role="concept">
36549 <primary>router</primary>
36550 <secondary>variables</secondary>
36551 </indexterm>
36552 This option may be used multiple times on a router;
36553 because of this the list aspect is mostly irrelevant.
36554 The list separator is a semicolon but can be changed in the
36555 usual way.
36556 </para>
36557 <para>
36558 Each list-element given must be of the form <quote>name = value</quote>
36559 and the names used must start with the string <quote>r_</quote>.
36560 Values containing a list-separator should have them doubled.
36561 When a router runs, the strings are evaluated in order,
36562 to create variables which are added to the set associated with
36563 the address.
36564 The variable is set with the expansion of the value.
36565 The variables can be used by the router options
36566 (not including any preconditions)
36567 and by the transport.
36568 Later definitions of a given named variable will override former ones.
36569 Variable use is via the usual <varname>$r_...</varname> syntax.
36570 </para>
36571 <para>
36572 This is similar to the <option>address_data</option> option, except that
36573 many independent variables can be used, with choice of naming.
36574 </para>
36575 <para>
36576 <indexterm role="option">
36577 <primary><option>translate_ip_address</option></primary>
36578 </indexterm>
36579 </para>
36580 <informaltable frame="all">
36581 <tgroup cols="4" colsep="0" rowsep="0">
36582 <colspec colwidth="8*" align="left"/>
36583 <colspec colwidth="6*" align="center"/>
36584 <colspec colwidth="6*" align="center"/>
36585 <colspec colwidth="6*" align="right"/>
36586 <tbody>
36587 <row>
36588 <entry><option>translate_ip_address</option></entry>
36589 <entry>Use: <emphasis>routers</emphasis></entry>
36590 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36591 <entry>Default: <emphasis>unset</emphasis></entry>
36592 </row>
36593 </tbody>
36594 </tgroup>
36595 </informaltable>
36596 <para>
36597 <indexterm role="concept">
36598 <primary>IP address</primary>
36599 <secondary>translating</secondary>
36600 </indexterm>
36601 <indexterm role="concept">
36602 <primary>packet radio</primary>
36603 </indexterm>
36604 <indexterm role="concept">
36605 <primary>router</primary>
36606 <secondary>IP address translation</secondary>
36607 </indexterm>
36608 There exist some rare networking situations (for example, packet radio) where
36609 it is helpful to be able to translate IP addresses generated by normal routing
36610 mechanisms into other IP addresses, thus performing a kind of manual IP
36611 routing. This should be done only if the normal IP routing of the TCP/IP stack
36612 is inadequate or broken. Because this is an extremely uncommon requirement, the
36613 code to support this option is not included in the Exim binary unless
36614 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
36615 </para>
36616 <para>
36617 <indexterm role="variable">
36618 <primary><varname>$host_address</varname></primary>
36619 </indexterm>
36620 The <option>translate_ip_address</option> string is expanded for every IP address generated
36621 by the router, with the generated address set in <varname>$host_address</varname>. If the
36622 expansion is forced to fail, no action is taken.
36623 For any other expansion error, delivery of the message is deferred.
36624 If the result of the expansion is an IP address, that replaces the original
36625 address; otherwise the result is assumed to be a host name &ndash; this is looked
36626 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
36627 produce one or more replacement IP addresses. For example, to subvert all IP
36628 addresses in some specific networks, this could be added to a router:
36629 </para>
36630 <literallayout class="monospaced">
36631 translate_ip_address = \
36632   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
36633     {$value}fail}}
36634 </literallayout>
36635 <para>
36636 The file would contain lines like
36637 </para>
36638 <literallayout class="monospaced">
36639 10.2.3.128/26    some.host
36640 10.8.4.34/26     10.44.8.15
36641 </literallayout>
36642 <para>
36643 You should not make use of this facility unless you really understand what you
36644 are doing.
36645 </para>
36646 <para>
36647 <indexterm role="option">
36648 <primary><option>transport</option></primary>
36649 </indexterm>
36650 </para>
36651 <informaltable frame="all">
36652 <tgroup cols="4" colsep="0" rowsep="0">
36653 <colspec colwidth="8*" align="left"/>
36654 <colspec colwidth="6*" align="center"/>
36655 <colspec colwidth="6*" align="center"/>
36656 <colspec colwidth="6*" align="right"/>
36657 <tbody>
36658 <row>
36659 <entry><option>transport</option></entry>
36660 <entry>Use: <emphasis>routers</emphasis></entry>
36661 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36662 <entry>Default: <emphasis>unset</emphasis></entry>
36663 </row>
36664 </tbody>
36665 </tgroup>
36666 </informaltable>
36667 <para>
36668 This option specifies the transport to be used when a router accepts an address
36669 and sets it up for delivery. A transport is never needed if a router is used
36670 only for verification. The value of the option is expanded at routing time,
36671 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
36672 and result must be the name of one of the configured transports. If it is not,
36673 delivery is deferred.
36674 </para>
36675 <para>
36676 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
36677 have some private options that set up transports for pipe and file deliveries
36678 (see chapter <xref linkend="CHAPredirect"/>).
36679 </para>
36680 <para>
36681 <indexterm role="option">
36682 <primary><option>transport_current_directory</option></primary>
36683 </indexterm>
36684 </para>
36685 <informaltable frame="all">
36686 <tgroup cols="4" colsep="0" rowsep="0">
36687 <colspec colwidth="8*" align="left"/>
36688 <colspec colwidth="6*" align="center"/>
36689 <colspec colwidth="6*" align="center"/>
36690 <colspec colwidth="6*" align="right"/>
36691 <tbody>
36692 <row>
36693 <entry><option>transport_current_directory</option></entry>
36694 <entry>Use: <emphasis>routers</emphasis></entry>
36695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36696 <entry>Default: <emphasis>unset</emphasis></entry>
36697 </row>
36698 </tbody>
36699 </tgroup>
36700 </informaltable>
36701 <para>
36702 <indexterm role="concept">
36703 <primary>current directory for local transport</primary>
36704 </indexterm>
36705 This option associates a current directory with any address that is routed
36706 to a local transport. This can happen either because a transport is
36707 explicitly configured for the router, or because it generates a delivery to a
36708 file or a pipe. During the delivery process (that is, at transport time), this
36709 option string is expanded and is set as the current directory, unless
36710 overridden by a setting on the transport.
36711 If the expansion fails for any reason, including forced failure, an error is
36712 logged, and delivery is deferred.
36713 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
36714 environment.
36715 </para>
36716 <para>
36717 <indexterm role="option">
36718 <primary><option>transport_home_directory</option></primary>
36719 </indexterm>
36720 </para>
36721 <informaltable frame="all">
36722 <tgroup cols="4" colsep="0" rowsep="0">
36723 <colspec colwidth="8*" align="left"/>
36724 <colspec colwidth="6*" align="center"/>
36725 <colspec colwidth="6*" align="center"/>
36726 <colspec colwidth="6*" align="right"/>
36727 <tbody>
36728 <row>
36729 <entry><option>transport_home_directory</option></entry>
36730 <entry>Use: <emphasis>routers</emphasis></entry>
36731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36732 <entry>Default: <emphasis>see below</emphasis></entry>
36733 </row>
36734 </tbody>
36735 </tgroup>
36736 </informaltable>
36737 <para>
36738 <indexterm role="concept">
36739 <primary>home directory</primary>
36740 <secondary>for local transport</secondary>
36741 </indexterm>
36742 This option associates a home directory with any address that is routed to a
36743 local transport. This can happen either because a transport is explicitly
36744 configured for the router, or because it generates a delivery to a file or a
36745 pipe. During the delivery process (that is, at transport time), the option
36746 string is expanded and is set as the home directory, unless overridden by a
36747 setting of <option>home_directory</option> on the transport.
36748 If the expansion fails for any reason, including forced failure, an error is
36749 logged, and delivery is deferred.
36750 </para>
36751 <para>
36752 If the transport does not specify a home directory, and
36753 <option>transport_home_directory</option> is not set for the router, the home directory for
36754 the transport is taken from the password data if <option>check_local_user</option> is set for
36755 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
36756 is set; if not, no home directory is set for the transport.
36757 </para>
36758 <para>
36759 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
36760 environment.
36761 </para>
36762 <para>
36763 <indexterm role="option">
36764 <primary><option>unseen</option></primary>
36765 </indexterm>
36766 </para>
36767 <informaltable frame="all">
36768 <tgroup cols="4" colsep="0" rowsep="0">
36769 <colspec colwidth="8*" align="left"/>
36770 <colspec colwidth="6*" align="center"/>
36771 <colspec colwidth="6*" align="center"/>
36772 <colspec colwidth="6*" align="right"/>
36773 <tbody>
36774 <row>
36775 <entry><option>unseen</option></entry>
36776 <entry>Use: <emphasis>routers</emphasis></entry>
36777 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
36778 <entry>Default: <emphasis>false</emphasis></entry>
36779 </row>
36780 </tbody>
36781 </tgroup>
36782 </informaltable>
36783 <para>
36784 <indexterm role="concept">
36785 <primary>router</primary>
36786 <secondary>carrying on after success</secondary>
36787 </indexterm>
36788 The result of string expansion for this option must be a valid boolean value,
36789 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
36790 result causes an error, and delivery is deferred. If the expansion is forced to
36791 fail, the default value for the option (false) is used. Other failures cause
36792 delivery to be deferred.
36793 </para>
36794 <para>
36795 When this option is set true, routing does not cease if the router accepts the
36796 address. Instead, a copy of the incoming address is passed to the next router,
36797 overriding a false setting of <option>more</option>. There is little point in setting
36798 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
36799 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
36800 sometimes true and sometimes false).
36801 </para>
36802 <para>
36803 <indexterm role="concept">
36804 <primary>copy of message (<option>unseen</option> option)</primary>
36805 </indexterm>
36806 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
36807 qualifier in filter files. It can be used to cause copies of messages to be
36808 delivered to some other destination, while also carrying out a normal delivery.
36809 In effect, the current address is made into a <quote>parent</quote> that has two children
36810 &ndash; one that is delivered as specified by this router, and a clone that goes on
36811 to be routed further. For this reason, <option>unseen</option> may not be combined with the
36812 <option>one_time</option> option in a <command>redirect</command> router.
36813 </para>
36814 <para>
36815 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
36816 this router or by previous routers affect the <quote>unseen</quote> copy of the message
36817 only. The clone that continues to be processed by further routers starts with
36818 no added headers and none specified for removal. For a <option>redirect</option> router, if
36819 a generated address is the same as the incoming address, this can lead to
36820 duplicate addresses with different header modifications. Exim does not do
36821 duplicate deliveries (except, in certain circumstances, to pipes -- see section
36822 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
36823 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
36824 <option>redirect</option> router may be of help.
36825 </para>
36826 <para>
36827 Unlike the handling of header modifications, any data that was set by the
36828 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
36829 subsequent routers.
36830 </para>
36831 <para>
36832 <indexterm role="option">
36833 <primary><option>user</option></primary>
36834 </indexterm>
36835 </para>
36836 <informaltable frame="all">
36837 <tgroup cols="4" colsep="0" rowsep="0">
36838 <colspec colwidth="8*" align="left"/>
36839 <colspec colwidth="6*" align="center"/>
36840 <colspec colwidth="6*" align="center"/>
36841 <colspec colwidth="6*" align="right"/>
36842 <tbody>
36843 <row>
36844 <entry><option>user</option></entry>
36845 <entry>Use: <emphasis>routers</emphasis></entry>
36846 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36847 <entry>Default: <emphasis>see below</emphasis></entry>
36848 </row>
36849 </tbody>
36850 </tgroup>
36851 </informaltable>
36852 <para>
36853 <indexterm role="concept">
36854 <primary>uid (user id)</primary>
36855 <secondary>local delivery</secondary>
36856 </indexterm>
36857 <indexterm role="concept">
36858 <primary>local transports</primary>
36859 <secondary>uid and gid</secondary>
36860 </indexterm>
36861 <indexterm role="concept">
36862 <primary>transport</primary>
36863 <secondary>local</secondary>
36864 </indexterm>
36865 <indexterm role="concept">
36866 <primary>router</primary>
36867 <secondary>user for filter processing</secondary>
36868 </indexterm>
36869 <indexterm role="concept">
36870 <primary>filter</primary>
36871 <secondary>user for processing</secondary>
36872 </indexterm>
36873 When a router queues an address for a transport, and the transport does not
36874 specify a user, the user given here is used when running the delivery process.
36875 The user may be specified numerically or by name. If expansion fails, the
36876 error is logged and delivery is deferred.
36877 This user is also used by the <command>redirect</command> router when running a filter file.
36878 The default is unset, except when <option>check_local_user</option> is set. In this case,
36879 the default is taken from the password information. If the user is specified as
36880 a name, and <option>group</option> is not set, the group associated with the user is used.
36881 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
36882 <xref linkend="CHAPenvironment"/>.
36883 </para>
36884 <para>
36885 <indexterm role="option">
36886 <primary><option>verify</option></primary>
36887 </indexterm>
36888 </para>
36889 <informaltable frame="all">
36890 <tgroup cols="4" colsep="0" rowsep="0">
36891 <colspec colwidth="8*" align="left"/>
36892 <colspec colwidth="6*" align="center"/>
36893 <colspec colwidth="6*" align="center"/>
36894 <colspec colwidth="6*" align="right"/>
36895 <tbody>
36896 <row>
36897 <entry><option>verify</option></entry>
36898 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36899 <entry>Type: <emphasis>boolean</emphasis></entry>
36900 <entry>Default: <emphasis>true</emphasis></entry>
36901 </row>
36902 </tbody>
36903 </tgroup>
36904 </informaltable>
36905 <para>
36906 Setting this option has the effect of setting <option>verify_sender</option> and
36907 <option>verify_recipient</option> to the same value.
36908 </para>
36909 <para>
36910 <indexterm role="option">
36911 <primary><option>verify_only</option></primary>
36912 </indexterm>
36913 </para>
36914 <informaltable frame="all">
36915 <tgroup cols="4" colsep="0" rowsep="0">
36916 <colspec colwidth="8*" align="left"/>
36917 <colspec colwidth="6*" align="center"/>
36918 <colspec colwidth="6*" align="center"/>
36919 <colspec colwidth="6*" align="right"/>
36920 <tbody>
36921 <row>
36922 <entry><option>verify_only</option></entry>
36923 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36924 <entry>Type: <emphasis>boolean</emphasis></entry>
36925 <entry>Default: <emphasis>false</emphasis></entry>
36926 </row>
36927 </tbody>
36928 </tgroup>
36929 </informaltable>
36930 <para>
36931 <indexterm role="concept">
36932 <primary>EXPN</primary>
36933 <secondary>with <option>verify_only</option></secondary>
36934 </indexterm>
36935 <indexterm role="option">
36936 <primary><option>-bv</option></primary>
36937 </indexterm>
36938 <indexterm role="concept">
36939 <primary>router</primary>
36940 <secondary>used only when verifying</secondary>
36941 </indexterm>
36942 If this option is set, the router is used only when verifying an address,
36943 delivering in cutthrough mode or
36944 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
36945 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
36946 restricted to verifying only senders or recipients by means of
36947 <option>verify_sender</option> and <option>verify_recipient</option>.
36948 </para>
36949 <para>
36950 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
36951 SMTP message, Exim is not running as root, but under its own uid. If the router
36952 accesses any files, you need to make sure that they are accessible to the Exim
36953 user or group.
36954 </para>
36955 <para>
36956 <indexterm role="option">
36957 <primary><option>verify_recipient</option></primary>
36958 </indexterm>
36959 </para>
36960 <informaltable frame="all">
36961 <tgroup cols="4" colsep="0" rowsep="0">
36962 <colspec colwidth="8*" align="left"/>
36963 <colspec colwidth="6*" align="center"/>
36964 <colspec colwidth="6*" align="center"/>
36965 <colspec colwidth="6*" align="right"/>
36966 <tbody>
36967 <row>
36968 <entry><option>verify_recipient</option></entry>
36969 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36970 <entry>Type: <emphasis>boolean</emphasis></entry>
36971 <entry>Default: <emphasis>true</emphasis></entry>
36972 </row>
36973 </tbody>
36974 </tgroup>
36975 </informaltable>
36976 <para>
36977 If this option is false, the router is skipped when verifying recipient
36978 addresses,
36979 delivering in cutthrough mode
36980 or testing recipient verification using <option>-bv</option>.
36981 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36982 are evaluated.
36983 See also the <varname>$verify_mode</varname> variable.
36984 </para>
36985 <para>
36986 <indexterm role="option">
36987 <primary><option>verify_sender</option></primary>
36988 </indexterm>
36989 </para>
36990 <informaltable frame="all">
36991 <tgroup cols="4" colsep="0" rowsep="0">
36992 <colspec colwidth="8*" align="left"/>
36993 <colspec colwidth="6*" align="center"/>
36994 <colspec colwidth="6*" align="center"/>
36995 <colspec colwidth="6*" align="right"/>
36996 <tbody>
36997 <row>
36998 <entry><option>verify_sender</option></entry>
36999 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37000 <entry>Type: <emphasis>boolean</emphasis></entry>
37001 <entry>Default: <emphasis>true</emphasis></entry>
37002 </row>
37003 </tbody>
37004 </tgroup>
37005 </informaltable>
37006 <para>
37007 If this option is false, the router is skipped when verifying sender addresses
37008 or testing sender verification using <option>-bvs</option>.
37009 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37010 are evaluated.
37011 See also the <varname>$verify_mode</varname> variable.
37012 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
37013 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
37014 </para>
37015 </chapter>
37016
37017 <chapter id="CHID4">
37018 <title>The accept router</title>
37019 <para>
37020 <indexterm role="concept">
37021 <primary><command>accept</command> router</primary>
37022 </indexterm>
37023 <indexterm role="concept">
37024 <primary>routers</primary>
37025 <secondary><command>accept</command></secondary>
37026 </indexterm>
37027 The <command>accept</command> router has no private options of its own. Unless it is being
37028 used purely for verification (see <option>verify_only</option>) a transport is required to
37029 be defined by the generic <option>transport</option> option. If the preconditions that are
37030 specified by generic options are met, the router accepts the address and queues
37031 it for the given transport. The most common use of this router is for setting
37032 up deliveries to local mailboxes. For example:
37033 </para>
37034 <literallayout class="monospaced">
37035 localusers:
37036   driver = accept
37037   domains = mydomain.example
37038   check_local_user
37039   transport = local_delivery
37040 </literallayout>
37041 <para>
37042 The <option>domains</option> condition in this example checks the domain of the address, and
37043 <option>check_local_user</option> checks that the local part is the login of a local user.
37044 When both preconditions are met, the <command>accept</command> router runs, and queues the
37045 address for the <command>local_delivery</command> transport.
37046 </para>
37047 </chapter>
37048
37049 <chapter id="CHAPdnslookup">
37050 <title>The dnslookup router</title>
37051 <para>
37052 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
37053 <primary><command>dnslookup</command> router</primary>
37054 </indexterm>
37055 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
37056 <primary>routers</primary>
37057 <secondary><command>dnslookup</command></secondary>
37058 </indexterm>
37059 The <command>dnslookup</command> router looks up the hosts that handle mail for the
37060 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
37061 unless <option>verify_only</option> is set.
37062 </para>
37063 <para>
37064 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
37065 SRV records. If none are found, or if SRV support is not configured,
37066 MX records are looked up. If no MX records exist, address records are sought.
37067 However, <option>mx_domains</option> can be set to disable the direct use of address
37068 records.
37069 </para>
37070 <para>
37071 MX records of equal priority are sorted by Exim into a random order. Exim then
37072 looks for address records for the host names obtained from MX or SRV records.
37073 When a host has more than one IP address, they are sorted into a random order,
37074 except that IPv6 addresses are sorted before IPv4 addresses. If all the
37075 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
37076 generic option, the router declines.
37077 </para>
37078 <para>
37079 Unless they have the highest priority (lowest MX value), MX records that point
37080 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
37081 are discarded, together with any other MX records of equal or lower priority.
37082 </para>
37083 <para>
37084 <indexterm role="concept">
37085 <primary>MX record</primary>
37086 <secondary>pointing to local host</secondary>
37087 </indexterm>
37088 <indexterm role="concept">
37089 <primary>local host</primary>
37090 <secondary>MX pointing to</secondary>
37091 </indexterm>
37092 <indexterm role="option">
37093 <primary><option>self</option></primary>
37094 <secondary>in <command>dnslookup</command> router</secondary>
37095 </indexterm>
37096 If the host pointed to by the highest priority MX record, or looked up as an
37097 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
37098 happens is controlled by the generic <option>self</option> option.
37099 </para>
37100 <section id="SECTprowitdnsloo">
37101 <title>Problems with DNS lookups</title>
37102 <para>
37103 There have been problems with DNS servers when SRV records are looked up.
37104 Some misbehaving servers return a DNS error or timeout when a non-existent
37105 SRV record is sought. Similar problems have in the past been reported for
37106 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
37107 problem, but it is heavy-handed because it is a global option.
37108 </para>
37109 <para>
37110 For this reason, there are two options, <option>srv_fail_domains</option> and
37111 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
37112 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
37113 an attempt to look up an SRV or MX record causes one of these results, and the
37114 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
37115 such record</quote>. In the case of an SRV lookup, this means that the router
37116 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
37117 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
37118 case routing fails.
37119 </para>
37120 </section>
37121 <section id="SECTdnslookupdecline">
37122 <title>Declining addresses by dnslookup</title>
37123 <para>
37124 <indexterm role="concept">
37125 <primary><command>dnslookup</command> router</primary>
37126 <secondary>declines</secondary>
37127 </indexterm>
37128 There are a few cases where a <command>dnslookup</command> router will decline to accept
37129 an address; if such a router is expected to handle "all remaining non-local
37130 domains", then it is important to set <option>no_more</option>.
37131 </para>
37132 <para>
37133 The router will defer rather than decline if the domain
37134 is found in the <option>fail_defer_domains</option> router option.
37135 </para>
37136 <para>
37137 Reasons for a <command>dnslookup</command> router to decline currently include:
37138 </para>
37139 <itemizedlist>
37140 <listitem>
37141 <para>
37142 The domain does not exist in DNS
37143 </para>
37144 </listitem>
37145 <listitem>
37146 <para>
37147 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
37148 convention (borrowed from SRV) used to indicate that there is no such service
37149 for this domain and to not fall back to trying A/AAAA records.
37150 </para>
37151 </listitem>
37152 <listitem>
37153 <para>
37154 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
37155 </para>
37156 </listitem>
37157 <listitem>
37158 <para>
37159 MX record points to a non-existent host.
37160 </para>
37161 </listitem>
37162 <listitem>
37163 <para>
37164 MX record points to an IP address and the main section option
37165 <option>allow_mx_to_ip</option> is not set.
37166 </para>
37167 </listitem>
37168 <listitem>
37169 <para>
37170 MX records exist and point to valid hosts, but all hosts resolve only to
37171 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
37172 </para>
37173 </listitem>
37174 <listitem>
37175 <para>
37176 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
37177 <option>dns_check_names_pattern</option> for handling one variant of this)
37178 </para>
37179 </listitem>
37180 <listitem>
37181 <para>
37182 <option>check_secondary_mx</option> is set on this router but the local host can
37183 not be found in the MX records (see below)
37184 </para>
37185 </listitem>
37186 </itemizedlist>
37187 </section>
37188 <section id="SECID118">
37189 <title>Private options for dnslookup</title>
37190 <para>
37191 <indexterm role="concept">
37192 <primary>options</primary>
37193 <secondary><command>dnslookup</command> router</secondary>
37194 </indexterm>
37195 The private options for the <command>dnslookup</command> router are as follows:
37196 </para>
37197 <para>
37198 <indexterm role="option">
37199 <primary><option>check_secondary_mx</option></primary>
37200 </indexterm>
37201 </para>
37202 <informaltable frame="all">
37203 <tgroup cols="4" colsep="0" rowsep="0">
37204 <colspec colwidth="8*" align="left"/>
37205 <colspec colwidth="6*" align="center"/>
37206 <colspec colwidth="6*" align="center"/>
37207 <colspec colwidth="6*" align="right"/>
37208 <tbody>
37209 <row>
37210 <entry><option>check_secondary_mx</option></entry>
37211 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37212 <entry>Type: <emphasis>boolean</emphasis></entry>
37213 <entry>Default: <emphasis>false</emphasis></entry>
37214 </row>
37215 </tbody>
37216 </tgroup>
37217 </informaltable>
37218 <para>
37219 <indexterm role="concept">
37220 <primary>MX record</primary>
37221 <secondary>checking for secondary</secondary>
37222 </indexterm>
37223 If this option is set, the router declines unless the local host is found in
37224 (and removed from) the list of hosts obtained by MX lookup. This can be used to
37225 process domains for which the local host is a secondary mail exchanger
37226 differently to other domains. The way in which Exim decides whether a host is
37227 the local host is described in section <xref linkend="SECTreclocipadd"/>.
37228 </para>
37229 <para>
37230 <indexterm role="option">
37231 <primary><option>check_srv</option></primary>
37232 </indexterm>
37233 </para>
37234 <informaltable frame="all">
37235 <tgroup cols="4" colsep="0" rowsep="0">
37236 <colspec colwidth="8*" align="left"/>
37237 <colspec colwidth="6*" align="center"/>
37238 <colspec colwidth="6*" align="center"/>
37239 <colspec colwidth="6*" align="right"/>
37240 <tbody>
37241 <row>
37242 <entry><option>check_srv</option></entry>
37243 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37245 <entry>Default: <emphasis>unset</emphasis></entry>
37246 </row>
37247 </tbody>
37248 </tgroup>
37249 </informaltable>
37250 <para>
37251 <indexterm role="concept">
37252 <primary>SRV record</primary>
37253 <secondary>enabling use of</secondary>
37254 </indexterm>
37255 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
37256 addition to MX and address records. The support is disabled by default. To
37257 enable SRV support, set the <option>check_srv</option> option to the name of the service
37258 required. For example,
37259 </para>
37260 <literallayout class="monospaced">
37261 check_srv = smtp
37262 </literallayout>
37263 <para>
37264 looks for SRV records that refer to the normal smtp service. The option is
37265 expanded, so the service name can vary from message to message or address
37266 to address. This might be helpful if SRV records are being used for a
37267 submission service. If the expansion is forced to fail, the <option>check_srv</option>
37268 option is ignored, and the router proceeds to look for MX records in the
37269 normal way.
37270 </para>
37271 <para>
37272 When the expansion succeeds, the router searches first for SRV records for
37273 the given service (it assumes TCP protocol). A single SRV record with a
37274 host name that consists of just a single dot indicates <quote>no such service for
37275 this domain</quote>; if this is encountered, the router declines. If other kinds of
37276 SRV record are found, they are used to construct a host list for delivery
37277 according to the rules of RFC 2782. MX records are not sought in this case.
37278 </para>
37279 <para>
37280 When no SRV records are found, MX records (and address records) are sought in
37281 the traditional way. In other words, SRV records take precedence over MX
37282 records, just as MX records take precedence over address records. Note that
37283 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
37284 defined it. It is apparently believed that MX records are sufficient for email
37285 and that SRV records should not be used for this purpose. However, SRV records
37286 have an additional <quote>weight</quote> feature which some people might find useful when
37287 trying to split an SMTP load between hosts of different power.
37288 </para>
37289 <para>
37290 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
37291 when there is a DNS lookup error.
37292 </para>
37293 <para>
37294 <indexterm role="option">
37295 <primary><option>fail_defer_domains</option></primary>
37296 </indexterm>
37297 </para>
37298 <informaltable frame="all">
37299 <tgroup cols="4" colsep="0" rowsep="0">
37300 <colspec colwidth="8*" align="left"/>
37301 <colspec colwidth="6*" align="center"/>
37302 <colspec colwidth="6*" align="center"/>
37303 <colspec colwidth="6*" align="right"/>
37304 <tbody>
37305 <row>
37306 <entry><option>fail_defer_domains</option></entry>
37307 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37308 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37309 <entry>Default: <emphasis>unset</emphasis></entry>
37310 </row>
37311 </tbody>
37312 </tgroup>
37313 </informaltable>
37314 <para>
37315 <indexterm role="concept">
37316 <primary>MX record</primary>
37317 <secondary>not found</secondary>
37318 </indexterm>
37319 DNS lookups for domains matching <option>fail_defer_domains</option>
37320 which find no matching record will cause the router to defer
37321 rather than the default behaviour of decline.
37322 This maybe be useful for queueing messages for a newly created
37323 domain while the DNS configuration is not ready.
37324 However, it will result in any message with mistyped domains
37325 also being queued.
37326 </para>
37327 <para>
37328 <indexterm role="option">
37329 <primary><option>ipv4_only</option></primary>
37330 </indexterm>
37331 </para>
37332 <informaltable frame="all">
37333 <tgroup cols="4" colsep="0" rowsep="0">
37334 <colspec colwidth="8*" align="left"/>
37335 <colspec colwidth="6*" align="center"/>
37336 <colspec colwidth="6*" align="center"/>
37337 <colspec colwidth="6*" align="right"/>
37338 <tbody>
37339 <row>
37340 <entry><option>ipv4_only</option></entry>
37341 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37342 <entry>Type: <emphasis>unset</emphasis></entry>
37343 <entry>Default: <emphasis></emphasis></entry>
37344 </row>
37345 </tbody>
37346 </tgroup>
37347 </informaltable>
37348 <para>
37349 <indexterm role="concept">
37350 <primary>IPv6</primary>
37351 <secondary>disabling</secondary>
37352 </indexterm>
37353 <indexterm role="concept">
37354 <primary>DNS</primary>
37355 <secondary>IPv6 disabling</secondary>
37356 </indexterm>
37357 The string is expanded, and if the result is anything but a forced failure,
37358 or an empty string, or one of the strings “0” or “no” or “false”
37359 (checked without regard to the case of the letters),
37360 only A records are used.
37361 </para>
37362 <para>
37363 <indexterm role="option">
37364 <primary><option>ipv4_prefer</option></primary>
37365 </indexterm>
37366 </para>
37367 <informaltable frame="all">
37368 <tgroup cols="4" colsep="0" rowsep="0">
37369 <colspec colwidth="8*" align="left"/>
37370 <colspec colwidth="6*" align="center"/>
37371 <colspec colwidth="6*" align="center"/>
37372 <colspec colwidth="6*" align="right"/>
37373 <tbody>
37374 <row>
37375 <entry><option>ipv4_prefer</option></entry>
37376 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37377 <entry>Type: <emphasis>unset</emphasis></entry>
37378 <entry>Default: <emphasis></emphasis></entry>
37379 </row>
37380 </tbody>
37381 </tgroup>
37382 </informaltable>
37383 <para>
37384 <indexterm role="concept">
37385 <primary>IPv4</primary>
37386 <secondary>preference</secondary>
37387 </indexterm>
37388 <indexterm role="concept">
37389 <primary>DNS</primary>
37390 <secondary>IPv4 preference</secondary>
37391 </indexterm>
37392 The string is expanded, and if the result is anything but a forced failure,
37393 or an empty string, or one of the strings “0” or “no” or “false”
37394 (checked without regard to the case of the letters),
37395 A records are sorted before AAAA records (inverting the default).
37396 </para>
37397 <para>
37398 <indexterm role="option">
37399 <primary><option>mx_domains</option></primary>
37400 </indexterm>
37401 </para>
37402 <informaltable frame="all">
37403 <tgroup cols="4" colsep="0" rowsep="0">
37404 <colspec colwidth="8*" align="left"/>
37405 <colspec colwidth="6*" align="center"/>
37406 <colspec colwidth="6*" align="center"/>
37407 <colspec colwidth="6*" align="right"/>
37408 <tbody>
37409 <row>
37410 <entry><option>mx_domains</option></entry>
37411 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37412 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37413 <entry>Default: <emphasis>unset</emphasis></entry>
37414 </row>
37415 </tbody>
37416 </tgroup>
37417 </informaltable>
37418 <para>
37419 <indexterm role="concept">
37420 <primary>MX record</primary>
37421 <secondary>required to exist</secondary>
37422 </indexterm>
37423 <indexterm role="concept">
37424 <primary>SRV record</primary>
37425 <secondary>required to exist</secondary>
37426 </indexterm>
37427 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
37428 record in order to be recognized. (The name of this option could be improved.)
37429 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
37430 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
37431 setting:
37432 </para>
37433 <literallayout class="monospaced">
37434 mx_domains = ! *.discworld.fict.example : *.fict.example
37435 </literallayout>
37436 <para>
37437 This specifies that messages addressed to a domain that matches the list but
37438 has no MX record should be bounced immediately instead of being routed using
37439 the address record.
37440 </para>
37441 <para>
37442 <indexterm role="option">
37443 <primary><option>mx_fail_domains</option></primary>
37444 </indexterm>
37445 </para>
37446 <informaltable frame="all">
37447 <tgroup cols="4" colsep="0" rowsep="0">
37448 <colspec colwidth="8*" align="left"/>
37449 <colspec colwidth="6*" align="center"/>
37450 <colspec colwidth="6*" align="center"/>
37451 <colspec colwidth="6*" align="right"/>
37452 <tbody>
37453 <row>
37454 <entry><option>mx_fail_domains</option></entry>
37455 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37456 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37457 <entry>Default: <emphasis>unset</emphasis></entry>
37458 </row>
37459 </tbody>
37460 </tgroup>
37461 </informaltable>
37462 <para>
37463 If the DNS lookup for MX records for one of the domains in this list causes a
37464 DNS lookup error, Exim behaves as if no MX records were found. See section
37465 <xref linkend="SECTprowitdnsloo"/> for more discussion.
37466 </para>
37467 <para>
37468 <indexterm role="option">
37469 <primary><option>qualify_single</option></primary>
37470 </indexterm>
37471 </para>
37472 <informaltable frame="all">
37473 <tgroup cols="4" colsep="0" rowsep="0">
37474 <colspec colwidth="8*" align="left"/>
37475 <colspec colwidth="6*" align="center"/>
37476 <colspec colwidth="6*" align="center"/>
37477 <colspec colwidth="6*" align="right"/>
37478 <tbody>
37479 <row>
37480 <entry><option>qualify_single</option></entry>
37481 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37482 <entry>Type: <emphasis>boolean</emphasis></entry>
37483 <entry>Default: <emphasis>true</emphasis></entry>
37484 </row>
37485 </tbody>
37486 </tgroup>
37487 </informaltable>
37488 <para>
37489 <indexterm role="concept">
37490 <primary>DNS</primary>
37491 <secondary>resolver options</secondary>
37492 </indexterm>
37493 <indexterm role="concept">
37494 <primary>DNS</primary>
37495 <secondary>qualifying single-component names</secondary>
37496 </indexterm>
37497 When this option is true, the resolver option RES_DEFNAMES is set for DNS
37498 lookups. Typically, but not standardly, this causes the resolver to qualify
37499 single-component names with the default domain. For example, on a machine
37500 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
37501 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
37502 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
37503 <emphasis>resolv.conf</emphasis>.
37504 </para>
37505 <para>
37506 <indexterm role="option">
37507 <primary><option>rewrite_headers</option></primary>
37508 </indexterm>
37509 </para>
37510 <informaltable frame="all">
37511 <tgroup cols="4" colsep="0" rowsep="0">
37512 <colspec colwidth="8*" align="left"/>
37513 <colspec colwidth="6*" align="center"/>
37514 <colspec colwidth="6*" align="center"/>
37515 <colspec colwidth="6*" align="right"/>
37516 <tbody>
37517 <row>
37518 <entry><option>rewrite_headers</option></entry>
37519 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37520 <entry>Type: <emphasis>boolean</emphasis></entry>
37521 <entry>Default: <emphasis>true</emphasis></entry>
37522 </row>
37523 </tbody>
37524 </tgroup>
37525 </informaltable>
37526 <para>
37527 <indexterm role="concept">
37528 <primary>rewriting</primary>
37529 <secondary>header lines</secondary>
37530 </indexterm>
37531 <indexterm role="concept">
37532 <primary>header lines</primary>
37533 <secondary>rewriting</secondary>
37534 </indexterm>
37535 If the domain name in the address that is being processed is not fully
37536 qualified, it may be expanded to its full form by a DNS lookup. For example, if
37537 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
37538 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
37539 occur as a result of setting the <option>widen_domains</option> option. If
37540 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
37541 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
37542 header lines of the message are rewritten with the full domain name.
37543 </para>
37544 <para>
37545 This option should be turned off only when it is known that no message is
37546 ever going to be sent outside an environment where the abbreviation makes
37547 sense.
37548 </para>
37549 <para>
37550 When an MX record is looked up in the DNS and matches a wildcard record, name
37551 servers normally return a record containing the name that has been looked up,
37552 making it impossible to detect whether a wildcard was present or not. However,
37553 some name servers have recently been seen to return the wildcard entry. If the
37554 name returned by a DNS lookup begins with an asterisk, it is not used for
37555 header rewriting.
37556 </para>
37557 <para>
37558 <indexterm role="option">
37559 <primary><option>same_domain_copy_routing</option></primary>
37560 </indexterm>
37561 </para>
37562 <informaltable frame="all">
37563 <tgroup cols="4" colsep="0" rowsep="0">
37564 <colspec colwidth="8*" align="left"/>
37565 <colspec colwidth="6*" align="center"/>
37566 <colspec colwidth="6*" align="center"/>
37567 <colspec colwidth="6*" align="right"/>
37568 <tbody>
37569 <row>
37570 <entry><option>same_domain_copy_routing</option></entry>
37571 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37572 <entry>Type: <emphasis>boolean</emphasis></entry>
37573 <entry>Default: <emphasis>false</emphasis></entry>
37574 </row>
37575 </tbody>
37576 </tgroup>
37577 </informaltable>
37578 <para>
37579 <indexterm role="concept">
37580 <primary>address</primary>
37581 <secondary>copying routing</secondary>
37582 </indexterm>
37583 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
37584 to the same list of hosts. However, this cannot be presumed, because the router
37585 options and preconditions may refer to the local part of the address. By
37586 default, therefore, Exim routes each address in a message independently. DNS
37587 servers run caches, so repeated DNS lookups are not normally expensive, and in
37588 any case, personal messages rarely have more than a few recipients.
37589 </para>
37590 <para>
37591 If you are running mailing lists with large numbers of subscribers at the same
37592 domain, and you are using a <command>dnslookup</command> router which is independent of the
37593 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
37594 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
37595 routes an address to a remote transport, any other unrouted addresses in the
37596 message that have the same domain are automatically given the same routing
37597 without processing them independently,
37598 provided the following conditions are met:
37599 </para>
37600 <itemizedlist>
37601 <listitem>
37602 <para>
37603 No router that processed the address specified <option>headers_add</option> or
37604 <option>headers_remove</option>.
37605 </para>
37606 </listitem>
37607 <listitem>
37608 <para>
37609 The router did not change the address in any way, for example, by <quote>widening</quote>
37610 the domain.
37611 </para>
37612 </listitem>
37613 </itemizedlist>
37614 <para>
37615 <indexterm role="option">
37616 <primary><option>search_parents</option></primary>
37617 </indexterm>
37618 </para>
37619 <informaltable frame="all">
37620 <tgroup cols="4" colsep="0" rowsep="0">
37621 <colspec colwidth="8*" align="left"/>
37622 <colspec colwidth="6*" align="center"/>
37623 <colspec colwidth="6*" align="center"/>
37624 <colspec colwidth="6*" align="right"/>
37625 <tbody>
37626 <row>
37627 <entry><option>search_parents</option></entry>
37628 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37629 <entry>Type: <emphasis>boolean</emphasis></entry>
37630 <entry>Default: <emphasis>false</emphasis></entry>
37631 </row>
37632 </tbody>
37633 </tgroup>
37634 </informaltable>
37635 <para>
37636 <indexterm role="concept">
37637 <primary>DNS</primary>
37638 <secondary>resolver options</secondary>
37639 </indexterm>
37640 When this option is true, the resolver option RES_DNSRCH is set for DNS
37641 lookups. This is different from the <option>qualify_single</option> option in that it
37642 applies to domains containing dots. Typically, but not standardly, it causes
37643 the resolver to search for the name in the current domain and in parent
37644 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
37645 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
37646 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
37647 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
37648 </para>
37649 <para>
37650 Setting this option true can cause problems in domains that have a wildcard MX
37651 record, because any domain that does not have its own MX record matches the
37652 local wildcard.
37653 </para>
37654 <para>
37655 <indexterm role="option">
37656 <primary><option>srv_fail_domains</option></primary>
37657 </indexterm>
37658 </para>
37659 <informaltable frame="all">
37660 <tgroup cols="4" colsep="0" rowsep="0">
37661 <colspec colwidth="8*" align="left"/>
37662 <colspec colwidth="6*" align="center"/>
37663 <colspec colwidth="6*" align="center"/>
37664 <colspec colwidth="6*" align="right"/>
37665 <tbody>
37666 <row>
37667 <entry><option>srv_fail_domains</option></entry>
37668 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37669 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37670 <entry>Default: <emphasis>unset</emphasis></entry>
37671 </row>
37672 </tbody>
37673 </tgroup>
37674 </informaltable>
37675 <para>
37676 If the DNS lookup for SRV records for one of the domains in this list causes a
37677 DNS lookup error, Exim behaves as if no SRV records were found. See section
37678 <xref linkend="SECTprowitdnsloo"/> for more discussion.
37679 </para>
37680 <para>
37681 <indexterm role="option">
37682 <primary><option>widen_domains</option></primary>
37683 </indexterm>
37684 </para>
37685 <informaltable frame="all">
37686 <tgroup cols="4" colsep="0" rowsep="0">
37687 <colspec colwidth="8*" align="left"/>
37688 <colspec colwidth="6*" align="center"/>
37689 <colspec colwidth="6*" align="center"/>
37690 <colspec colwidth="6*" align="right"/>
37691 <tbody>
37692 <row>
37693 <entry><option>widen_domains</option></entry>
37694 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37695 <entry>Type: <emphasis>string list</emphasis></entry>
37696 <entry>Default: <emphasis>unset</emphasis></entry>
37697 </row>
37698 </tbody>
37699 </tgroup>
37700 </informaltable>
37701 <para>
37702 <indexterm role="concept">
37703 <primary>domain</primary>
37704 <secondary>partial; widening</secondary>
37705 </indexterm>
37706 If a DNS lookup fails and this option is set, each of its strings in turn is
37707 added onto the end of the domain, and the lookup is tried again. For example,
37708 if
37709 </para>
37710 <literallayout class="monospaced">
37711 widen_domains = fict.example:ref.example
37712 </literallayout>
37713 <para>
37714 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
37715 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
37716 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
37717 and <option>search_parents</option> options can cause some widening to be undertaken inside
37718 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
37719 when verifying, unless <option>rewrite_headers</option> is false (not the default).
37720 </para>
37721 </section>
37722 <section id="SECID119">
37723 <title>Effect of qualify_single and search_parents</title>
37724 <para>
37725 When a domain from an envelope recipient is changed by the resolver as a result
37726 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
37727 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
37728 is set false. Exim then re-routes the address, using the full domain.
37729 </para>
37730 <para>
37731 These two options affect only the DNS lookup that takes place inside the router
37732 for the domain of the address that is being routed. They do not affect lookups
37733 such as that implied by
37734 </para>
37735 <literallayout class="monospaced">
37736 domains = @mx_any
37737 </literallayout>
37738 <para>
37739 that may happen while processing a router precondition before the router is
37740 entered. No widening ever takes place for these lookups.
37741 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
37742 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
37743 </para>
37744 </section>
37745 </chapter>
37746
37747 <chapter id="CHID5">
37748 <title>The ipliteral router</title>
37749 <para>
37750 <indexterm role="concept">
37751 <primary><command>ipliteral</command> router</primary>
37752 </indexterm>
37753 <indexterm role="concept">
37754 <primary>domain literal</primary>
37755 <secondary>routing</secondary>
37756 </indexterm>
37757 <indexterm role="concept">
37758 <primary>routers</primary>
37759 <secondary><command>ipliteral</command></secondary>
37760 </indexterm>
37761 This router has no private options. Unless it is being used purely for
37762 verification (see <option>verify_only</option>) a transport is required to be defined by the
37763 generic <option>transport</option> option. The router accepts the address if its domain part
37764 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
37765 router handles the address
37766 </para>
37767 <literallayout class="monospaced">
37768 root@[192.168.1.1]
37769 </literallayout>
37770 <para>
37771 by setting up delivery to the host with that IP address. IPv4 domain literals
37772 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
37773 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
37774 </para>
37775 <literallayout class="monospaced">
37776 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
37777 </literallayout>
37778 <para>
37779 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
37780 grounds that sooner or later somebody will try it.
37781 </para>
37782 <para>
37783 <indexterm role="option">
37784 <primary><option>self</option></primary>
37785 <secondary>in <command>ipliteral</command> router</secondary>
37786 </indexterm>
37787 If the IP address matches something in <option>ignore_target_hosts</option>, the router
37788 declines. If an IP literal turns out to refer to the local host, the generic
37789 <option>self</option> option determines what happens.
37790 </para>
37791 <para>
37792 The RFCs require support for domain literals; however, their use is
37793 controversial in today&#x2019;s Internet. If you want to use this router, you must
37794 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
37795 Exim will not recognize the domain literal syntax in addresses.
37796 </para>
37797 </chapter>
37798
37799 <chapter id="CHID6">
37800 <title>The iplookup router</title>
37801 <para>
37802 <indexterm role="concept">
37803 <primary><command>iplookup</command> router</primary>
37804 </indexterm>
37805 <indexterm role="concept">
37806 <primary>routers</primary>
37807 <secondary><command>iplookup</command></secondary>
37808 </indexterm>
37809 The <command>iplookup</command> router was written to fulfil a specific requirement in
37810 Cambridge University (which in fact no longer exists). For this reason, it is
37811 not included in the binary of Exim by default. If you want to include it, you
37812 must set
37813 </para>
37814 <literallayout class="monospaced">
37815 ROUTER_IPLOOKUP=yes
37816 </literallayout>
37817 <para>
37818 in your <filename>Local/Makefile</filename> configuration file.
37819 </para>
37820 <para>
37821 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
37822 connection to one or more specific hosts. The host can then return the same or
37823 a different address &ndash; in effect rewriting the recipient address in the
37824 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
37825 this process fails, the address can be passed on to other routers, or delivery
37826 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
37827 must not be specified for it.
37828 </para>
37829 <para>
37830 <indexterm role="concept">
37831 <primary>options</primary>
37832 <secondary><command>iplookup</command> router</secondary>
37833 </indexterm>
37834 <indexterm role="option">
37835 <primary><option>hosts</option></primary>
37836 </indexterm>
37837 </para>
37838 <informaltable frame="all">
37839 <tgroup cols="4" colsep="0" rowsep="0">
37840 <colspec colwidth="8*" align="left"/>
37841 <colspec colwidth="6*" align="center"/>
37842 <colspec colwidth="6*" align="center"/>
37843 <colspec colwidth="6*" align="right"/>
37844 <tbody>
37845 <row>
37846 <entry><option>hosts</option></entry>
37847 <entry>Use: <emphasis>iplookup</emphasis></entry>
37848 <entry>Type: <emphasis>string</emphasis></entry>
37849 <entry>Default: <emphasis>unset</emphasis></entry>
37850 </row>
37851 </tbody>
37852 </tgroup>
37853 </informaltable>
37854 <para>
37855 This option must be supplied. Its value is a colon-separated list of host
37856 names. The hosts are looked up using <function>gethostbyname()</function>
37857 (or <function>getipnodebyname()</function> when available)
37858 and are tried in order until one responds to the query. If none respond, what
37859 happens is controlled by <option>optional</option>.
37860 </para>
37861 <para>
37862 <indexterm role="option">
37863 <primary><option>optional</option></primary>
37864 </indexterm>
37865 </para>
37866 <informaltable frame="all">
37867 <tgroup cols="4" colsep="0" rowsep="0">
37868 <colspec colwidth="8*" align="left"/>
37869 <colspec colwidth="6*" align="center"/>
37870 <colspec colwidth="6*" align="center"/>
37871 <colspec colwidth="6*" align="right"/>
37872 <tbody>
37873 <row>
37874 <entry><option>optional</option></entry>
37875 <entry>Use: <emphasis>iplookup</emphasis></entry>
37876 <entry>Type: <emphasis>boolean</emphasis></entry>
37877 <entry>Default: <emphasis>false</emphasis></entry>
37878 </row>
37879 </tbody>
37880 </tgroup>
37881 </informaltable>
37882 <para>
37883 If <option>optional</option> is true, if no response is obtained from any host, the address
37884 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
37885 delivery to the address is deferred.
37886 </para>
37887 <para>
37888 <indexterm role="option">
37889 <primary><option>port</option></primary>
37890 </indexterm>
37891 </para>
37892 <informaltable frame="all">
37893 <tgroup cols="4" colsep="0" rowsep="0">
37894 <colspec colwidth="8*" align="left"/>
37895 <colspec colwidth="6*" align="center"/>
37896 <colspec colwidth="6*" align="center"/>
37897 <colspec colwidth="6*" align="right"/>
37898 <tbody>
37899 <row>
37900 <entry><option>port</option></entry>
37901 <entry>Use: <emphasis>iplookup</emphasis></entry>
37902 <entry>Type: <emphasis>integer</emphasis></entry>
37903 <entry>Default: <emphasis>0</emphasis></entry>
37904 </row>
37905 </tbody>
37906 </tgroup>
37907 </informaltable>
37908 <para>
37909 <indexterm role="concept">
37910 <primary>port</primary>
37911 <secondary><command>iplookup</command> router</secondary>
37912 </indexterm>
37913 This option must be supplied. It specifies the port number for the TCP or UDP
37914 call.
37915 </para>
37916 <para>
37917 <indexterm role="option">
37918 <primary><option>protocol</option></primary>
37919 </indexterm>
37920 </para>
37921 <informaltable frame="all">
37922 <tgroup cols="4" colsep="0" rowsep="0">
37923 <colspec colwidth="8*" align="left"/>
37924 <colspec colwidth="6*" align="center"/>
37925 <colspec colwidth="6*" align="center"/>
37926 <colspec colwidth="6*" align="right"/>
37927 <tbody>
37928 <row>
37929 <entry><option>protocol</option></entry>
37930 <entry>Use: <emphasis>iplookup</emphasis></entry>
37931 <entry>Type: <emphasis>string</emphasis></entry>
37932 <entry>Default: <emphasis>udp</emphasis></entry>
37933 </row>
37934 </tbody>
37935 </tgroup>
37936 </informaltable>
37937 <para>
37938 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
37939 protocols is to be used.
37940 </para>
37941 <para>
37942 <indexterm role="option">
37943 <primary><option>query</option></primary>
37944 </indexterm>
37945 </para>
37946 <informaltable frame="all">
37947 <tgroup cols="4" colsep="0" rowsep="0">
37948 <colspec colwidth="8*" align="left"/>
37949 <colspec colwidth="6*" align="center"/>
37950 <colspec colwidth="6*" align="center"/>
37951 <colspec colwidth="6*" align="right"/>
37952 <tbody>
37953 <row>
37954 <entry><option>query</option></entry>
37955 <entry>Use: <emphasis>iplookup</emphasis></entry>
37956 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37957 <entry>Default: <emphasis>see below</emphasis></entry>
37958 </row>
37959 </tbody>
37960 </tgroup>
37961 </informaltable>
37962 <para>
37963 This defines the content of the query that is sent to the remote hosts. The
37964 default value is:
37965 </para>
37966 <literallayout class="monospaced">
37967 $local_part@$domain $local_part@$domain
37968 </literallayout>
37969 <para>
37970 The repetition serves as a way of checking that a response is to the correct
37971 query in the default case (see <option>response_pattern</option> below).
37972 </para>
37973 <para>
37974 <indexterm role="option">
37975 <primary><option>reroute</option></primary>
37976 </indexterm>
37977 </para>
37978 <informaltable frame="all">
37979 <tgroup cols="4" colsep="0" rowsep="0">
37980 <colspec colwidth="8*" align="left"/>
37981 <colspec colwidth="6*" align="center"/>
37982 <colspec colwidth="6*" align="center"/>
37983 <colspec colwidth="6*" align="right"/>
37984 <tbody>
37985 <row>
37986 <entry><option>reroute</option></entry>
37987 <entry>Use: <emphasis>iplookup</emphasis></entry>
37988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37989 <entry>Default: <emphasis>unset</emphasis></entry>
37990 </row>
37991 </tbody>
37992 </tgroup>
37993 </informaltable>
37994 <para>
37995 If this option is not set, the rerouted address is precisely the byte string
37996 returned by the remote host, up to the first white space, if any. If set, the
37997 string is expanded to form the rerouted address. It can include parts matched
37998 in the response by <option>response_pattern</option> by means of numeric variables such as
37999 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
38000 whether or not a pattern is in use. In all cases, the rerouted address must end
38001 up in the form <emphasis>local_part@domain</emphasis>.
38002 </para>
38003 <para>
38004 <indexterm role="option">
38005 <primary><option>response_pattern</option></primary>
38006 </indexterm>
38007 </para>
38008 <informaltable frame="all">
38009 <tgroup cols="4" colsep="0" rowsep="0">
38010 <colspec colwidth="8*" align="left"/>
38011 <colspec colwidth="6*" align="center"/>
38012 <colspec colwidth="6*" align="center"/>
38013 <colspec colwidth="6*" align="right"/>
38014 <tbody>
38015 <row>
38016 <entry><option>response_pattern</option></entry>
38017 <entry>Use: <emphasis>iplookup</emphasis></entry>
38018 <entry>Type: <emphasis>string</emphasis></entry>
38019 <entry>Default: <emphasis>unset</emphasis></entry>
38020 </row>
38021 </tbody>
38022 </tgroup>
38023 </informaltable>
38024 <para>
38025 This option can be set to a regular expression that is applied to the string
38026 returned from the remote host. If the pattern does not match the response, the
38027 router declines. If <option>response_pattern</option> is not set, no checking of the
38028 response is done, unless the query was defaulted, in which case there is a
38029 check that the text returned after the first white space is the original
38030 address. This checks that the answer that has been received is in response to
38031 the correct question. For example, if the response is just a new domain, the
38032 following could be used:
38033 </para>
38034 <literallayout class="monospaced">
38035 response_pattern = ^([^@]+)$
38036 reroute = $local_part@$1
38037 </literallayout>
38038 <para>
38039 <indexterm role="option">
38040 <primary><option>timeout</option></primary>
38041 </indexterm>
38042 </para>
38043 <informaltable frame="all">
38044 <tgroup cols="4" colsep="0" rowsep="0">
38045 <colspec colwidth="8*" align="left"/>
38046 <colspec colwidth="6*" align="center"/>
38047 <colspec colwidth="6*" align="center"/>
38048 <colspec colwidth="6*" align="right"/>
38049 <tbody>
38050 <row>
38051 <entry><option>timeout</option></entry>
38052 <entry>Use: <emphasis>iplookup</emphasis></entry>
38053 <entry>Type: <emphasis>time</emphasis></entry>
38054 <entry>Default: <emphasis>5s</emphasis></entry>
38055 </row>
38056 </tbody>
38057 </tgroup>
38058 </informaltable>
38059 <para>
38060 This specifies the amount of time to wait for a response from the remote
38061 machine. The same timeout is used for the <function>connect()</function> function for a TCP
38062 call. It does not apply to UDP.
38063 </para>
38064 </chapter>
38065
38066 <chapter id="CHID7">
38067 <title>The manualroute router</title>
38068 <para>
38069 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
38070 <primary><command>manualroute</command> router</primary>
38071 </indexterm>
38072 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
38073 <primary>routers</primary>
38074 <secondary><command>manualroute</command></secondary>
38075 </indexterm>
38076 <indexterm role="concept">
38077 <primary>domain</primary>
38078 <secondary>manually routing</secondary>
38079 </indexterm>
38080 The <command>manualroute</command> router is so-called because it provides a way of manually
38081 routing an address according to its domain. It is mainly used when you want to
38082 route addresses to remote hosts according to your own rules, bypassing the
38083 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
38084 route to local transports, a facility that may be useful if you want to save
38085 messages for dial-in hosts in local files.
38086 </para>
38087 <para>
38088 The <command>manualroute</command> router compares a list of domain patterns with the domain
38089 it is trying to route. If there is no match, the router declines. Each pattern
38090 has associated with it a list of hosts and some other optional data, which may
38091 include a transport. The combination of a pattern and its data is called a
38092 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
38093 generic <option>transport</option> option must specify a transport, unless the router is
38094 being used purely for verification (see <option>verify_only</option>).
38095 </para>
38096 <para>
38097 <indexterm role="variable">
38098 <primary><varname>$host</varname></primary>
38099 </indexterm>
38100 In the case of verification, matching the domain pattern is sufficient for the
38101 router to accept the address. When actually routing an address for delivery,
38102 an address that matches a domain pattern is queued for the associated
38103 transport. If the transport is not a local one, a host list must be associated
38104 with the pattern; IP addresses are looked up for the hosts, and these are
38105 passed to the transport along with the mail address. For local transports, a
38106 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
38107 text string.
38108 </para>
38109 <para>
38110 The list of routing rules can be provided as an inline string in
38111 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
38112 or database by setting <option>route_data</option>. Only one of these settings may appear in
38113 any one instance of <command>manualroute</command>. The format of routing rules is described
38114 below, following the list of private options.
38115 </para>
38116 <section id="SECTprioptman">
38117 <title>Private options for manualroute</title>
38118 <para>
38119 <indexterm role="concept">
38120 <primary>options</primary>
38121 <secondary><command>manualroute</command> router</secondary>
38122 </indexterm>
38123 The private options for the <command>manualroute</command> router are as follows:
38124 </para>
38125 <para>
38126 <indexterm role="option">
38127 <primary><option>host_all_ignored</option></primary>
38128 </indexterm>
38129 </para>
38130 <informaltable frame="all">
38131 <tgroup cols="4" colsep="0" rowsep="0">
38132 <colspec colwidth="8*" align="left"/>
38133 <colspec colwidth="6*" align="center"/>
38134 <colspec colwidth="6*" align="center"/>
38135 <colspec colwidth="6*" align="right"/>
38136 <tbody>
38137 <row>
38138 <entry><option>host_all_ignored</option></entry>
38139 <entry>Use: <emphasis>manualroute</emphasis></entry>
38140 <entry>Type: <emphasis>string</emphasis></entry>
38141 <entry>Default: <emphasis>defer</emphasis></entry>
38142 </row>
38143 </tbody>
38144 </tgroup>
38145 </informaltable>
38146 <para>
38147 See <option>host_find_failed</option>.
38148 </para>
38149 <para>
38150 <indexterm role="option">
38151 <primary><option>host_find_failed</option></primary>
38152 </indexterm>
38153 </para>
38154 <informaltable frame="all">
38155 <tgroup cols="4" colsep="0" rowsep="0">
38156 <colspec colwidth="8*" align="left"/>
38157 <colspec colwidth="6*" align="center"/>
38158 <colspec colwidth="6*" align="center"/>
38159 <colspec colwidth="6*" align="right"/>
38160 <tbody>
38161 <row>
38162 <entry><option>host_find_failed</option></entry>
38163 <entry>Use: <emphasis>manualroute</emphasis></entry>
38164 <entry>Type: <emphasis>string</emphasis></entry>
38165 <entry>Default: <emphasis>freeze</emphasis></entry>
38166 </row>
38167 </tbody>
38168 </tgroup>
38169 </informaltable>
38170 <para>
38171 This option controls what happens when <command>manualroute</command> tries to find an IP
38172 address for a host, and the host does not exist. The option can be set to one
38173 of the following values:
38174 </para>
38175 <literallayout class="monospaced">
38176 decline
38177 defer
38178 fail
38179 freeze
38180 ignore
38181 pass
38182 </literallayout>
38183 <para>
38184 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
38185 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
38186 forces the address to be passed to the next router (or the router defined by
38187 <option>pass_router</option>),
38188 <indexterm role="option">
38189 <primary><option>more</option></primary>
38190 </indexterm>
38191 overriding <option>no_more</option>, whereas the latter passes the address to the next
38192 router only if <option>more</option> is true.
38193 </para>
38194 <para>
38195 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
38196 cannot be found. If all the hosts in the list are ignored, the behaviour is
38197 controlled by the <option>host_all_ignored</option> option. This takes the same values
38198 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
38199 </para>
38200 <para>
38201 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
38202 state; if a host lookup gets a temporary error, delivery is deferred unless the
38203 generic <option>pass_on_timeout</option> option is set.
38204 </para>
38205 <para>
38206 <indexterm role="option">
38207 <primary><option>hosts_randomize</option></primary>
38208 </indexterm>
38209 </para>
38210 <informaltable frame="all">
38211 <tgroup cols="4" colsep="0" rowsep="0">
38212 <colspec colwidth="8*" align="left"/>
38213 <colspec colwidth="6*" align="center"/>
38214 <colspec colwidth="6*" align="center"/>
38215 <colspec colwidth="6*" align="right"/>
38216 <tbody>
38217 <row>
38218 <entry><option>hosts_randomize</option></entry>
38219 <entry>Use: <emphasis>manualroute</emphasis></entry>
38220 <entry>Type: <emphasis>boolean</emphasis></entry>
38221 <entry>Default: <emphasis>false</emphasis></entry>
38222 </row>
38223 </tbody>
38224 </tgroup>
38225 </informaltable>
38226 <para>
38227 <indexterm role="concept">
38228 <primary>randomized host list</primary>
38229 </indexterm>
38230 <indexterm role="concept">
38231 <primary>host</primary>
38232 <secondary>list of; randomized</secondary>
38233 </indexterm>
38234 If this option is set, the order of the items in a host list in a routing rule
38235 is randomized each time the list is used, unless an option in the routing rule
38236 overrides (see below). Randomizing the order of a host list can be used to do
38237 crude load sharing. However, if more than one mail address is routed by the
38238 same router to the same host list, the host lists are considered to be the same
38239 (even though they may be randomized into different orders) for the purpose of
38240 deciding whether to batch the deliveries into a single SMTP transaction.
38241 </para>
38242 <para>
38243 When <option>hosts_randomize</option> is true, a host list may be split
38244 into groups whose order is separately randomized. This makes it possible to
38245 set up MX-like behaviour. The boundaries between groups are indicated by an
38246 item that is just <literal>+</literal> in the host list. For example:
38247 </para>
38248 <literallayout class="monospaced">
38249 route_list = * host1:host2:host3:+:host4:host5
38250 </literallayout>
38251 <para>
38252 The order of the first three hosts and the order of the last two hosts is
38253 randomized for each use, but the first three always end up before the last two.
38254 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
38255 randomized host list is passed to an <command>smtp</command> transport that also has
38256 <option>hosts_randomize set</option>, the list is not re-randomized.
38257 </para>
38258 <para>
38259 <indexterm role="option">
38260 <primary><option>route_data</option></primary>
38261 </indexterm>
38262 </para>
38263 <informaltable frame="all">
38264 <tgroup cols="4" colsep="0" rowsep="0">
38265 <colspec colwidth="8*" align="left"/>
38266 <colspec colwidth="6*" align="center"/>
38267 <colspec colwidth="6*" align="center"/>
38268 <colspec colwidth="6*" align="right"/>
38269 <tbody>
38270 <row>
38271 <entry><option>route_data</option></entry>
38272 <entry>Use: <emphasis>manualroute</emphasis></entry>
38273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38274 <entry>Default: <emphasis>unset</emphasis></entry>
38275 </row>
38276 </tbody>
38277 </tgroup>
38278 </informaltable>
38279 <para>
38280 If this option is set, it must expand to yield the data part of a routing rule.
38281 Typically, the expansion string includes a lookup based on the domain. For
38282 example:
38283 </para>
38284 <literallayout class="monospaced">
38285 route_data = ${lookup{$domain}dbm{/etc/routes}}
38286 </literallayout>
38287 <para>
38288 If the expansion is forced to fail, or the result is an empty string, the
38289 router declines. Other kinds of expansion failure cause delivery to be
38290 deferred.
38291 </para>
38292 <para>
38293 <indexterm role="option">
38294 <primary><option>route_list</option></primary>
38295 </indexterm>
38296 </para>
38297 <informaltable frame="all">
38298 <tgroup cols="4" colsep="0" rowsep="0">
38299 <colspec colwidth="8*" align="left"/>
38300 <colspec colwidth="6*" align="center"/>
38301 <colspec colwidth="6*" align="center"/>
38302 <colspec colwidth="6*" align="right"/>
38303 <tbody>
38304 <row>
38305 <entry><option>route_list</option></entry>
38306 <entry>Use: <emphasis>manualroute</emphasis></entry>
38307 <entry>Type: <emphasis>string list</emphasis></entry>
38308 <entry>Default: <emphasis>unset</emphasis></entry>
38309 </row>
38310 </tbody>
38311 </tgroup>
38312 </informaltable>
38313 <para>
38314 This string is a list of routing rules, in the form defined below. Note that,
38315 unlike most string lists, the items are separated by semicolons. This is so
38316 that they may contain colon-separated host lists.
38317 </para>
38318 <para>
38319 <indexterm role="option">
38320 <primary><option>same_domain_copy_routing</option></primary>
38321 </indexterm>
38322 </para>
38323 <informaltable frame="all">
38324 <tgroup cols="4" colsep="0" rowsep="0">
38325 <colspec colwidth="8*" align="left"/>
38326 <colspec colwidth="6*" align="center"/>
38327 <colspec colwidth="6*" align="center"/>
38328 <colspec colwidth="6*" align="right"/>
38329 <tbody>
38330 <row>
38331 <entry><option>same_domain_copy_routing</option></entry>
38332 <entry>Use: <emphasis>manualroute</emphasis></entry>
38333 <entry>Type: <emphasis>boolean</emphasis></entry>
38334 <entry>Default: <emphasis>false</emphasis></entry>
38335 </row>
38336 </tbody>
38337 </tgroup>
38338 </informaltable>
38339 <para>
38340 <indexterm role="concept">
38341 <primary>address</primary>
38342 <secondary>copying routing</secondary>
38343 </indexterm>
38344 Addresses with the same domain are normally routed by the <command>manualroute</command>
38345 router to the same list of hosts. However, this cannot be presumed, because the
38346 router options and preconditions may refer to the local part of the address. By
38347 default, therefore, Exim routes each address in a message independently. DNS
38348 servers run caches, so repeated DNS lookups are not normally expensive, and in
38349 any case, personal messages rarely have more than a few recipients.
38350 </para>
38351 <para>
38352 If you are running mailing lists with large numbers of subscribers at the same
38353 domain, and you are using a <command>manualroute</command> router which is independent of the
38354 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
38355 lookups for identical domains in one message. In this case, when
38356 <command>manualroute</command> routes an address to a remote transport, any other unrouted
38357 addresses in the message that have the same domain are automatically given the
38358 same routing without processing them independently. However, this is only done
38359 if <option>headers_add</option> and <option>headers_remove</option> are unset.
38360 </para>
38361 </section>
38362 <section id="SECID120">
38363 <title>Routing rules in route_list</title>
38364 <para>
38365 The value of <option>route_list</option> is a string consisting of a sequence of routing
38366 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
38367 entered as two semicolons. Alternatively, the list separator can be changed as
38368 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
38369 Empty rules are ignored. The format of each rule is
38370 </para>
38371 <literallayout>
38372 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
38373 </literallayout>
38374 <para>
38375 The following example contains two rules, each with a simple domain pattern and
38376 no options:
38377 </para>
38378 <literallayout class="monospaced">
38379 route_list = \
38380   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
38381   thes.ref.example  mail-3.ref.example:mail-4.ref.example
38382 </literallayout>
38383 <para>
38384 The three parts of a rule are separated by white space. The pattern and the
38385 list of hosts can be enclosed in quotes if necessary, and if they are, the
38386 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
38387 single domain pattern, which is the only mandatory item in the rule. The
38388 pattern is in the same format as one item in a domain list (see section
38389 <xref linkend="SECTdomainlist"/>),
38390 except that it may not be the name of an interpolated file.
38391 That is, it may be wildcarded, or a regular expression, or a file or database
38392 lookup (with semicolons doubled, because of the use of semicolon as a separator
38393 in a <option>route_list</option>).
38394 </para>
38395 <para>
38396 The rules in <option>route_list</option> are searched in order until one of the patterns
38397 matches the domain that is being routed. The list of hosts and then options are
38398 then used as described below. If there is no match, the router declines. When
38399 <option>route_list</option> is set, <option>route_data</option> must not be set.
38400 </para>
38401 </section>
38402 <section id="SECID121">
38403 <title>Routing rules in route_data</title>
38404 <para>
38405 The use of <option>route_list</option> is convenient when there are only a small number of
38406 routing rules. For larger numbers, it is easier to use a file or database to
38407 hold the routing information, and use the <option>route_data</option> option instead.
38408 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
38409 Most commonly, <option>route_data</option> is set as a string that contains an
38410 expansion lookup. For example, suppose we place two routing rules in a file
38411 like this:
38412 </para>
38413 <literallayout class="monospaced">
38414 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
38415 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
38416 </literallayout>
38417 <para>
38418 This data can be accessed by setting
38419 </para>
38420 <literallayout class="monospaced">
38421 route_data = ${lookup{$domain}lsearch{/the/file/name}}
38422 </literallayout>
38423 <para>
38424 Failure of the lookup results in an empty string, causing the router to
38425 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
38426 requirement is that the result of expanding the string is a list of hosts,
38427 possibly followed by options, separated by white space. The list of hosts must
38428 be enclosed in quotes if it contains white space.
38429 </para>
38430 </section>
38431 <section id="SECID122">
38432 <title>Format of the list of hosts</title>
38433 <para>
38434 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
38435 always separately expanded before use. If the expansion fails, the router
38436 declines. The result of the expansion must be a colon-separated list of names
38437 and/or IP addresses, optionally also including ports.
38438 If the list is written with spaces, it must be protected with quotes.
38439 The format of each item
38440 in the list is described in the next section. The list separator can be changed
38441 as described in section <xref linkend="SECTlistsepchange"/>.
38442 </para>
38443 <para>
38444 If the list of hosts was obtained from a <option>route_list</option> item, the following
38445 variables are set during its expansion:
38446 </para>
38447 <itemizedlist>
38448 <listitem>
38449 <para>
38450 <indexterm role="concept">
38451 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
38452 <secondary>in <command>manualroute</command> router</secondary>
38453 </indexterm>
38454 If the domain was matched against a regular expression, the numeric variables
38455 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
38456 </para>
38457 <literallayout class="monospaced">
38458 route_list = ^domain(\d+)   host-$1.text.example
38459 </literallayout>
38460 </listitem>
38461 <listitem>
38462 <para>
38463 <varname>$0</varname> is always set to the entire domain.
38464 </para>
38465 </listitem>
38466 <listitem>
38467 <para>
38468 <varname>$1</varname> is also set when partial matching is done in a file lookup.
38469 </para>
38470 </listitem>
38471 <listitem>
38472 <para>
38473 <indexterm role="variable">
38474 <primary><varname>$value</varname></primary>
38475 </indexterm>
38476 If the pattern that matched the domain was a lookup item, the data that was
38477 looked up is available in the expansion variable <varname>$value</varname>. For example:
38478 </para>
38479 <literallayout class="monospaced">
38480 route_list = lsearch;;/some/file.routes  $value
38481 </literallayout>
38482 </listitem>
38483 </itemizedlist>
38484 <para>
38485 Note the doubling of the semicolon in the pattern that is necessary because
38486 semicolon is the default route list separator.
38487 </para>
38488 </section>
38489 <section id="SECTformatonehostitem">
38490 <title>Format of one host item</title>
38491 <para>
38492 Each item in the list of hosts can be either a host name or an IP address,
38493 optionally with an attached port number, or it can be a single "+"
38494 (see <option>hosts_randomize</option>).
38495 When no port is given, an IP address
38496 is not enclosed in brackets. When a port is specified, it overrides the port
38497 specification on the transport. The port is separated from the name or address
38498 by a colon. This leads to some complications:
38499 </para>
38500 <itemizedlist>
38501 <listitem>
38502 <para>
38503 Because colon is the default separator for the list of hosts, either
38504 the colon that specifies a port must be doubled, or the list separator must
38505 be changed. The following two examples have the same effect:
38506 </para>
38507 <literallayout class="monospaced">
38508 route_list = * "host1.tld::1225 : host2.tld::1226"
38509 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
38510 </literallayout>
38511 </listitem>
38512 <listitem>
38513 <para>
38514 When IPv6 addresses are involved, it gets worse, because they contain
38515 colons of their own. To make this case easier, it is permitted to
38516 enclose an IP address (either v4 or v6) in square brackets if a port
38517 number follows. For example:
38518 </para>
38519 <literallayout class="monospaced">
38520 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
38521 </literallayout>
38522 </listitem>
38523 </itemizedlist>
38524 </section>
38525 <section id="SECThostshowused">
38526 <title>How the list of hosts is used</title>
38527 <para>
38528 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
38529 the hosts is tried, in the order specified, when carrying out the SMTP
38530 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
38531 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
38532 transport.
38533 </para>
38534 <para>
38535 Hosts may be listed by name or by IP address. An unadorned name in the list of
38536 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
38537 interpreted as an indirection to a sublist of hosts obtained by looking up MX
38538 records in the DNS. For example:
38539 </para>
38540 <literallayout class="monospaced">
38541 route_list = *  x.y.z:p.q.r/MX:e.f.g
38542 </literallayout>
38543 <para>
38544 If this feature is used with a port specifier, the port must come last. For
38545 example:
38546 </para>
38547 <literallayout class="monospaced">
38548 route_list = *  dom1.tld/mx::1225
38549 </literallayout>
38550 <para>
38551 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
38552 randomized before any lookups are done. Exim then scans the list; for any name
38553 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
38554 be an interface on the local host and the item is not the first in the list,
38555 Exim discards it and any subsequent items. If it is the first item, what
38556 happens is controlled by the
38557 <indexterm role="option">
38558 <primary><option>self</option></primary>
38559 <secondary>in <command>manualroute</command> router</secondary>
38560 </indexterm>
38561 <option>self</option> option of the router.
38562 </para>
38563 <para>
38564 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
38565 hosts obtained by looking up MX records for the name. This is always a DNS
38566 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
38567 below) are not relevant here. The order of these hosts is determined by the
38568 preference values in the MX records, according to the usual rules. Because
38569 randomizing happens before the MX lookup, it does not affect the order that is
38570 defined by MX preferences.
38571 </para>
38572 <para>
38573 If the local host is present in the sublist obtained from MX records, but is
38574 not the most preferred host in that list, it and any equally or less
38575 preferred hosts are removed before the sublist is inserted into the main list.
38576 </para>
38577 <para>
38578 If the local host is the most preferred host in the MX list, what happens
38579 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
38580 is not the first item (that is, there are previous hosts in the main list),
38581 Exim discards this name and any subsequent items in the main list.
38582 </para>
38583 <para>
38584 If the MX item is first in the list of hosts, and the local host is the
38585 most preferred host, what happens is controlled by the <option>self</option> option of the
38586 router.
38587 </para>
38588 <para>
38589 DNS failures when lookup up the MX records are treated in the same way as DNS
38590 failures when looking up IP addresses: <option>pass_on_timeout</option> and
38591 <option>host_find_failed</option> are used when relevant.
38592 </para>
38593 <para>
38594 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
38595 whether obtained from an MX lookup or not.
38596 </para>
38597 </section>
38598 <section id="SECThowoptused">
38599 <title>How the options are used</title>
38600 <para>
38601 The options are a sequence of words, space-separated.
38602 One of the words can be the name of a transport; this overrides the
38603 <option>transport</option> option on the router for this particular routing rule only. The
38604 other words (if present) control randomization of the list of hosts on a
38605 per-rule basis, and how the IP addresses of the hosts are to be found when
38606 routing to a remote transport. These options are as follows:
38607 </para>
38608 <itemizedlist>
38609 <listitem>
38610 <para>
38611 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
38612 setting of <option>hosts_randomize</option> for this routing rule only.
38613 </para>
38614 </listitem>
38615 <listitem>
38616 <para>
38617 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
38618 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
38619 </para>
38620 </listitem>
38621 <listitem>
38622 <para>
38623 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
38624 find IP addresses. This function may ultimately cause a DNS lookup, but it may
38625 also look in <filename>/etc/hosts</filename> or other sources of information.
38626 </para>
38627 </listitem>
38628 <listitem>
38629 <para>
38630 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
38631 no address records are found. If there is a temporary DNS error (such as a
38632 timeout), delivery is deferred.
38633 </para>
38634 </listitem>
38635 <listitem>
38636 <para>
38637 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
38638 </para>
38639 </listitem>
38640 <listitem>
38641 <para>
38642 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
38643 </para>
38644 </listitem>
38645 </itemizedlist>
38646 <para>
38647 For example:
38648 </para>
38649 <literallayout class="monospaced">
38650 route_list = domain1  host1:host2:host3  randomize bydns;\
38651              domain2  host4:host5
38652 </literallayout>
38653 <para>
38654 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
38655 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
38656 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
38657 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
38658 call.
38659 </para>
38660 <para>
38661 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
38662 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
38663 instead of TRY_AGAIN. That is why the default action is to try a DNS
38664 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
38665 function called.
38666 </para>
38667 <para>
38668 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
38669 inadvertent constraint that a transport name as an option had to be the last
38670 option specified.
38671 </para>
38672 <para>
38673 If no IP address for a host can be found, what happens is controlled by the
38674 <option>host_find_failed</option> option.
38675 </para>
38676 <para>
38677 <indexterm role="variable">
38678 <primary><varname>$host</varname></primary>
38679 </indexterm>
38680 When an address is routed to a local transport, IP addresses are not looked up.
38681 The host list is passed to the transport in the <varname>$host</varname> variable.
38682 </para>
38683 </section>
38684 <section id="SECID123">
38685 <title>Manualroute examples</title>
38686 <para>
38687 In some of the examples that follow, the presence of the <option>remote_smtp</option>
38688 transport, as defined in the default configuration file, is assumed:
38689 </para>
38690 <itemizedlist>
38691 <listitem>
38692 <para>
38693 <indexterm role="concept">
38694 <primary>smart host</primary>
38695 <secondary>example router</secondary>
38696 </indexterm>
38697 The <command>manualroute</command> router can be used to forward all external mail to a
38698 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
38699 named domain list that contains your local domains, for example:
38700 </para>
38701 <literallayout class="monospaced">
38702 domainlist local_domains = my.domain.example
38703 </literallayout>
38704 <para>
38705 You can arrange for all other domains to be routed to a smart host by making
38706 your first router something like this:
38707 </para>
38708 <literallayout class="monospaced">
38709 smart_route:
38710   driver = manualroute
38711   domains = !+local_domains
38712   transport = remote_smtp
38713   route_list = * smarthost.ref.example
38714 </literallayout>
38715 <para>
38716 This causes all non-local addresses to be sent to the single host
38717 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
38718 they are tried in order
38719 (but you can use <option>hosts_randomize</option> to vary the order each time).
38720 Another way of configuring the same thing is this:
38721 </para>
38722 <literallayout class="monospaced">
38723 smart_route:
38724   driver = manualroute
38725   transport = remote_smtp
38726   route_list = !+local_domains  smarthost.ref.example
38727 </literallayout>
38728 <para>
38729 There is no difference in behaviour between these two routers as they stand.
38730 However, they behave differently if <option>no_more</option> is added to them. In the first
38731 example, the router is skipped if the domain does not match the <option>domains</option>
38732 precondition; the following router is always tried. If the router runs, it
38733 always matches the domain and so can never decline. Therefore, <option>no_more</option>
38734 would have no effect. In the second case, the router is never skipped; it
38735 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
38736 <option>no_more</option> would prevent subsequent routers from running.
38737 </para>
38738 </listitem>
38739 <listitem>
38740 <para>
38741 <indexterm role="concept">
38742 <primary>mail hub example</primary>
38743 </indexterm>
38744 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
38745 records in the DNS and delivers it via its own private routing mechanism. Often
38746 the final destinations are behind a firewall, with the mail hub being the one
38747 machine that can connect to machines both inside and outside the firewall. The
38748 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
38749 to the correct hosts. For a small number of domains, the routing can be inline,
38750 using the <option>route_list</option> option, but for a larger number a file or database
38751 lookup is easier to manage.
38752 </para>
38753 <para>
38754 If the domain names are in fact the names of the machines to which the mail is
38755 to be sent by the mail hub, the configuration can be quite simple. For
38756 example:
38757 </para>
38758 <literallayout class="monospaced">
38759 hub_route:
38760   driver = manualroute
38761   transport = remote_smtp
38762   route_list = *.rhodes.tvs.example  $domain
38763 </literallayout>
38764 <para>
38765 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
38766 whose names are the same as the mail domains. A similar approach can be taken
38767 if the host name can be obtained from the domain name by a string manipulation
38768 that the expansion facilities can handle. Otherwise, a lookup based on the
38769 domain can be used to find the host:
38770 </para>
38771 <literallayout class="monospaced">
38772 through_firewall:
38773   driver = manualroute
38774   transport = remote_smtp
38775   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
38776 </literallayout>
38777 <para>
38778 The result of the lookup must be the name or IP address of the host (or
38779 hosts) to which the address is to be routed. If the lookup fails, the route
38780 data is empty, causing the router to decline. The address then passes to the
38781 next router.
38782 </para>
38783 </listitem>
38784 <listitem>
38785 <para>
38786 <indexterm role="concept">
38787 <primary>batched SMTP output example</primary>
38788 </indexterm>
38789 <indexterm role="concept">
38790 <primary>SMTP</primary>
38791 <secondary>batched outgoing; example</secondary>
38792 </indexterm>
38793 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
38794 SMTP format for onward transportation by some other means. This is one way of
38795 storing mail for a dial-up host when it is not connected. The route list entry
38796 can be as simple as a single domain name in a configuration like this:
38797 </para>
38798 <literallayout class="monospaced">
38799 save_in_file:
38800   driver = manualroute
38801   transport = batchsmtp_appendfile
38802   route_list = saved.domain.example
38803 </literallayout>
38804 <para>
38805 though often a pattern is used to pick up more than one domain. If there are
38806 several domains or groups of domains with different transport requirements,
38807 different transports can be listed in the routing information:
38808 </para>
38809 <literallayout class="monospaced">
38810 save_in_file:
38811   driver = manualroute
38812   route_list = \
38813     *.saved.domain1.example  $domain  batch_appendfile; \
38814     *.saved.domain2.example  \
38815       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
38816       batch_pipe
38817 </literallayout>
38818 <para>
38819 <indexterm role="variable">
38820 <primary><varname>$domain</varname></primary>
38821 </indexterm>
38822 <indexterm role="variable">
38823 <primary><varname>$host</varname></primary>
38824 </indexterm>
38825 The first of these just passes the domain in the <varname>$host</varname> variable, which
38826 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
38827 file lookup to find a value to pass, causing the router to decline to handle
38828 the address if the lookup fails.
38829 </para>
38830 </listitem>
38831 <listitem>
38832 <para>
38833 <indexterm role="concept">
38834 <primary>UUCP</primary>
38835 <secondary>example of router for</secondary>
38836 </indexterm>
38837 Routing mail directly to UUCP software is a specific case of the use of
38838 <command>manualroute</command> in a gateway to another mail environment. This is an example of
38839 one way it can be done:
38840 </para>
38841 <literallayout class="monospaced">
38842 # Transport
38843 uucp:
38844   driver = pipe
38845   user = nobody
38846   command = /usr/local/bin/uux -r - \
38847     ${substr_-5:$host}!rmail ${local_part}
38848   return_fail_output = true
38849
38850 # Router
38851 uucphost:
38852   transport = uucp
38853   driver = manualroute
38854   route_data = \
38855     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
38856 </literallayout>
38857 <para>
38858 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
38859 </para>
38860 <literallayout class="monospaced">
38861 darksite.ethereal.example:           darksite.UUCP
38862 </literallayout>
38863 <para>
38864 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
38865 makes clear the distinction between the domain name
38866 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
38867 </para>
38868 </listitem>
38869 </itemizedlist>
38870 <para>
38871 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
38872 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
38873 </para>
38874 </section>
38875 </chapter>
38876
38877 <chapter id="CHAPdriverlast">
38878 <title>The queryprogram router</title>
38879 <para>
38880 <indexterm role="concept" id="IIDquerou1" class="startofrange">
38881 <primary><command>queryprogram</command> router</primary>
38882 </indexterm>
38883 <indexterm role="concept" id="IIDquerou2" class="startofrange">
38884 <primary>routers</primary>
38885 <secondary><command>queryprogram</command></secondary>
38886 </indexterm>
38887 <indexterm role="concept">
38888 <primary>routing</primary>
38889 <secondary>by external program</secondary>
38890 </indexterm>
38891 The <command>queryprogram</command> router routes an address by running an external command
38892 and acting on its output. This is an expensive way to route, and is intended
38893 mainly for use in lightly-loaded systems, or for performing experiments.
38894 However, if it is possible to use the precondition options (<option>domains</option>,
38895 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
38896 be used in special cases, even on a busy host. There are the following private
38897 options:
38898 <indexterm role="concept">
38899 <primary>options</primary>
38900 <secondary><command>queryprogram</command> router</secondary>
38901 </indexterm>
38902 </para>
38903 <para>
38904 <indexterm role="option">
38905 <primary><option>command</option></primary>
38906 </indexterm>
38907 </para>
38908 <informaltable frame="all">
38909 <tgroup cols="4" colsep="0" rowsep="0">
38910 <colspec colwidth="8*" align="left"/>
38911 <colspec colwidth="6*" align="center"/>
38912 <colspec colwidth="6*" align="center"/>
38913 <colspec colwidth="6*" align="right"/>
38914 <tbody>
38915 <row>
38916 <entry><option>command</option></entry>
38917 <entry>Use: <emphasis>queryprogram</emphasis></entry>
38918 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38919 <entry>Default: <emphasis>unset</emphasis></entry>
38920 </row>
38921 </tbody>
38922 </tgroup>
38923 </informaltable>
38924 <para>
38925 This option must be set. It specifies the command that is to be run. The
38926 command is split up into a command name and arguments, and then each is
38927 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
38928 <xref linkend="CHAPpipetransport"/>).
38929 </para>
38930 <para>
38931 <indexterm role="option">
38932 <primary><option>command_group</option></primary>
38933 </indexterm>
38934 </para>
38935 <informaltable frame="all">
38936 <tgroup cols="4" colsep="0" rowsep="0">
38937 <colspec colwidth="8*" align="left"/>
38938 <colspec colwidth="6*" align="center"/>
38939 <colspec colwidth="6*" align="center"/>
38940 <colspec colwidth="6*" align="right"/>
38941 <tbody>
38942 <row>
38943 <entry><option>command_group</option></entry>
38944 <entry>Use: <emphasis>queryprogram</emphasis></entry>
38945 <entry>Type: <emphasis>string</emphasis></entry>
38946 <entry>Default: <emphasis>unset</emphasis></entry>
38947 </row>
38948 </tbody>
38949 </tgroup>
38950 </informaltable>
38951 <para>
38952 <indexterm role="concept">
38953 <primary>gid (group id)</primary>
38954 <secondary>in <command>queryprogram</command> router</secondary>
38955 </indexterm>
38956 This option specifies a gid to be set when running the command while routing an
38957 address for deliver. It must be set if <option>command_user</option> specifies a numerical
38958 uid. If it begins with a digit, it is interpreted as the numerical value of the
38959 gid. Otherwise it is looked up using <function>getgrnam()</function>.
38960 </para>
38961 <para>
38962 <indexterm role="option">
38963 <primary><option>command_user</option></primary>
38964 </indexterm>
38965 </para>
38966 <informaltable frame="all">
38967 <tgroup cols="4" colsep="0" rowsep="0">
38968 <colspec colwidth="8*" align="left"/>
38969 <colspec colwidth="6*" align="center"/>
38970 <colspec colwidth="6*" align="center"/>
38971 <colspec colwidth="6*" align="right"/>
38972 <tbody>
38973 <row>
38974 <entry><option>command_user</option></entry>
38975 <entry>Use: <emphasis>queryprogram</emphasis></entry>
38976 <entry>Type: <emphasis>string</emphasis></entry>
38977 <entry>Default: <emphasis>unset</emphasis></entry>
38978 </row>
38979 </tbody>
38980 </tgroup>
38981 </informaltable>
38982 <para>
38983 <indexterm role="concept">
38984 <primary>uid (user id)</primary>
38985 <secondary>for <command>queryprogram</command></secondary>
38986 </indexterm>
38987 This option must be set. It specifies the uid which is set when running the
38988 command while routing an address for delivery. If the value begins with a digit,
38989 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
38990 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
38991 not set, a value for the gid also.
38992 </para>
38993 <para>
38994 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
38995 root, which it does during a normal delivery in a conventional configuration.
38996 However, when an address is being verified during message reception, Exim is
38997 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
38998 is called from a non-root process, Exim cannot change uid or gid before running
38999 the command. In this circumstance the command runs under the current uid and
39000 gid.
39001 </para>
39002 <para>
39003 <indexterm role="option">
39004 <primary><option>current_directory</option></primary>
39005 </indexterm>
39006 </para>
39007 <informaltable frame="all">
39008 <tgroup cols="4" colsep="0" rowsep="0">
39009 <colspec colwidth="8*" align="left"/>
39010 <colspec colwidth="6*" align="center"/>
39011 <colspec colwidth="6*" align="center"/>
39012 <colspec colwidth="6*" align="right"/>
39013 <tbody>
39014 <row>
39015 <entry><option>current_directory</option></entry>
39016 <entry>Use: <emphasis>queryprogram</emphasis></entry>
39017 <entry>Type: <emphasis>string</emphasis></entry>
39018 <entry>Default: <emphasis>/</emphasis></entry>
39019 </row>
39020 </tbody>
39021 </tgroup>
39022 </informaltable>
39023 <para>
39024 This option specifies an absolute path which is made the current directory
39025 before running the command.
39026 </para>
39027 <para>
39028 <indexterm role="option">
39029 <primary><option>timeout</option></primary>
39030 </indexterm>
39031 </para>
39032 <informaltable frame="all">
39033 <tgroup cols="4" colsep="0" rowsep="0">
39034 <colspec colwidth="8*" align="left"/>
39035 <colspec colwidth="6*" align="center"/>
39036 <colspec colwidth="6*" align="center"/>
39037 <colspec colwidth="6*" align="right"/>
39038 <tbody>
39039 <row>
39040 <entry><option>timeout</option></entry>
39041 <entry>Use: <emphasis>queryprogram</emphasis></entry>
39042 <entry>Type: <emphasis>time</emphasis></entry>
39043 <entry>Default: <emphasis>1h</emphasis></entry>
39044 </row>
39045 </tbody>
39046 </tgroup>
39047 </informaltable>
39048 <para>
39049 If the command does not complete within the timeout period, its process group
39050 is killed and the message is frozen. A value of zero time specifies no
39051 timeout.
39052 </para>
39053 <para>
39054 The standard output of the command is connected to a pipe, which is read when
39055 the command terminates. It should consist of a single line of output,
39056 containing up to five fields, separated by white space. The maximum length of
39057 the line is 1023 characters. Longer lines are silently truncated. The first
39058 field is one of the following words (case-insensitive):
39059 </para>
39060 <itemizedlist>
39061 <listitem>
39062 <para>
39063 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
39064 below).
39065 </para>
39066 </listitem>
39067 <listitem>
39068 <para>
39069 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
39070 <option>no_more</option> is set.
39071 </para>
39072 </listitem>
39073 <listitem>
39074 <para>
39075 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
39076 subsequent text on the line is an error message. If the router is run as part
39077 of address verification during an incoming SMTP message, the message is
39078 included in the SMTP response.
39079 </para>
39080 </listitem>
39081 <listitem>
39082 <para>
39083 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
39084 subsequent text on the line is an error message which is logged. It is not
39085 included in any SMTP response.
39086 </para>
39087 </listitem>
39088 <listitem>
39089 <para>
39090 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
39091 </para>
39092 </listitem>
39093 <listitem>
39094 <para>
39095 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
39096 <option>pass_router</option>), overriding <option>no_more</option>.
39097 </para>
39098 </listitem>
39099 <listitem>
39100 <para>
39101 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
39102 new addresses, which are routed independently, starting with the first router,
39103 or the router specified by <option>redirect_router</option>, if set.
39104 </para>
39105 </listitem>
39106 </itemizedlist>
39107 <para>
39108 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
39109 number of keyed data values, as follows (split into two lines here, to fit on
39110 the page):
39111 </para>
39112 <literallayout class="monospaced">
39113 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
39114 LOOKUP=byname|bydns DATA=&lt;text&gt;
39115 </literallayout>
39116 <para>
39117 The data items can be given in any order, and all are optional. If no transport
39118 is included, the transport specified by the generic <option>transport</option> option is
39119 used. The list of hosts and the lookup type are needed only if the transport is
39120 an <command>smtp</command> transport that does not itself supply a list of hosts.
39121 </para>
39122 <para>
39123 The format of the list of hosts is the same as for the <command>manualroute</command> router.
39124 As well as host names and IP addresses with optional port numbers, as described
39125 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
39126 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
39127 (see section <xref linkend="SECThostshowused"/>).
39128 </para>
39129 <para>
39130 If the lookup type is not specified, Exim behaves as follows when trying to
39131 find an IP address for each host: First, a DNS lookup is done. If this yields
39132 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
39133 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
39134 result of the lookup is the result of that call.
39135 </para>
39136 <para>
39137 <indexterm role="variable">
39138 <primary><varname>$address_data</varname></primary>
39139 </indexterm>
39140 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
39141 variable. For example, this return line
39142 </para>
39143 <literallayout class="monospaced">
39144 accept hosts=x1.y.example:x2.y.example data="rule1"
39145 </literallayout>
39146 <para>
39147 routes the address to the default transport, passing a list of two hosts. When
39148 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
39149 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
39150 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
39151 </para>
39152 </chapter>
39153
39154 <chapter id="CHAPredirect">
39155 <title>The redirect router</title>
39156 <para>
39157 <indexterm role="concept" id="IIDredrou1" class="startofrange">
39158 <primary><command>redirect</command> router</primary>
39159 </indexterm>
39160 <indexterm role="concept" id="IIDredrou2" class="startofrange">
39161 <primary>routers</primary>
39162 <secondary><command>redirect</command></secondary>
39163 </indexterm>
39164 <indexterm role="concept">
39165 <primary>alias file</primary>
39166 <secondary>in a <command>redirect</command> router</secondary>
39167 </indexterm>
39168 <indexterm role="concept">
39169 <primary>address redirection</primary>
39170 <secondary><command>redirect</command> router</secondary>
39171 </indexterm>
39172 The <command>redirect</command> router handles several kinds of address redirection. Its most
39173 common uses are for resolving local part aliases from a central alias file
39174 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
39175 files, but it has many other potential uses. The incoming address can be
39176 redirected in several different ways:
39177 </para>
39178 <itemizedlist>
39179 <listitem>
39180 <para>
39181 It can be replaced by one or more new addresses which are themselves routed
39182 independently.
39183 </para>
39184 </listitem>
39185 <listitem>
39186 <para>
39187 It can be routed to be delivered to a given file or directory.
39188 </para>
39189 </listitem>
39190 <listitem>
39191 <para>
39192 It can be routed to be delivered to a specified pipe command.
39193 </para>
39194 </listitem>
39195 <listitem>
39196 <para>
39197 It can cause an automatic reply to be generated.
39198 </para>
39199 </listitem>
39200 <listitem>
39201 <para>
39202 It can be forced to fail, optionally with a custom error message.
39203 </para>
39204 </listitem>
39205 <listitem>
39206 <para>
39207 It can be temporarily deferred, optionally with a custom message.
39208 </para>
39209 </listitem>
39210 <listitem>
39211 <para>
39212 It can be discarded.
39213 </para>
39214 </listitem>
39215 </itemizedlist>
39216 <para>
39217 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
39218 However, there are some private options which define transports for delivery to
39219 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
39220 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
39221 </para>
39222 <para>
39223 If success DSNs have been requested
39224 <indexterm role="concept">
39225 <primary>DSN</primary>
39226 <secondary>success</secondary>
39227 </indexterm>
39228 <indexterm role="concept">
39229 <primary>Delivery Status Notification</primary>
39230 <secondary>success</secondary>
39231 </indexterm>
39232 redirection triggers one and the DSN options are not passed any further.
39233 </para>
39234 <section id="SECID124">
39235 <title>Redirection data</title>
39236 <para>
39237 The router operates by interpreting a text string which it obtains either by
39238 expanding the contents of the <option>data</option> option, or by reading the entire
39239 contents of a file whose name is given in the <option>file</option> option. These two
39240 options are mutually exclusive. The first is commonly used for handling system
39241 aliases, in a configuration like this:
39242 </para>
39243 <literallayout class="monospaced">
39244 system_aliases:
39245   driver = redirect
39246   data = ${lookup{$local_part}lsearch{/etc/aliases}}
39247 </literallayout>
39248 <para>
39249 If the lookup fails, the expanded string in this example is empty. When the
39250 expansion of <option>data</option> results in an empty string, the router declines. A forced
39251 expansion failure also causes the router to decline; other expansion failures
39252 cause delivery to be deferred.
39253 </para>
39254 <para>
39255 A configuration using <option>file</option> is commonly used for handling users&#x2019;
39256 <filename>.forward</filename> files, like this:
39257 </para>
39258 <literallayout class="monospaced">
39259 userforward:
39260   driver = redirect
39261   check_local_user
39262   file = $home/.forward
39263   no_verify
39264 </literallayout>
39265 <para>
39266 If the file does not exist, or causes no action to be taken (for example, it is
39267 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
39268 is not the case when the file contains syntactically valid items that happen to
39269 yield empty addresses, for example, items containing only RFC 2822 address
39270 comments.
39271 </para>
39272 <para revisionflag="changed">
39273 <indexterm role="concept">
39274 <primary>tainted data</primary>
39275 <secondary>in filenames</secondary>
39276 </indexterm>
39277 <indexterm role="concept">
39278 <primary>redirect</primary>
39279 <secondary>tainted data</secondary>
39280 </indexterm>
39281 Tainted data may not be used for a filename.
39282 </para>
39283 <para revisionflag="changed">
39284 <emphasis role="bold">Warning</emphasis>: It is unwise to use <varname>$local_part</varname> or <varname>$domain</varname>
39285 directly for redirection,
39286 as they are provided by a potential attacker.
39287 In the examples above, <varname>$local_part</varname> is used for looking up data held locally
39288 on the system, and not used directly (the second example derives <varname>$home</varname> via
39289 the passsword file or database, using <varname>$local_part</varname>).
39290 </para>
39291 </section>
39292 <section id="SECID125">
39293 <title>Forward files and address verification</title>
39294 <para>
39295 <indexterm role="concept">
39296 <primary>address redirection</primary>
39297 <secondary>while verifying</secondary>
39298 </indexterm>
39299 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
39300 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
39301 </para>
39302 <itemizedlist>
39303 <listitem>
39304 <para>
39305 When Exim is receiving an incoming SMTP message from a remote host, it is
39306 running under the Exim uid, not as root. Exim is unable to change uid to read
39307 the file as the user, and it may not be able to read it as the Exim user. So in
39308 practice the router may not be able to operate.
39309 </para>
39310 </listitem>
39311 <listitem>
39312 <para>
39313 However, even when the router can operate, the existence of a <filename>.forward</filename> file
39314 is unimportant when verifying an address. What should be checked is whether the
39315 local part is a valid user name or not. Cutting out the redirection processing
39316 saves some resources.
39317 </para>
39318 </listitem>
39319 </itemizedlist>
39320 </section>
39321 <section id="SECID126">
39322 <title>Interpreting redirection data</title>
39323 <para>
39324 <indexterm role="concept">
39325 <primary>Sieve filter</primary>
39326 <secondary>specifying in redirection data</secondary>
39327 </indexterm>
39328 <indexterm role="concept">
39329 <primary>filter</primary>
39330 <secondary>specifying in redirection data</secondary>
39331 </indexterm>
39332 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
39333 can be interpreted in two different ways:
39334 </para>
39335 <itemizedlist>
39336 <listitem>
39337 <para>
39338 If the <option>allow_filter</option> option is set true, and the data begins with the text
39339 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
39340 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
39341 respectively. Details of the syntax and semantics of filter files are described
39342 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
39343 document is intended for use by end users.
39344 </para>
39345 </listitem>
39346 <listitem>
39347 <para>
39348 Otherwise, the data must be a comma-separated list of redirection items, as
39349 described in the next section.
39350 </para>
39351 </listitem>
39352 </itemizedlist>
39353 <para>
39354 When a message is redirected to a file (a <quote>mail folder</quote>), the filename given
39355 in a non-filter redirection list must always be an absolute path. A filter may
39356 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
39357 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
39358 for the <command>appendfile</command> transport.
39359 </para>
39360 </section>
39361 <section id="SECTitenonfilred">
39362 <title>Items in a non-filter redirection list</title>
39363 <para>
39364 <indexterm role="concept">
39365 <primary>address redirection</primary>
39366 <secondary>non-filter list items</secondary>
39367 </indexterm>
39368 When the redirection data is not an Exim or Sieve filter, for example, if it
39369 comes from a conventional alias or forward file, it consists of a list of
39370 addresses, filenames, pipe commands, or certain special items (see section
39371 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
39372 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
39373 depending on their default values. The items in the list are separated by
39374 commas or newlines.
39375 If a comma is required in an item, the entire item must be enclosed in double
39376 quotes.
39377 </para>
39378 <para>
39379 Lines starting with a # character are comments, and are ignored, and # may
39380 also appear following a comma, in which case everything between the # and the
39381 next newline character is ignored.
39382 </para>
39383 <para>
39384 If an item is entirely enclosed in double quotes, these are removed. Otherwise
39385 double quotes are retained because some forms of mail address require their use
39386 (but never to enclose the entire address). In the following description,
39387 <quote>item</quote> refers to what remains after any surrounding double quotes have been
39388 removed.
39389 </para>
39390 <para>
39391 <indexterm role="variable">
39392 <primary><varname>$local_part</varname></primary>
39393 </indexterm>
39394 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
39395 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
39396 of the <option>quote_local_part</option> expansion operator, in case the local part contains
39397 special characters. For example, to redirect all mail for the domain
39398 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
39399 setting:
39400 </para>
39401 <literallayout class="monospaced">
39402 data = ${quote_local_part:$local_part}@newdomain.example
39403 </literallayout>
39404 </section>
39405 <section id="SECTredlocmai">
39406 <title>Redirecting to a local mailbox</title>
39407 <para>
39408 <indexterm role="concept">
39409 <primary>routing</primary>
39410 <secondary>loops in</secondary>
39411 </indexterm>
39412 <indexterm role="concept">
39413 <primary>loop</primary>
39414 <secondary>while routing, avoidance of</secondary>
39415 </indexterm>
39416 <indexterm role="concept">
39417 <primary>address redirection</primary>
39418 <secondary>to local mailbox</secondary>
39419 </indexterm>
39420 A redirection item may safely be the same as the address currently under
39421 consideration. This does not cause a routing loop, because a router is
39422 automatically skipped if any ancestor of the address that is being processed
39423 is the same as the current address and was processed by the current router.
39424 Such an address is therefore passed to the following routers, so it is handled
39425 as if there were no redirection. When making this loop-avoidance test, the
39426 complete local part, including any prefix or suffix, is used.
39427 </para>
39428 <para>
39429 <indexterm role="concept">
39430 <primary>address redirection</primary>
39431 <secondary>local part without domain</secondary>
39432 </indexterm>
39433 Specifying the same local part without a domain is a common usage in personal
39434 filter files when the user wants to have messages delivered to the local
39435 mailbox and also forwarded elsewhere. For example, the user whose login is
39436 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
39437 </para>
39438 <literallayout class="monospaced">
39439 cleo, cleopatra@egypt.example
39440 </literallayout>
39441 <para>
39442 <indexterm role="concept">
39443 <primary>backslash in alias file</primary>
39444 </indexterm>
39445 <indexterm role="concept">
39446 <primary>alias file</primary>
39447 <secondary>backslash in</secondary>
39448 </indexterm>
39449 For compatibility with other MTAs, such unqualified local parts may be
39450 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
39451 it does make a difference if more than one domain is being handled
39452 synonymously.
39453 </para>
39454 <para>
39455 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
39456 2822 address that does not include a domain, the item is qualified using the
39457 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
39458 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
39459 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
39460 </para>
39461 <para>
39462 Care must be taken if there are alias names for local users.
39463 Consider an MTA handling a single local domain where the system alias file
39464 contains:
39465 </para>
39466 <literallayout class="monospaced">
39467 Sam.Reman: spqr
39468 </literallayout>
39469 <para>
39470 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
39471 messages in the local mailbox, and also forward copies elsewhere. He creates
39472 this forward file:
39473 </para>
39474 <literallayout class="monospaced">
39475 Sam.Reman, spqr@reme.elsewhere.example
39476 </literallayout>
39477 <para>
39478 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
39479 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
39480 second time round, because it has previously routed it,
39481 and the following routers presumably cannot handle the alias. The forward file
39482 should really contain
39483 </para>
39484 <literallayout class="monospaced">
39485 spqr, spqr@reme.elsewhere.example
39486 </literallayout>
39487 <para>
39488 but because this is such a common error, the <option>check_ancestor</option> option (see
39489 below) exists to provide a way to get round it. This is normally set on a
39490 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
39491 </para>
39492 </section>
39493 <section id="SECTspecitredli">
39494 <title>Special items in redirection lists</title>
39495 <para>
39496 In addition to addresses, the following types of item may appear in redirection
39497 lists (that is, in non-filter redirection data):
39498 </para>
39499 <itemizedlist>
39500 <listitem>
39501 <para>
39502 <indexterm role="concept">
39503 <primary>pipe</primary>
39504 <secondary>in redirection list</secondary>
39505 </indexterm>
39506 <indexterm role="concept">
39507 <primary>address redirection</primary>
39508 <secondary>to pipe</secondary>
39509 </indexterm>
39510 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
39511 as a valid RFC 2822 address that includes a domain. A transport for running the
39512 command must be specified by the <option>pipe_transport</option> option.
39513 Normally, either the router or the transport specifies a user and a group under
39514 which to run the delivery. The default is to use the Exim user and group.
39515 </para>
39516 <para>
39517 Single or double quotes can be used for enclosing the individual arguments of
39518 the pipe command; no interpretation of escapes is done for single quotes. If
39519 the command contains a comma character, it is necessary to put the whole item
39520 in double quotes, for example:
39521 </para>
39522 <literallayout class="monospaced">
39523 "|/some/command ready,steady,go"
39524 </literallayout>
39525 <para>
39526 since items in redirection lists are terminated by commas. Do not, however,
39527 quote just the command. An item such as
39528 </para>
39529 <literallayout class="monospaced">
39530 |"/some/command ready,steady,go"
39531 </literallayout>
39532 <para>
39533 is interpreted as a pipe with a rather strange command name, and no arguments.
39534 </para>
39535 <para>
39536 Note that the above example assumes that the text comes from a lookup source
39537 of some sort, so that the quotes are part of the data.  If composing a
39538 redirect router with a <option>data</option> option directly specifying this command, the
39539 quotes will be used by the configuration parser to define the extent of one
39540 string, but will not be passed down into the redirect router itself.  There
39541 are two main approaches to get around this: escape quotes to be part of the
39542 data itself, or avoid using this mechanism and instead create a custom
39543 transport with the <option>command</option> option set and reference that transport from
39544 an <option>accept</option> router.
39545 </para>
39546 </listitem>
39547 <listitem>
39548 <para>
39549 <indexterm role="concept">
39550 <primary>file</primary>
39551 <secondary>in redirection list</secondary>
39552 </indexterm>
39553 <indexterm role="concept">
39554 <primary>address redirection</primary>
39555 <secondary>to file</secondary>
39556 </indexterm>
39557 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
39558 parse as a valid RFC 2822 address that includes a domain. For example,
39559 </para>
39560 <literallayout class="monospaced">
39561 /home/world/minbari
39562 </literallayout>
39563 <para>
39564 is treated as a filename, but
39565 </para>
39566 <literallayout class="monospaced">
39567 /s=molari/o=babylon/@x400gate.way
39568 </literallayout>
39569 <para>
39570 is treated as an address. For a filename, a transport must be specified using
39571 the <option>file_transport</option> option. However, if the generated path name ends with a
39572 forward slash character, it is interpreted as a directory name rather than a
39573 filename, and <option>directory_transport</option> is used instead.
39574 </para>
39575 <para>
39576 Normally, either the router or the transport specifies a user and a group under
39577 which to run the delivery. The default is to use the Exim user and group.
39578 </para>
39579 <para>
39580 <indexterm role="concept">
39581 <primary><filename>/dev/null</filename></primary>
39582 </indexterm>
39583 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
39584 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
39585 instead of a transport name. In this case the user and group are not used.
39586 </para>
39587 </listitem>
39588 <listitem>
39589 <para>
39590 <indexterm role="concept">
39591 <primary>included address list</primary>
39592 </indexterm>
39593 <indexterm role="concept">
39594 <primary>address redirection</primary>
39595 <secondary>included external list</secondary>
39596 </indexterm>
39597 If an item is of the form
39598 </para>
39599 <literallayout class="monospaced">
39600 :include:&lt;path name&gt;
39601 </literallayout>
39602 <para>
39603 a list of further items is taken from the given file and included at that
39604 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
39605 out-of-line addition to the list. The items in the included list are separated
39606 by commas or newlines and are not subject to expansion. If this is the first
39607 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
39608 the alias name. This example is incorrect:
39609 </para>
39610 <literallayout class="monospaced">
39611 list1    :include:/opt/lists/list1
39612 </literallayout>
39613 <para>
39614 It must be given as
39615 </para>
39616 <literallayout class="monospaced">
39617 list1:   :include:/opt/lists/list1
39618 </literallayout>
39619 <para revisionflag="changed">
39620 <indexterm role="concept">
39621 <primary>tainted data</primary>
39622 <secondary>in filenames</secondary>
39623 </indexterm>
39624 <indexterm role="concept">
39625 <primary>redirect</primary>
39626 <secondary>tainted data</secondary>
39627 </indexterm>
39628 Tainted data may not be used for a filename.
39629 </para>
39630 </listitem>
39631 <listitem>
39632 <para>
39633 <indexterm role="concept">
39634 <primary>address redirection</primary>
39635 <secondary>to black hole</secondary>
39636 </indexterm>
39637 <indexterm role="concept">
39638 <primary>delivery</primary>
39639 <secondary>discard</secondary>
39640 </indexterm>
39641 <indexterm role="concept">
39642 <primary>delivery</primary>
39643 <secondary>blackhole</secondary>
39644 </indexterm>
39645 <indexterm role="concept">
39646 <primary>black hole</primary>
39647 </indexterm>
39648 <indexterm role="concept">
39649 <primary>abandoning mail</primary>
39650 </indexterm>
39651 Sometimes you want to throw away mail to a particular local part.  Making the
39652 <option>data</option> option expand to an empty string does not work, because that causes
39653 the router to decline. Instead, the alias item
39654 </para>
39655 <literallayout class="monospaced">
39656 :blackhole:
39657 </literallayout>
39658 <para>
39659 can be used. It does what its name implies. No delivery is
39660 done, and no error message is generated. This has the same effect as specifying
39661 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
39662 </para>
39663 <para>
39664 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
39665 delivery is done for the original local part, even if other redirection items
39666 are present. If you are generating a multi-item list (for example, by reading a
39667 database) and need the ability to provide a no-op item, you must use
39668 <filename>/dev/null</filename>.
39669 </para>
39670 </listitem>
39671 <listitem>
39672 <para>
39673 <indexterm role="concept">
39674 <primary>delivery</primary>
39675 <secondary>forcing failure</secondary>
39676 </indexterm>
39677 <indexterm role="concept">
39678 <primary>delivery</primary>
39679 <secondary>forcing deferral</secondary>
39680 </indexterm>
39681 <indexterm role="concept">
39682 <primary>failing delivery</primary>
39683 <secondary>forcing</secondary>
39684 </indexterm>
39685 <indexterm role="concept">
39686 <primary>deferred delivery, forcing</primary>
39687 </indexterm>
39688 <indexterm role="concept">
39689 <primary>customizing</primary>
39690 <secondary>failure message</secondary>
39691 </indexterm>
39692 An attempt to deliver a particular address can be deferred or forced to fail by
39693 redirection items of the form
39694 </para>
39695 <literallayout class="monospaced">
39696 :defer:
39697 :fail:
39698 </literallayout>
39699 <para>
39700 respectively. When a redirection list contains such an item, it applies
39701 to the entire redirection; any other items in the list are ignored. Any
39702 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
39703 associated with the failure. For example, an alias file might contain:
39704 </para>
39705 <literallayout class="monospaced">
39706 X.Employee:  :fail: Gone away, no forwarding address
39707 </literallayout>
39708 <para>
39709 In the case of an address that is being verified from an ACL or as the subject
39710 of a
39711 <indexterm role="concept">
39712 <primary>VRFY</primary>
39713 <secondary>error text, display of</secondary>
39714 </indexterm>
39715 VRFY command, the text is included in the SMTP error response by
39716 default.
39717 <indexterm role="concept">
39718 <primary>EXPN</primary>
39719 <secondary>error text, display of</secondary>
39720 </indexterm>
39721 The text is not included in the response to an EXPN command. In non-SMTP cases
39722 the text is included in the error message that Exim generates.
39723 </para>
39724 <para>
39725 <indexterm role="concept">
39726 <primary>SMTP</primary>
39727 <secondary>error codes</secondary>
39728 </indexterm>
39729 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
39730 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
39731 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
39732 followed by a space, and the very first digit is the same as the default error
39733 code, the code from the message is used instead. If the very first digit is
39734 incorrect, a panic error is logged, and the default code is used. You can
39735 suppress the use of the supplied code in a redirect router by setting the
39736 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
39737 ignored.
39738 </para>
39739 <para>
39740 <indexterm role="variable">
39741 <primary><varname>$acl_verify_message</varname></primary>
39742 </indexterm>
39743 In an ACL, an explicitly provided message overrides the default, but the
39744 default message is available in the variable <varname>$acl_verify_message</varname> and can
39745 therefore be included in a custom message if this is desired.
39746 </para>
39747 <para>
39748 Normally the error text is the rest of the redirection list &ndash; a comma does
39749 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
39750 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
39751 as part of the continuation process, but they may exist in other kinds of
39752 lookup and in <emphasis>:include:</emphasis> files.
39753 </para>
39754 <para>
39755 During routing for message delivery (as opposed to verification), a redirection
39756 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
39757 whereas <emphasis>:defer:</emphasis> causes the message to remain in the queue so that a
39758 subsequent delivery attempt can happen at a later time. If an address is
39759 deferred for too long, it will ultimately fail, because the normal retry
39760 rules still apply.
39761 </para>
39762 </listitem>
39763 <listitem>
39764 <para>
39765 <indexterm role="concept">
39766 <primary>alias file</primary>
39767 <secondary>exception to default</secondary>
39768 </indexterm>
39769 Sometimes it is useful to use a single-key search type with a default (see
39770 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
39771 for exceptions to the default. These can be handled by aliasing them to
39772 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
39773 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
39774 results in an empty redirection list has the same effect.
39775 </para>
39776 </listitem>
39777 </itemizedlist>
39778 </section>
39779 <section id="SECTdupaddr">
39780 <title>Duplicate addresses</title>
39781 <para>
39782 <indexterm role="concept">
39783 <primary>duplicate addresses</primary>
39784 </indexterm>
39785 <indexterm role="concept">
39786 <primary>address duplicate, discarding</primary>
39787 </indexterm>
39788 <indexterm role="concept">
39789 <primary>pipe</primary>
39790 <secondary>duplicated</secondary>
39791 </indexterm>
39792 Exim removes duplicate addresses from the list to which it is delivering, so as
39793 to deliver just one copy to each address. This does not apply to deliveries
39794 routed to pipes by different immediate parent addresses, but an indirect
39795 aliasing scheme of the type
39796 </para>
39797 <literallayout class="monospaced">
39798 pipe:       |/some/command $local_part
39799 localpart1: pipe
39800 localpart2: pipe
39801 </literallayout>
39802 <para>
39803 does not work with a message that is addressed to both local parts, because
39804 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
39805 discarded as being the same as a previously handled address. However, a scheme
39806 such as
39807 </para>
39808 <literallayout class="monospaced">
39809 localpart1: |/some/command $local_part
39810 localpart2: |/some/command $local_part
39811 </literallayout>
39812 <para>
39813 does result in two different pipe deliveries, because the immediate parents of
39814 the pipes are distinct.
39815 </para>
39816 </section>
39817 <section id="SECID128">
39818 <title>Repeated redirection expansion</title>
39819 <para>
39820 <indexterm role="concept">
39821 <primary>repeated redirection expansion</primary>
39822 </indexterm>
39823 <indexterm role="concept">
39824 <primary>address redirection</primary>
39825 <secondary>repeated for each delivery attempt</secondary>
39826 </indexterm>
39827 When a message cannot be delivered to all of its recipients immediately,
39828 leading to two or more delivery attempts, redirection expansion is carried out
39829 afresh each time for those addresses whose children were not all previously
39830 delivered. If redirection is being used as a mailing list, this can lead to new
39831 members of the list receiving copies of old messages. The <option>one_time</option> option
39832 can be used to avoid this.
39833 </para>
39834 </section>
39835 <section id="SECID129">
39836 <title>Errors in redirection lists</title>
39837 <para>
39838 <indexterm role="concept">
39839 <primary>address redirection</primary>
39840 <secondary>errors</secondary>
39841 </indexterm>
39842 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
39843 error is skipped, and an entry is written to the main log. This may be useful
39844 for mailing lists that are automatically managed. Otherwise, if an error is
39845 detected while generating the list of new addresses, the original address is
39846 deferred. See also <option>syntax_errors_to</option>.
39847 </para>
39848 </section>
39849 <section id="SECID130">
39850 <title>Private options for the redirect router</title>
39851 <para>
39852 <indexterm role="concept">
39853 <primary>options</primary>
39854 <secondary><command>redirect</command> router</secondary>
39855 </indexterm>
39856 The private options for the <command>redirect</command> router are as follows:
39857 </para>
39858 <para>
39859 <indexterm role="option">
39860 <primary><option>allow_defer</option></primary>
39861 </indexterm>
39862 </para>
39863 <informaltable frame="all">
39864 <tgroup cols="4" colsep="0" rowsep="0">
39865 <colspec colwidth="8*" align="left"/>
39866 <colspec colwidth="6*" align="center"/>
39867 <colspec colwidth="6*" align="center"/>
39868 <colspec colwidth="6*" align="right"/>
39869 <tbody>
39870 <row>
39871 <entry><option>allow_defer</option></entry>
39872 <entry>Use: <emphasis>redirect</emphasis></entry>
39873 <entry>Type: <emphasis>boolean</emphasis></entry>
39874 <entry>Default: <emphasis>false</emphasis></entry>
39875 </row>
39876 </tbody>
39877 </tgroup>
39878 </informaltable>
39879 <para>
39880 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
39881 data, or the <option>defer</option> command in an Exim filter file.
39882 </para>
39883 <para>
39884 <indexterm role="option">
39885 <primary><option>allow_fail</option></primary>
39886 </indexterm>
39887 </para>
39888 <informaltable frame="all">
39889 <tgroup cols="4" colsep="0" rowsep="0">
39890 <colspec colwidth="8*" align="left"/>
39891 <colspec colwidth="6*" align="center"/>
39892 <colspec colwidth="6*" align="center"/>
39893 <colspec colwidth="6*" align="right"/>
39894 <tbody>
39895 <row>
39896 <entry><option>allow_fail</option></entry>
39897 <entry>Use: <emphasis>redirect</emphasis></entry>
39898 <entry>Type: <emphasis>boolean</emphasis></entry>
39899 <entry>Default: <emphasis>false</emphasis></entry>
39900 </row>
39901 </tbody>
39902 </tgroup>
39903 </informaltable>
39904 <para>
39905 <indexterm role="concept">
39906 <primary>failing delivery</primary>
39907 <secondary>from filter</secondary>
39908 </indexterm>
39909 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
39910 and the <option>fail</option> command may be used in an Exim filter file.
39911 </para>
39912 <para>
39913 <indexterm role="option">
39914 <primary><option>allow_filter</option></primary>
39915 </indexterm>
39916 </para>
39917 <informaltable frame="all">
39918 <tgroup cols="4" colsep="0" rowsep="0">
39919 <colspec colwidth="8*" align="left"/>
39920 <colspec colwidth="6*" align="center"/>
39921 <colspec colwidth="6*" align="center"/>
39922 <colspec colwidth="6*" align="right"/>
39923 <tbody>
39924 <row>
39925 <entry><option>allow_filter</option></entry>
39926 <entry>Use: <emphasis>redirect</emphasis></entry>
39927 <entry>Type: <emphasis>boolean</emphasis></entry>
39928 <entry>Default: <emphasis>false</emphasis></entry>
39929 </row>
39930 </tbody>
39931 </tgroup>
39932 </informaltable>
39933 <para>
39934 <indexterm role="concept">
39935 <primary>filter</primary>
39936 <secondary>enabling use of</secondary>
39937 </indexterm>
39938 <indexterm role="concept">
39939 <primary>Sieve filter</primary>
39940 <secondary>enabling use of</secondary>
39941 </indexterm>
39942 Setting this option allows Exim to interpret redirection data that starts with
39943 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
39944 are some features of Exim filter files that some administrators may wish to
39945 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
39946 </para>
39947 <para>
39948 It is also possible to lock out Exim filters or Sieve filters while allowing
39949 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
39950 </para>
39951 <para>
39952 The filter is run using the uid and gid set by the generic <option>user</option> and
39953 <option>group</option> options. These take their defaults from the password data if
39954 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
39955 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
39956 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
39957 </para>
39958 <para>
39959 <indexterm role="option">
39960 <primary><option>allow_freeze</option></primary>
39961 </indexterm>
39962 </para>
39963 <informaltable frame="all">
39964 <tgroup cols="4" colsep="0" rowsep="0">
39965 <colspec colwidth="8*" align="left"/>
39966 <colspec colwidth="6*" align="center"/>
39967 <colspec colwidth="6*" align="center"/>
39968 <colspec colwidth="6*" align="right"/>
39969 <tbody>
39970 <row>
39971 <entry><option>allow_freeze</option></entry>
39972 <entry>Use: <emphasis>redirect</emphasis></entry>
39973 <entry>Type: <emphasis>boolean</emphasis></entry>
39974 <entry>Default: <emphasis>false</emphasis></entry>
39975 </row>
39976 </tbody>
39977 </tgroup>
39978 </informaltable>
39979 <para>
39980 <indexterm role="concept">
39981 <primary>freezing messages</primary>
39982 <secondary>allowing in filter</secondary>
39983 </indexterm>
39984 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
39985 This command is more normally encountered in system filters, and is disabled by
39986 default for redirection filters because it isn&#x2019;t something you usually want to
39987 let ordinary users do.
39988 </para>
39989 <para>
39990 <indexterm role="option">
39991 <primary><option>check_ancestor</option></primary>
39992 </indexterm>
39993 </para>
39994 <informaltable frame="all">
39995 <tgroup cols="4" colsep="0" rowsep="0">
39996 <colspec colwidth="8*" align="left"/>
39997 <colspec colwidth="6*" align="center"/>
39998 <colspec colwidth="6*" align="center"/>
39999 <colspec colwidth="6*" align="right"/>
40000 <tbody>
40001 <row>
40002 <entry><option>check_ancestor</option></entry>
40003 <entry>Use: <emphasis>redirect</emphasis></entry>
40004 <entry>Type: <emphasis>boolean</emphasis></entry>
40005 <entry>Default: <emphasis>false</emphasis></entry>
40006 </row>
40007 </tbody>
40008 </tgroup>
40009 </informaltable>
40010 <para>
40011 This option is concerned with handling generated addresses that are the same
40012 as some address in the list of redirection ancestors of the current address.
40013 Although it is turned off by default in the code, it is set in the default
40014 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
40015 for this use of the <command>redirect</command> router.
40016 </para>
40017 <para>
40018 When <option>check_ancestor</option> is set, if a generated address (including the domain)
40019 is the same as any ancestor of the current address, it is replaced by a copy of
40020 the current address. This helps in the case where local part A is aliased to B,
40021 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
40022 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
40023 <filename>&nbsp;jb/.forward</filename> contains:
40024 </para>
40025 <literallayout class="monospaced">
40026 \Joe.Bloggs, &lt;other item(s)&gt;
40027 </literallayout>
40028 <para>
40029 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
40030 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
40031 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
40032 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
40033 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
40034 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
40035 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
40036 original address. See also the <option>repeat_use</option> option below.
40037 </para>
40038 <para>
40039 <indexterm role="option">
40040 <primary><option>check_group</option></primary>
40041 </indexterm>
40042 </para>
40043 <informaltable frame="all">
40044 <tgroup cols="4" colsep="0" rowsep="0">
40045 <colspec colwidth="8*" align="left"/>
40046 <colspec colwidth="6*" align="center"/>
40047 <colspec colwidth="6*" align="center"/>
40048 <colspec colwidth="6*" align="right"/>
40049 <tbody>
40050 <row>
40051 <entry><option>check_group</option></entry>
40052 <entry>Use: <emphasis>redirect</emphasis></entry>
40053 <entry>Type: <emphasis>boolean</emphasis></entry>
40054 <entry>Default: <emphasis>see below</emphasis></entry>
40055 </row>
40056 </tbody>
40057 </tgroup>
40058 </informaltable>
40059 <para>
40060 When the <option>file</option> option is used, the group owner of the file is checked only
40061 when this option is set. The permitted groups are those listed in the
40062 <option>owngroups</option> option, together with the user&#x2019;s default group if
40063 <option>check_local_user</option> is set. If the file has the wrong group, routing is
40064 deferred. The default setting for this option is true if <option>check_local_user</option>
40065 is set and the <option>modemask</option> option permits the group write bit, or if the
40066 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
40067 </para>
40068 <para>
40069 <indexterm role="option">
40070 <primary><option>check_owner</option></primary>
40071 </indexterm>
40072 </para>
40073 <informaltable frame="all">
40074 <tgroup cols="4" colsep="0" rowsep="0">
40075 <colspec colwidth="8*" align="left"/>
40076 <colspec colwidth="6*" align="center"/>
40077 <colspec colwidth="6*" align="center"/>
40078 <colspec colwidth="6*" align="right"/>
40079 <tbody>
40080 <row>
40081 <entry><option>check_owner</option></entry>
40082 <entry>Use: <emphasis>redirect</emphasis></entry>
40083 <entry>Type: <emphasis>boolean</emphasis></entry>
40084 <entry>Default: <emphasis>see below</emphasis></entry>
40085 </row>
40086 </tbody>
40087 </tgroup>
40088 </informaltable>
40089 <para>
40090 When the <option>file</option> option is used, the owner of the file is checked only when
40091 this option is set. If <option>check_local_user</option> is set, the local user is
40092 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
40093 option. The default value for this option is true if <option>check_local_user</option> or
40094 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
40095 </para>
40096 <para>
40097 <indexterm role="option">
40098 <primary><option>data</option></primary>
40099 </indexterm>
40100 </para>
40101 <informaltable frame="all">
40102 <tgroup cols="4" colsep="0" rowsep="0">
40103 <colspec colwidth="8*" align="left"/>
40104 <colspec colwidth="6*" align="center"/>
40105 <colspec colwidth="6*" align="center"/>
40106 <colspec colwidth="6*" align="right"/>
40107 <tbody>
40108 <row>
40109 <entry><option>data</option></entry>
40110 <entry>Use: <emphasis>redirect</emphasis></entry>
40111 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40112 <entry>Default: <emphasis>unset</emphasis></entry>
40113 </row>
40114 </tbody>
40115 </tgroup>
40116 </informaltable>
40117 <para>
40118 This option is mutually exclusive with <option>file</option>. One or other of them must be
40119 set, but not both. The contents of <option>data</option> are expanded, and then used as the
40120 list of forwarding items, or as a set of filtering instructions. If the
40121 expansion is forced to fail, or the result is an empty string or a string that
40122 has no effect (consists entirely of comments), the router declines.
40123 </para>
40124 <para>
40125 When filtering instructions are used, the string must begin with <quote>#Exim
40126 filter</quote>, and all comments in the string, including this initial one, must be
40127 terminated with newline characters. For example:
40128 </para>
40129 <literallayout class="monospaced">
40130 data = #Exim filter\n\
40131        if $h_to: contains Exim then save $home/mail/exim endif
40132 </literallayout>
40133 <para>
40134 If you are reading the data from a database where newlines cannot be included,
40135 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
40136 choice into a newline.
40137 </para>
40138 <para>
40139 <indexterm role="option">
40140 <primary><option>directory_transport</option></primary>
40141 </indexterm>
40142 </para>
40143 <informaltable frame="all">
40144 <tgroup cols="4" colsep="0" rowsep="0">
40145 <colspec colwidth="8*" align="left"/>
40146 <colspec colwidth="6*" align="center"/>
40147 <colspec colwidth="6*" align="center"/>
40148 <colspec colwidth="6*" align="right"/>
40149 <tbody>
40150 <row>
40151 <entry><option>directory_transport</option></entry>
40152 <entry>Use: <emphasis>redirect</emphasis></entry>
40153 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40154 <entry>Default: <emphasis>unset</emphasis></entry>
40155 </row>
40156 </tbody>
40157 </tgroup>
40158 </informaltable>
40159 <para>
40160 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
40161 ending with a slash is specified as a new <quote>address</quote>. The transport used is
40162 specified by this option, which, after expansion, must be the name of a
40163 configured transport. This should normally be an <command>appendfile</command> transport.
40164 </para>
40165 <para>
40166 <indexterm role="option">
40167 <primary><option>file</option></primary>
40168 </indexterm>
40169 </para>
40170 <informaltable frame="all">
40171 <tgroup cols="4" colsep="0" rowsep="0">
40172 <colspec colwidth="8*" align="left"/>
40173 <colspec colwidth="6*" align="center"/>
40174 <colspec colwidth="6*" align="center"/>
40175 <colspec colwidth="6*" align="right"/>
40176 <tbody>
40177 <row>
40178 <entry><option>file</option></entry>
40179 <entry>Use: <emphasis>redirect</emphasis></entry>
40180 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40181 <entry>Default: <emphasis>unset</emphasis></entry>
40182 </row>
40183 </tbody>
40184 </tgroup>
40185 </informaltable>
40186 <para>
40187 This option specifies the name of a file that contains the redirection data. It
40188 is mutually exclusive with the <option>data</option> option. The string is expanded before
40189 use; if the expansion is forced to fail, the router declines. Other expansion
40190 failures cause delivery to be deferred. The result of a successful expansion
40191 must be an absolute path. The entire file is read and used as the redirection
40192 data. If the data is an empty string or a string that has no effect (consists
40193 entirely of comments), the router declines.
40194 </para>
40195 <para>
40196 <indexterm role="concept">
40197 <primary>NFS</primary>
40198 <secondary>checking for file existence</secondary>
40199 </indexterm>
40200 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
40201 runs a check on the containing directory,
40202 unless <option>ignore_enotdir</option> is true (see below).
40203 If the directory does not appear to exist, delivery is deferred. This can
40204 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
40205 is a mount problem. If the containing directory does exist, but the file does
40206 not, the router declines.
40207 </para>
40208 <para>
40209 <indexterm role="option">
40210 <primary><option>file_transport</option></primary>
40211 </indexterm>
40212 </para>
40213 <informaltable frame="all">
40214 <tgroup cols="4" colsep="0" rowsep="0">
40215 <colspec colwidth="8*" align="left"/>
40216 <colspec colwidth="6*" align="center"/>
40217 <colspec colwidth="6*" align="center"/>
40218 <colspec colwidth="6*" align="right"/>
40219 <tbody>
40220 <row>
40221 <entry><option>file_transport</option></entry>
40222 <entry>Use: <emphasis>redirect</emphasis></entry>
40223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40224 <entry>Default: <emphasis>unset</emphasis></entry>
40225 </row>
40226 </tbody>
40227 </tgroup>
40228 </informaltable>
40229 <para>
40230 <indexterm role="variable">
40231 <primary><varname>$address_file</varname></primary>
40232 </indexterm>
40233 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
40234 ending in a slash is specified as a new <quote>address</quote>. The transport used is
40235 specified by this option, which, after expansion, must be the name of a
40236 configured transport. This should normally be an <command>appendfile</command> transport. When
40237 it is running, the filename is in <varname>$address_file</varname>.
40238 </para>
40239 <para>
40240 <indexterm role="option">
40241 <primary><option>filter_prepend_home</option></primary>
40242 </indexterm>
40243 </para>
40244 <informaltable frame="all">
40245 <tgroup cols="4" colsep="0" rowsep="0">
40246 <colspec colwidth="8*" align="left"/>
40247 <colspec colwidth="6*" align="center"/>
40248 <colspec colwidth="6*" align="center"/>
40249 <colspec colwidth="6*" align="right"/>
40250 <tbody>
40251 <row>
40252 <entry><option>filter_prepend_home</option></entry>
40253 <entry>Use: <emphasis>redirect</emphasis></entry>
40254 <entry>Type: <emphasis>boolean</emphasis></entry>
40255 <entry>Default: <emphasis>true</emphasis></entry>
40256 </row>
40257 </tbody>
40258 </tgroup>
40259 </informaltable>
40260 <para>
40261 When this option is true, if a <command>save</command> command in an Exim filter specifies a
40262 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
40263 relative path. If this option is set false, this action does not happen. The
40264 relative path is then passed to the transport unmodified.
40265 </para>
40266 <para>
40267 <indexterm role="option">
40268 <primary><option>forbid_blackhole</option></primary>
40269 </indexterm>
40270 </para>
40271 <informaltable frame="all">
40272 <tgroup cols="4" colsep="0" rowsep="0">
40273 <colspec colwidth="8*" align="left"/>
40274 <colspec colwidth="6*" align="center"/>
40275 <colspec colwidth="6*" align="center"/>
40276 <colspec colwidth="6*" align="right"/>
40277 <tbody>
40278 <row>
40279 <entry><option>forbid_blackhole</option></entry>
40280 <entry>Use: <emphasis>redirect</emphasis></entry>
40281 <entry>Type: <emphasis>boolean</emphasis></entry>
40282 <entry>Default: <emphasis>false</emphasis></entry>
40283 </row>
40284 </tbody>
40285 </tgroup>
40286 </informaltable>
40287 <para>
40288 <indexterm role="concept">
40289 <primary>restricting access to features</primary>
40290 </indexterm>
40291 <indexterm role="concept">
40292 <primary>filter</primary>
40293 <secondary>locking out certain features</secondary>
40294 </indexterm>
40295 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
40296 redirection list.
40297 </para>
40298 <para>
40299 <indexterm role="option">
40300 <primary><option>forbid_exim_filter</option></primary>
40301 </indexterm>
40302 </para>
40303 <informaltable frame="all">
40304 <tgroup cols="4" colsep="0" rowsep="0">
40305 <colspec colwidth="8*" align="left"/>
40306 <colspec colwidth="6*" align="center"/>
40307 <colspec colwidth="6*" align="center"/>
40308 <colspec colwidth="6*" align="right"/>
40309 <tbody>
40310 <row>
40311 <entry><option>forbid_exim_filter</option></entry>
40312 <entry>Use: <emphasis>redirect</emphasis></entry>
40313 <entry>Type: <emphasis>boolean</emphasis></entry>
40314 <entry>Default: <emphasis>false</emphasis></entry>
40315 </row>
40316 </tbody>
40317 </tgroup>
40318 </informaltable>
40319 <para>
40320 <indexterm role="concept">
40321 <primary>restricting access to features</primary>
40322 </indexterm>
40323 <indexterm role="concept">
40324 <primary>filter</primary>
40325 <secondary>locking out certain features</secondary>
40326 </indexterm>
40327 If this option is set true, only Sieve filters are permitted when
40328 <option>allow_filter</option> is true.
40329 </para>
40330 <para>
40331 <indexterm role="option">
40332 <primary><option>forbid_file</option></primary>
40333 </indexterm>
40334 </para>
40335 <informaltable frame="all">
40336 <tgroup cols="4" colsep="0" rowsep="0">
40337 <colspec colwidth="8*" align="left"/>
40338 <colspec colwidth="6*" align="center"/>
40339 <colspec colwidth="6*" align="center"/>
40340 <colspec colwidth="6*" align="right"/>
40341 <tbody>
40342 <row>
40343 <entry><option>forbid_file</option></entry>
40344 <entry>Use: <emphasis>redirect</emphasis></entry>
40345 <entry>Type: <emphasis>boolean</emphasis></entry>
40346 <entry>Default: <emphasis>false</emphasis></entry>
40347 </row>
40348 </tbody>
40349 </tgroup>
40350 </informaltable>
40351 <para>
40352 <indexterm role="concept">
40353 <primary>restricting access to features</primary>
40354 </indexterm>
40355 <indexterm role="concept">
40356 <primary>delivery</primary>
40357 <secondary>to file; forbidding</secondary>
40358 </indexterm>
40359 <indexterm role="concept">
40360 <primary>filter</primary>
40361 <secondary>locking out certain features</secondary>
40362 </indexterm>
40363 <indexterm role="concept">
40364 <primary>Sieve filter</primary>
40365 <secondary>forbidding delivery to a file</secondary>
40366 </indexterm>
40367 <indexterm role="concept">
40368 <primary>Sieve filter</primary>
40369 <secondary><quote>keep</quote> facility; disabling</secondary>
40370 </indexterm>
40371 If this option is true, this router may not generate a new address that
40372 specifies delivery to a local file or directory, either from a filter or from a
40373 conventional forward file. This option is forced to be true if <option>one_time</option> is
40374 set. It applies to Sieve filters as well as to Exim filters, but if true, it
40375 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
40376 </para>
40377 <para>
40378 <indexterm role="option">
40379 <primary><option>forbid_filter_dlfunc</option></primary>
40380 </indexterm>
40381 </para>
40382 <informaltable frame="all">
40383 <tgroup cols="4" colsep="0" rowsep="0">
40384 <colspec colwidth="8*" align="left"/>
40385 <colspec colwidth="6*" align="center"/>
40386 <colspec colwidth="6*" align="center"/>
40387 <colspec colwidth="6*" align="right"/>
40388 <tbody>
40389 <row>
40390 <entry><option>forbid_filter_dlfunc</option></entry>
40391 <entry>Use: <emphasis>redirect</emphasis></entry>
40392 <entry>Type: <emphasis>boolean</emphasis></entry>
40393 <entry>Default: <emphasis>false</emphasis></entry>
40394 </row>
40395 </tbody>
40396 </tgroup>
40397 </informaltable>
40398 <para>
40399 <indexterm role="concept">
40400 <primary>restricting access to features</primary>
40401 </indexterm>
40402 <indexterm role="concept">
40403 <primary>filter</primary>
40404 <secondary>locking out certain features</secondary>
40405 </indexterm>
40406 If this option is true, string expansions in Exim filters are not allowed to
40407 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
40408 functions.
40409 </para>
40410 <para>
40411 <indexterm role="option">
40412 <primary><option>forbid_filter_existstest</option></primary>
40413 </indexterm>
40414 </para>
40415 <informaltable frame="all">
40416 <tgroup cols="4" colsep="0" rowsep="0">
40417 <colspec colwidth="8*" align="left"/>
40418 <colspec colwidth="6*" align="center"/>
40419 <colspec colwidth="6*" align="center"/>
40420 <colspec colwidth="6*" align="right"/>
40421 <tbody>
40422 <row>
40423 <entry><option>forbid_filter_existstest</option></entry>
40424 <entry>Use: <emphasis>redirect</emphasis></entry>
40425 <entry>Type: <emphasis>boolean</emphasis></entry>
40426 <entry>Default: <emphasis>false</emphasis></entry>
40427 </row>
40428 </tbody>
40429 </tgroup>
40430 </informaltable>
40431 <para>
40432 <indexterm role="concept">
40433 <primary>restricting access to features</primary>
40434 </indexterm>
40435 <indexterm role="concept">
40436 <primary>filter</primary>
40437 <secondary>locking out certain features</secondary>
40438 </indexterm>
40439 <indexterm role="concept">
40440 <primary>expansion</primary>
40441 <secondary>statting a file</secondary>
40442 </indexterm>
40443 If this option is true, string expansions in Exim filters are not allowed to
40444 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
40445 </para>
40446 <para>
40447 <indexterm role="option">
40448 <primary><option>forbid_filter_logwrite</option></primary>
40449 </indexterm>
40450 </para>
40451 <informaltable frame="all">
40452 <tgroup cols="4" colsep="0" rowsep="0">
40453 <colspec colwidth="8*" align="left"/>
40454 <colspec colwidth="6*" align="center"/>
40455 <colspec colwidth="6*" align="center"/>
40456 <colspec colwidth="6*" align="right"/>
40457 <tbody>
40458 <row>
40459 <entry><option>forbid_filter_logwrite</option></entry>
40460 <entry>Use: <emphasis>redirect</emphasis></entry>
40461 <entry>Type: <emphasis>boolean</emphasis></entry>
40462 <entry>Default: <emphasis>false</emphasis></entry>
40463 </row>
40464 </tbody>
40465 </tgroup>
40466 </informaltable>
40467 <para>
40468 <indexterm role="concept">
40469 <primary>restricting access to features</primary>
40470 </indexterm>
40471 <indexterm role="concept">
40472 <primary>filter</primary>
40473 <secondary>locking out certain features</secondary>
40474 </indexterm>
40475 If this option is true, use of the logging facility in Exim filters is not
40476 permitted. Logging is in any case available only if the filter is being run
40477 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
40478 <filename>.forward</filename> files).
40479 </para>
40480 <para>
40481 <indexterm role="option">
40482 <primary><option>forbid_filter_lookup</option></primary>
40483 </indexterm>
40484 </para>
40485 <informaltable frame="all">
40486 <tgroup cols="4" colsep="0" rowsep="0">
40487 <colspec colwidth="8*" align="left"/>
40488 <colspec colwidth="6*" align="center"/>
40489 <colspec colwidth="6*" align="center"/>
40490 <colspec colwidth="6*" align="right"/>
40491 <tbody>
40492 <row>
40493 <entry><option>forbid_filter_lookup</option></entry>
40494 <entry>Use: <emphasis>redirect</emphasis></entry>
40495 <entry>Type: <emphasis>boolean</emphasis></entry>
40496 <entry>Default: <emphasis>false</emphasis></entry>
40497 </row>
40498 </tbody>
40499 </tgroup>
40500 </informaltable>
40501 <para>
40502 <indexterm role="concept">
40503 <primary>restricting access to features</primary>
40504 </indexterm>
40505 <indexterm role="concept">
40506 <primary>filter</primary>
40507 <secondary>locking out certain features</secondary>
40508 </indexterm>
40509 If this option is true, string expansions in Exim filter files are not allowed
40510 to make use of <option>lookup</option> items.
40511 </para>
40512 <para>
40513 <indexterm role="option">
40514 <primary><option>forbid_filter_perl</option></primary>
40515 </indexterm>
40516 </para>
40517 <informaltable frame="all">
40518 <tgroup cols="4" colsep="0" rowsep="0">
40519 <colspec colwidth="8*" align="left"/>
40520 <colspec colwidth="6*" align="center"/>
40521 <colspec colwidth="6*" align="center"/>
40522 <colspec colwidth="6*" align="right"/>
40523 <tbody>
40524 <row>
40525 <entry><option>forbid_filter_perl</option></entry>
40526 <entry>Use: <emphasis>redirect</emphasis></entry>
40527 <entry>Type: <emphasis>boolean</emphasis></entry>
40528 <entry>Default: <emphasis>false</emphasis></entry>
40529 </row>
40530 </tbody>
40531 </tgroup>
40532 </informaltable>
40533 <para>
40534 <indexterm role="concept">
40535 <primary>restricting access to features</primary>
40536 </indexterm>
40537 <indexterm role="concept">
40538 <primary>filter</primary>
40539 <secondary>locking out certain features</secondary>
40540 </indexterm>
40541 This option has an effect only if Exim is built with embedded Perl support. If
40542 it is true, string expansions in Exim filter files are not allowed to make use
40543 of the embedded Perl support.
40544 </para>
40545 <para>
40546 <indexterm role="option">
40547 <primary><option>forbid_filter_readfile</option></primary>
40548 </indexterm>
40549 </para>
40550 <informaltable frame="all">
40551 <tgroup cols="4" colsep="0" rowsep="0">
40552 <colspec colwidth="8*" align="left"/>
40553 <colspec colwidth="6*" align="center"/>
40554 <colspec colwidth="6*" align="center"/>
40555 <colspec colwidth="6*" align="right"/>
40556 <tbody>
40557 <row>
40558 <entry><option>forbid_filter_readfile</option></entry>
40559 <entry>Use: <emphasis>redirect</emphasis></entry>
40560 <entry>Type: <emphasis>boolean</emphasis></entry>
40561 <entry>Default: <emphasis>false</emphasis></entry>
40562 </row>
40563 </tbody>
40564 </tgroup>
40565 </informaltable>
40566 <para>
40567 <indexterm role="concept">
40568 <primary>restricting access to features</primary>
40569 </indexterm>
40570 <indexterm role="concept">
40571 <primary>filter</primary>
40572 <secondary>locking out certain features</secondary>
40573 </indexterm>
40574 If this option is true, string expansions in Exim filter files are not allowed
40575 to make use of <option>readfile</option> items.
40576 </para>
40577 <para>
40578 <indexterm role="option">
40579 <primary><option>forbid_filter_readsocket</option></primary>
40580 </indexterm>
40581 </para>
40582 <informaltable frame="all">
40583 <tgroup cols="4" colsep="0" rowsep="0">
40584 <colspec colwidth="8*" align="left"/>
40585 <colspec colwidth="6*" align="center"/>
40586 <colspec colwidth="6*" align="center"/>
40587 <colspec colwidth="6*" align="right"/>
40588 <tbody>
40589 <row>
40590 <entry><option>forbid_filter_readsocket</option></entry>
40591 <entry>Use: <emphasis>redirect</emphasis></entry>
40592 <entry>Type: <emphasis>boolean</emphasis></entry>
40593 <entry>Default: <emphasis>false</emphasis></entry>
40594 </row>
40595 </tbody>
40596 </tgroup>
40597 </informaltable>
40598 <para>
40599 <indexterm role="concept">
40600 <primary>restricting access to features</primary>
40601 </indexterm>
40602 <indexterm role="concept">
40603 <primary>filter</primary>
40604 <secondary>locking out certain features</secondary>
40605 </indexterm>
40606 If this option is true, string expansions in Exim filter files are not allowed
40607 to make use of <option>readsocket</option> items.
40608 </para>
40609 <para>
40610 <indexterm role="option">
40611 <primary><option>forbid_filter_reply</option></primary>
40612 </indexterm>
40613 </para>
40614 <informaltable frame="all">
40615 <tgroup cols="4" colsep="0" rowsep="0">
40616 <colspec colwidth="8*" align="left"/>
40617 <colspec colwidth="6*" align="center"/>
40618 <colspec colwidth="6*" align="center"/>
40619 <colspec colwidth="6*" align="right"/>
40620 <tbody>
40621 <row>
40622 <entry><option>forbid_filter_reply</option></entry>
40623 <entry>Use: <emphasis>redirect</emphasis></entry>
40624 <entry>Type: <emphasis>boolean</emphasis></entry>
40625 <entry>Default: <emphasis>false</emphasis></entry>
40626 </row>
40627 </tbody>
40628 </tgroup>
40629 </informaltable>
40630 <para>
40631 <indexterm role="concept">
40632 <primary>restricting access to features</primary>
40633 </indexterm>
40634 <indexterm role="concept">
40635 <primary>filter</primary>
40636 <secondary>locking out certain features</secondary>
40637 </indexterm>
40638 If this option is true, this router may not generate an automatic reply
40639 message. Automatic replies can be generated only from Exim or Sieve filter
40640 files, not from traditional forward files. This option is forced to be true if
40641 <option>one_time</option> is set.
40642 </para>
40643 <para>
40644 <indexterm role="option">
40645 <primary><option>forbid_filter_run</option></primary>
40646 </indexterm>
40647 </para>
40648 <informaltable frame="all">
40649 <tgroup cols="4" colsep="0" rowsep="0">
40650 <colspec colwidth="8*" align="left"/>
40651 <colspec colwidth="6*" align="center"/>
40652 <colspec colwidth="6*" align="center"/>
40653 <colspec colwidth="6*" align="right"/>
40654 <tbody>
40655 <row>
40656 <entry><option>forbid_filter_run</option></entry>
40657 <entry>Use: <emphasis>redirect</emphasis></entry>
40658 <entry>Type: <emphasis>boolean</emphasis></entry>
40659 <entry>Default: <emphasis>false</emphasis></entry>
40660 </row>
40661 </tbody>
40662 </tgroup>
40663 </informaltable>
40664 <para>
40665 <indexterm role="concept">
40666 <primary>restricting access to features</primary>
40667 </indexterm>
40668 <indexterm role="concept">
40669 <primary>filter</primary>
40670 <secondary>locking out certain features</secondary>
40671 </indexterm>
40672 If this option is true, string expansions in Exim filter files are not allowed
40673 to make use of <option>run</option> items.
40674 </para>
40675 <para>
40676 <indexterm role="option">
40677 <primary><option>forbid_include</option></primary>
40678 </indexterm>
40679 </para>
40680 <informaltable frame="all">
40681 <tgroup cols="4" colsep="0" rowsep="0">
40682 <colspec colwidth="8*" align="left"/>
40683 <colspec colwidth="6*" align="center"/>
40684 <colspec colwidth="6*" align="center"/>
40685 <colspec colwidth="6*" align="right"/>
40686 <tbody>
40687 <row>
40688 <entry><option>forbid_include</option></entry>
40689 <entry>Use: <emphasis>redirect</emphasis></entry>
40690 <entry>Type: <emphasis>boolean</emphasis></entry>
40691 <entry>Default: <emphasis>false</emphasis></entry>
40692 </row>
40693 </tbody>
40694 </tgroup>
40695 </informaltable>
40696 <para>
40697 <indexterm role="concept">
40698 <primary>restricting access to features</primary>
40699 </indexterm>
40700 <indexterm role="concept">
40701 <primary>filter</primary>
40702 <secondary>locking out certain features</secondary>
40703 </indexterm>
40704 If this option is true, items of the form
40705 </para>
40706 <literallayout class="monospaced">
40707 :include:&lt;path name&gt;
40708 </literallayout>
40709 <para>
40710 are not permitted in non-filter redirection lists.
40711 </para>
40712 <para>
40713 <indexterm role="option">
40714 <primary><option>forbid_pipe</option></primary>
40715 </indexterm>
40716 </para>
40717 <informaltable frame="all">
40718 <tgroup cols="4" colsep="0" rowsep="0">
40719 <colspec colwidth="8*" align="left"/>
40720 <colspec colwidth="6*" align="center"/>
40721 <colspec colwidth="6*" align="center"/>
40722 <colspec colwidth="6*" align="right"/>
40723 <tbody>
40724 <row>
40725 <entry><option>forbid_pipe</option></entry>
40726 <entry>Use: <emphasis>redirect</emphasis></entry>
40727 <entry>Type: <emphasis>boolean</emphasis></entry>
40728 <entry>Default: <emphasis>false</emphasis></entry>
40729 </row>
40730 </tbody>
40731 </tgroup>
40732 </informaltable>
40733 <para>
40734 <indexterm role="concept">
40735 <primary>restricting access to features</primary>
40736 </indexterm>
40737 <indexterm role="concept">
40738 <primary>filter</primary>
40739 <secondary>locking out certain features</secondary>
40740 </indexterm>
40741 <indexterm role="concept">
40742 <primary>delivery</primary>
40743 <secondary>to pipe; forbidding</secondary>
40744 </indexterm>
40745 If this option is true, this router may not generate a new address which
40746 specifies delivery to a pipe, either from an Exim filter or from a conventional
40747 forward file. This option is forced to be true if <option>one_time</option> is set.
40748 </para>
40749 <para>
40750 <indexterm role="option">
40751 <primary><option>forbid_sieve_filter</option></primary>
40752 </indexterm>
40753 </para>
40754 <informaltable frame="all">
40755 <tgroup cols="4" colsep="0" rowsep="0">
40756 <colspec colwidth="8*" align="left"/>
40757 <colspec colwidth="6*" align="center"/>
40758 <colspec colwidth="6*" align="center"/>
40759 <colspec colwidth="6*" align="right"/>
40760 <tbody>
40761 <row>
40762 <entry><option>forbid_sieve_filter</option></entry>
40763 <entry>Use: <emphasis>redirect</emphasis></entry>
40764 <entry>Type: <emphasis>boolean</emphasis></entry>
40765 <entry>Default: <emphasis>false</emphasis></entry>
40766 </row>
40767 </tbody>
40768 </tgroup>
40769 </informaltable>
40770 <para>
40771 <indexterm role="concept">
40772 <primary>restricting access to features</primary>
40773 </indexterm>
40774 <indexterm role="concept">
40775 <primary>filter</primary>
40776 <secondary>locking out certain features</secondary>
40777 </indexterm>
40778 If this option is set true, only Exim filters are permitted when
40779 <option>allow_filter</option> is true.
40780 </para>
40781 <para>
40782 <indexterm role="concept">
40783 <primary>SMTP</primary>
40784 <secondary>error codes</secondary>
40785 </indexterm>
40786 <indexterm role="option">
40787 <primary><option>forbid_smtp_code</option></primary>
40788 </indexterm>
40789 </para>
40790 <informaltable frame="all">
40791 <tgroup cols="4" colsep="0" rowsep="0">
40792 <colspec colwidth="8*" align="left"/>
40793 <colspec colwidth="6*" align="center"/>
40794 <colspec colwidth="6*" align="center"/>
40795 <colspec colwidth="6*" align="right"/>
40796 <tbody>
40797 <row>
40798 <entry><option>forbid_smtp_code</option></entry>
40799 <entry>Use: <emphasis>redirect</emphasis></entry>
40800 <entry>Type: <emphasis>boolean</emphasis></entry>
40801 <entry>Default: <emphasis>false</emphasis></entry>
40802 </row>
40803 </tbody>
40804 </tgroup>
40805 </informaltable>
40806 <para>
40807 If this option is set true, any SMTP error codes that are present at the start
40808 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
40809 the default codes (451 and 550, respectively) are always used.
40810 </para>
40811 <para>
40812 <indexterm role="option">
40813 <primary><option>hide_child_in_errmsg</option></primary>
40814 </indexterm>
40815 </para>
40816 <informaltable frame="all">
40817 <tgroup cols="4" colsep="0" rowsep="0">
40818 <colspec colwidth="8*" align="left"/>
40819 <colspec colwidth="6*" align="center"/>
40820 <colspec colwidth="6*" align="center"/>
40821 <colspec colwidth="6*" align="right"/>
40822 <tbody>
40823 <row>
40824 <entry><option>hide_child_in_errmsg</option></entry>
40825 <entry>Use: <emphasis>redirect</emphasis></entry>
40826 <entry>Type: <emphasis>boolean</emphasis></entry>
40827 <entry>Default: <emphasis>false</emphasis></entry>
40828 </row>
40829 </tbody>
40830 </tgroup>
40831 </informaltable>
40832 <para>
40833 <indexterm role="concept">
40834 <primary>bounce message</primary>
40835 <secondary>redirection details; suppressing</secondary>
40836 </indexterm>
40837 If this option is true, it prevents Exim from quoting a child address if it
40838 generates a bounce or delay message for it. Instead it says <quote>an address
40839 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
40840 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
40841 bounce may well quote the generated address.
40842 </para>
40843 <para>
40844 <indexterm role="option">
40845 <primary><option>ignore_eacces</option></primary>
40846 </indexterm>
40847 </para>
40848 <informaltable frame="all">
40849 <tgroup cols="4" colsep="0" rowsep="0">
40850 <colspec colwidth="8*" align="left"/>
40851 <colspec colwidth="6*" align="center"/>
40852 <colspec colwidth="6*" align="center"/>
40853 <colspec colwidth="6*" align="right"/>
40854 <tbody>
40855 <row>
40856 <entry><option>ignore_eacces</option></entry>
40857 <entry>Use: <emphasis>redirect</emphasis></entry>
40858 <entry>Type: <emphasis>boolean</emphasis></entry>
40859 <entry>Default: <emphasis>false</emphasis></entry>
40860 </row>
40861 </tbody>
40862 </tgroup>
40863 </informaltable>
40864 <para>
40865 <indexterm role="concept">
40866 <primary>EACCES</primary>
40867 </indexterm>
40868 If this option is set and an attempt to open a redirection file yields the
40869 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
40870 file did not exist.
40871 </para>
40872 <para>
40873 <indexterm role="option">
40874 <primary><option>ignore_enotdir</option></primary>
40875 </indexterm>
40876 </para>
40877 <informaltable frame="all">
40878 <tgroup cols="4" colsep="0" rowsep="0">
40879 <colspec colwidth="8*" align="left"/>
40880 <colspec colwidth="6*" align="center"/>
40881 <colspec colwidth="6*" align="center"/>
40882 <colspec colwidth="6*" align="right"/>
40883 <tbody>
40884 <row>
40885 <entry><option>ignore_enotdir</option></entry>
40886 <entry>Use: <emphasis>redirect</emphasis></entry>
40887 <entry>Type: <emphasis>boolean</emphasis></entry>
40888 <entry>Default: <emphasis>false</emphasis></entry>
40889 </row>
40890 </tbody>
40891 </tgroup>
40892 </informaltable>
40893 <para>
40894 <indexterm role="concept">
40895 <primary>ENOTDIR</primary>
40896 </indexterm>
40897 If this option is set and an attempt to open a redirection file yields the
40898 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
40899 router behaves as if the file did not exist.
40900 </para>
40901 <para>
40902 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
40903 router that has the <option>file</option> option set discovers that the file does not exist
40904 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
40905 against unmounted NFS directories. If the parent can not be statted, delivery
40906 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
40907 is set, because that option tells Exim to ignore <quote>something on the path is not
40908 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
40909 that some operating systems give ENOENT where others give ENOTDIR.
40910 </para>
40911 <para>
40912 <indexterm role="option">
40913 <primary><option>include_directory</option></primary>
40914 </indexterm>
40915 </para>
40916 <informaltable frame="all">
40917 <tgroup cols="4" colsep="0" rowsep="0">
40918 <colspec colwidth="8*" align="left"/>
40919 <colspec colwidth="6*" align="center"/>
40920 <colspec colwidth="6*" align="center"/>
40921 <colspec colwidth="6*" align="right"/>
40922 <tbody>
40923 <row>
40924 <entry><option>include_directory</option></entry>
40925 <entry>Use: <emphasis>redirect</emphasis></entry>
40926 <entry>Type: <emphasis>string</emphasis></entry>
40927 <entry>Default: <emphasis>unset</emphasis></entry>
40928 </row>
40929 </tbody>
40930 </tgroup>
40931 </informaltable>
40932 <para>
40933 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
40934 redirection list must start with this directory.
40935 </para>
40936 <para>
40937 <indexterm role="option">
40938 <primary><option>modemask</option></primary>
40939 </indexterm>
40940 </para>
40941 <informaltable frame="all">
40942 <tgroup cols="4" colsep="0" rowsep="0">
40943 <colspec colwidth="8*" align="left"/>
40944 <colspec colwidth="6*" align="center"/>
40945 <colspec colwidth="6*" align="center"/>
40946 <colspec colwidth="6*" align="right"/>
40947 <tbody>
40948 <row>
40949 <entry><option>modemask</option></entry>
40950 <entry>Use: <emphasis>redirect</emphasis></entry>
40951 <entry>Type: <emphasis>octal integer</emphasis></entry>
40952 <entry>Default: <emphasis>022</emphasis></entry>
40953 </row>
40954 </tbody>
40955 </tgroup>
40956 </informaltable>
40957 <para>
40958 This specifies mode bits which must not be set for a file specified by the
40959 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
40960 </para>
40961 <para>
40962 <indexterm role="option">
40963 <primary><option>one_time</option></primary>
40964 </indexterm>
40965 </para>
40966 <informaltable frame="all">
40967 <tgroup cols="4" colsep="0" rowsep="0">
40968 <colspec colwidth="8*" align="left"/>
40969 <colspec colwidth="6*" align="center"/>
40970 <colspec colwidth="6*" align="center"/>
40971 <colspec colwidth="6*" align="right"/>
40972 <tbody>
40973 <row>
40974 <entry><option>one_time</option></entry>
40975 <entry>Use: <emphasis>redirect</emphasis></entry>
40976 <entry>Type: <emphasis>boolean</emphasis></entry>
40977 <entry>Default: <emphasis>false</emphasis></entry>
40978 </row>
40979 </tbody>
40980 </tgroup>
40981 </informaltable>
40982 <para>
40983 <indexterm role="concept">
40984 <primary>one-time aliasing/forwarding expansion</primary>
40985 </indexterm>
40986 <indexterm role="concept">
40987 <primary>alias file</primary>
40988 <secondary>one-time expansion</secondary>
40989 </indexterm>
40990 <indexterm role="concept">
40991 <primary>forward file</primary>
40992 <secondary>one-time expansion</secondary>
40993 </indexterm>
40994 <indexterm role="concept">
40995 <primary>mailing lists</primary>
40996 <secondary>one-time expansion</secondary>
40997 </indexterm>
40998 <indexterm role="concept">
40999 <primary>address redirection</primary>
41000 <secondary>one-time expansion</secondary>
41001 </indexterm>
41002 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
41003 files each time it tries to deliver a message causes a problem when one or more
41004 of the generated addresses fails be delivered at the first attempt. The problem
41005 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
41006 but of what happens when the redirection list changes during the time that the
41007 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
41008 lists, where new subscribers might receive copies of messages that were posted
41009 before they subscribed.
41010 </para>
41011 <para>
41012 If <option>one_time</option> is set and any addresses generated by the router fail to
41013 deliver at the first attempt, the failing addresses are added to the message as
41014 <quote>top level</quote> addresses, and the parent address that generated them is marked
41015 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
41016 attempt.
41017 </para>
41018 <para>
41019 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
41020 router would be lost if delivery did not succeed at the first attempt. For this
41021 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
41022 permitted when <option>one_time</option> is set.
41023 </para>
41024 <para>
41025 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
41026 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
41027 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
41028 </para>
41029 <para>
41030 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
41031 <option>one_time</option>.
41032 </para>
41033 <para>
41034 The original top-level address is remembered with each of the generated
41035 addresses, and is output in any log messages. However, any intermediate parent
41036 addresses are not recorded. This makes a difference to the log only if
41037 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
41038 typically be used for mailing lists, where there is normally just one level of
41039 expansion.
41040 </para>
41041 <para>
41042 <indexterm role="option">
41043 <primary><option>owners</option></primary>
41044 </indexterm>
41045 </para>
41046 <informaltable frame="all">
41047 <tgroup cols="4" colsep="0" rowsep="0">
41048 <colspec colwidth="8*" align="left"/>
41049 <colspec colwidth="6*" align="center"/>
41050 <colspec colwidth="6*" align="center"/>
41051 <colspec colwidth="6*" align="right"/>
41052 <tbody>
41053 <row>
41054 <entry><option>owners</option></entry>
41055 <entry>Use: <emphasis>redirect</emphasis></entry>
41056 <entry>Type: <emphasis>string list</emphasis></entry>
41057 <entry>Default: <emphasis>unset</emphasis></entry>
41058 </row>
41059 </tbody>
41060 </tgroup>
41061 </informaltable>
41062 <para>
41063 <indexterm role="concept">
41064 <primary>ownership</primary>
41065 <secondary>alias file</secondary>
41066 </indexterm>
41067 <indexterm role="concept">
41068 <primary>ownership</primary>
41069 <secondary>forward file</secondary>
41070 </indexterm>
41071 <indexterm role="concept">
41072 <primary>alias file</primary>
41073 <secondary>ownership</secondary>
41074 </indexterm>
41075 <indexterm role="concept">
41076 <primary>forward file</primary>
41077 <secondary>ownership</secondary>
41078 </indexterm>
41079 This specifies a list of permitted owners for the file specified by <option>file</option>.
41080 This list is in addition to the local user when <option>check_local_user</option> is set.
41081 See <option>check_owner</option> above.
41082 </para>
41083 <para>
41084 <indexterm role="option">
41085 <primary><option>owngroups</option></primary>
41086 </indexterm>
41087 </para>
41088 <informaltable frame="all">
41089 <tgroup cols="4" colsep="0" rowsep="0">
41090 <colspec colwidth="8*" align="left"/>
41091 <colspec colwidth="6*" align="center"/>
41092 <colspec colwidth="6*" align="center"/>
41093 <colspec colwidth="6*" align="right"/>
41094 <tbody>
41095 <row>
41096 <entry><option>owngroups</option></entry>
41097 <entry>Use: <emphasis>redirect</emphasis></entry>
41098 <entry>Type: <emphasis>string list</emphasis></entry>
41099 <entry>Default: <emphasis>unset</emphasis></entry>
41100 </row>
41101 </tbody>
41102 </tgroup>
41103 </informaltable>
41104 <para>
41105 This specifies a list of permitted groups for the file specified by <option>file</option>.
41106 The list is in addition to the local user&#x2019;s primary group when
41107 <option>check_local_user</option> is set. See <option>check_group</option> above.
41108 </para>
41109 <para>
41110 <indexterm role="option">
41111 <primary><option>pipe_transport</option></primary>
41112 </indexterm>
41113 </para>
41114 <informaltable frame="all">
41115 <tgroup cols="4" colsep="0" rowsep="0">
41116 <colspec colwidth="8*" align="left"/>
41117 <colspec colwidth="6*" align="center"/>
41118 <colspec colwidth="6*" align="center"/>
41119 <colspec colwidth="6*" align="right"/>
41120 <tbody>
41121 <row>
41122 <entry><option>pipe_transport</option></entry>
41123 <entry>Use: <emphasis>redirect</emphasis></entry>
41124 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41125 <entry>Default: <emphasis>unset</emphasis></entry>
41126 </row>
41127 </tbody>
41128 </tgroup>
41129 </informaltable>
41130 <para>
41131 <indexterm role="variable">
41132 <primary><varname>$address_pipe</varname></primary>
41133 </indexterm>
41134 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
41135 starting with a vertical bar character is specified as a new <quote>address</quote>. The
41136 transport used is specified by this option, which, after expansion, must be the
41137 name of a configured transport. This should normally be a <command>pipe</command> transport.
41138 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
41139 </para>
41140 <para>
41141 <indexterm role="option">
41142 <primary><option>qualify_domain</option></primary>
41143 </indexterm>
41144 </para>
41145 <informaltable frame="all">
41146 <tgroup cols="4" colsep="0" rowsep="0">
41147 <colspec colwidth="8*" align="left"/>
41148 <colspec colwidth="6*" align="center"/>
41149 <colspec colwidth="6*" align="center"/>
41150 <colspec colwidth="6*" align="right"/>
41151 <tbody>
41152 <row>
41153 <entry><option>qualify_domain</option></entry>
41154 <entry>Use: <emphasis>redirect</emphasis></entry>
41155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41156 <entry>Default: <emphasis>unset</emphasis></entry>
41157 </row>
41158 </tbody>
41159 </tgroup>
41160 </informaltable>
41161 <para>
41162 <indexterm role="variable">
41163 <primary><varname>$qualify_recipient</varname></primary>
41164 </indexterm>
41165 If this option is set, and an unqualified address (one without a domain) is
41166 generated, and that address would normally be qualified by the global setting
41167 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
41168 expanding this string. If the expansion fails, the router declines. If you want
41169 to revert to the default, you can have the expansion generate
41170 <varname>$qualify_recipient</varname>.
41171 </para>
41172 <para>
41173 This option applies to all unqualified addresses generated by Exim filters,
41174 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
41175 not preceded by a backslash. Sieve filters cannot generate unqualified
41176 addresses.
41177 </para>
41178 <para>
41179 <indexterm role="option">
41180 <primary><option>qualify_preserve_domain</option></primary>
41181 </indexterm>
41182 </para>
41183 <informaltable frame="all">
41184 <tgroup cols="4" colsep="0" rowsep="0">
41185 <colspec colwidth="8*" align="left"/>
41186 <colspec colwidth="6*" align="center"/>
41187 <colspec colwidth="6*" align="center"/>
41188 <colspec colwidth="6*" align="right"/>
41189 <tbody>
41190 <row>
41191 <entry><option>qualify_preserve_domain</option></entry>
41192 <entry>Use: <emphasis>redirect</emphasis></entry>
41193 <entry>Type: <emphasis>boolean</emphasis></entry>
41194 <entry>Default: <emphasis>false</emphasis></entry>
41195 </row>
41196 </tbody>
41197 </tgroup>
41198 </informaltable>
41199 <para>
41200 <indexterm role="concept">
41201 <primary>domain</primary>
41202 <secondary>in redirection; preserving</secondary>
41203 </indexterm>
41204 <indexterm role="concept">
41205 <primary>preserving domain in redirection</primary>
41206 </indexterm>
41207 <indexterm role="concept">
41208 <primary>address redirection</primary>
41209 <secondary>domain; preserving</secondary>
41210 </indexterm>
41211 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
41212 set (a configuration error occurs if it is). If an unqualified address (one
41213 without a domain) is generated, it is qualified with the domain of the parent
41214 address (the immediately preceding ancestor) instead of the global
41215 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
41216 this applies whether or not the address is preceded by a backslash.
41217 </para>
41218 <para>
41219 <indexterm role="option">
41220 <primary><option>repeat_use</option></primary>
41221 </indexterm>
41222 </para>
41223 <informaltable frame="all">
41224 <tgroup cols="4" colsep="0" rowsep="0">
41225 <colspec colwidth="8*" align="left"/>
41226 <colspec colwidth="6*" align="center"/>
41227 <colspec colwidth="6*" align="center"/>
41228 <colspec colwidth="6*" align="right"/>
41229 <tbody>
41230 <row>
41231 <entry><option>repeat_use</option></entry>
41232 <entry>Use: <emphasis>redirect</emphasis></entry>
41233 <entry>Type: <emphasis>boolean</emphasis></entry>
41234 <entry>Default: <emphasis>true</emphasis></entry>
41235 </row>
41236 </tbody>
41237 </tgroup>
41238 </informaltable>
41239 <para>
41240 If this option is set false, the router is skipped for a child address that has
41241 any ancestor that was routed by this router. This test happens before any of
41242 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
41243 only when the ancestor is the same as the current address. See also
41244 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
41245 </para>
41246 <para>
41247 <indexterm role="option">
41248 <primary><option>reply_transport</option></primary>
41249 </indexterm>
41250 </para>
41251 <informaltable frame="all">
41252 <tgroup cols="4" colsep="0" rowsep="0">
41253 <colspec colwidth="8*" align="left"/>
41254 <colspec colwidth="6*" align="center"/>
41255 <colspec colwidth="6*" align="center"/>
41256 <colspec colwidth="6*" align="right"/>
41257 <tbody>
41258 <row>
41259 <entry><option>reply_transport</option></entry>
41260 <entry>Use: <emphasis>redirect</emphasis></entry>
41261 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41262 <entry>Default: <emphasis>unset</emphasis></entry>
41263 </row>
41264 </tbody>
41265 </tgroup>
41266 </informaltable>
41267 <para>
41268 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
41269 <option>vacation</option> command is used in a filter file. The transport used is specified
41270 by this option, which, after expansion, must be the name of a configured
41271 transport. This should normally be an <command>autoreply</command> transport. Other transports
41272 are unlikely to do anything sensible or useful.
41273 </para>
41274 <para>
41275 <indexterm role="option">
41276 <primary><option>rewrite</option></primary>
41277 </indexterm>
41278 </para>
41279 <informaltable frame="all">
41280 <tgroup cols="4" colsep="0" rowsep="0">
41281 <colspec colwidth="8*" align="left"/>
41282 <colspec colwidth="6*" align="center"/>
41283 <colspec colwidth="6*" align="center"/>
41284 <colspec colwidth="6*" align="right"/>
41285 <tbody>
41286 <row>
41287 <entry><option>rewrite</option></entry>
41288 <entry>Use: <emphasis>redirect</emphasis></entry>
41289 <entry>Type: <emphasis>boolean</emphasis></entry>
41290 <entry>Default: <emphasis>true</emphasis></entry>
41291 </row>
41292 </tbody>
41293 </tgroup>
41294 </informaltable>
41295 <para>
41296 <indexterm role="concept">
41297 <primary>address redirection</primary>
41298 <secondary>disabling rewriting</secondary>
41299 </indexterm>
41300 If this option is set false, addresses generated by the router are not
41301 subject to address rewriting. Otherwise, they are treated like new addresses
41302 and are rewritten according to the global rewriting rules.
41303 </para>
41304 <para>
41305 <indexterm role="option">
41306 <primary><option>sieve_subaddress</option></primary>
41307 </indexterm>
41308 </para>
41309 <informaltable frame="all">
41310 <tgroup cols="4" colsep="0" rowsep="0">
41311 <colspec colwidth="8*" align="left"/>
41312 <colspec colwidth="6*" align="center"/>
41313 <colspec colwidth="6*" align="center"/>
41314 <colspec colwidth="6*" align="right"/>
41315 <tbody>
41316 <row>
41317 <entry><option>sieve_subaddress</option></entry>
41318 <entry>Use: <emphasis>redirect</emphasis></entry>
41319 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41320 <entry>Default: <emphasis>unset</emphasis></entry>
41321 </row>
41322 </tbody>
41323 </tgroup>
41324 </informaltable>
41325 <para>
41326 The value of this option is passed to a Sieve filter to specify the
41327 :subaddress part of an address.
41328 </para>
41329 <para>
41330 <indexterm role="option">
41331 <primary><option>sieve_useraddress</option></primary>
41332 </indexterm>
41333 </para>
41334 <informaltable frame="all">
41335 <tgroup cols="4" colsep="0" rowsep="0">
41336 <colspec colwidth="8*" align="left"/>
41337 <colspec colwidth="6*" align="center"/>
41338 <colspec colwidth="6*" align="center"/>
41339 <colspec colwidth="6*" align="right"/>
41340 <tbody>
41341 <row>
41342 <entry><option>sieve_useraddress</option></entry>
41343 <entry>Use: <emphasis>redirect</emphasis></entry>
41344 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41345 <entry>Default: <emphasis>unset</emphasis></entry>
41346 </row>
41347 </tbody>
41348 </tgroup>
41349 </informaltable>
41350 <para>
41351 The value of this option is passed to a Sieve filter to specify the :user part
41352 of an address. However, if it is unset, the entire original local part
41353 (including any prefix or suffix) is used for :user.
41354 </para>
41355 <para>
41356 <indexterm role="option">
41357 <primary><option>sieve_vacation_directory</option></primary>
41358 </indexterm>
41359 </para>
41360 <informaltable frame="all">
41361 <tgroup cols="4" colsep="0" rowsep="0">
41362 <colspec colwidth="8*" align="left"/>
41363 <colspec colwidth="6*" align="center"/>
41364 <colspec colwidth="6*" align="center"/>
41365 <colspec colwidth="6*" align="right"/>
41366 <tbody>
41367 <row>
41368 <entry><option>sieve_vacation_directory</option></entry>
41369 <entry>Use: <emphasis>redirect</emphasis></entry>
41370 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41371 <entry>Default: <emphasis>unset</emphasis></entry>
41372 </row>
41373 </tbody>
41374 </tgroup>
41375 </informaltable>
41376 <para>
41377 <indexterm role="concept">
41378 <primary>Sieve filter</primary>
41379 <secondary>vacation directory</secondary>
41380 </indexterm>
41381 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
41382 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
41383 (do not put anything else in that directory), and ensure that the
41384 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
41385 needs their own directory; Exim will create it if necessary.
41386 </para>
41387 <para>
41388 <indexterm role="option">
41389 <primary><option>skip_syntax_errors</option></primary>
41390 </indexterm>
41391 </para>
41392 <informaltable frame="all">
41393 <tgroup cols="4" colsep="0" rowsep="0">
41394 <colspec colwidth="8*" align="left"/>
41395 <colspec colwidth="6*" align="center"/>
41396 <colspec colwidth="6*" align="center"/>
41397 <colspec colwidth="6*" align="right"/>
41398 <tbody>
41399 <row>
41400 <entry><option>skip_syntax_errors</option></entry>
41401 <entry>Use: <emphasis>redirect</emphasis></entry>
41402 <entry>Type: <emphasis>boolean</emphasis></entry>
41403 <entry>Default: <emphasis>false</emphasis></entry>
41404 </row>
41405 </tbody>
41406 </tgroup>
41407 </informaltable>
41408 <para>
41409 <indexterm role="concept">
41410 <primary>forward file</primary>
41411 <secondary>broken</secondary>
41412 </indexterm>
41413 <indexterm role="concept">
41414 <primary>address redirection</primary>
41415 <secondary>broken files</secondary>
41416 </indexterm>
41417 <indexterm role="concept">
41418 <primary>alias file</primary>
41419 <secondary>broken</secondary>
41420 </indexterm>
41421 <indexterm role="concept">
41422 <primary>broken alias or forward files</primary>
41423 </indexterm>
41424 <indexterm role="concept">
41425 <primary>ignoring faulty addresses</primary>
41426 </indexterm>
41427 <indexterm role="concept">
41428 <primary>skipping faulty addresses</primary>
41429 </indexterm>
41430 <indexterm role="concept">
41431 <primary>error</primary>
41432 <secondary>skipping bad syntax</secondary>
41433 </indexterm>
41434 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
41435 non-filter redirection data are skipped, and each failing address is logged. If
41436 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
41437 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
41438 are expanded and placed at the head of the error message generated by
41439 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
41440 be the same address as the generic <option>errors_to</option> option. The
41441 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
41442 </para>
41443 <para>
41444 If all the addresses in a redirection list are skipped because of syntax
41445 errors, the router declines to handle the original address, and it is passed to
41446 the following routers.
41447 </para>
41448 <para>
41449 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
41450 error in the filter causes filtering to be abandoned without any action being
41451 taken. The incident is logged, and the router declines to handle the address,
41452 so it is passed to the following routers.
41453 </para>
41454 <para>
41455 <indexterm role="concept">
41456 <primary>Sieve filter</primary>
41457 <secondary>syntax errors in</secondary>
41458 </indexterm>
41459 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
41460 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
41461 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
41462 </para>
41463 <para>
41464 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
41465 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
41466 option, used with an address that does not get redirected, can be used to
41467 notify users of these errors, by means of a router like this:
41468 </para>
41469 <literallayout class="monospaced">
41470 userforward:
41471   driver = redirect
41472   allow_filter
41473   check_local_user
41474   file = $home/.forward
41475   file_transport = address_file
41476   pipe_transport = address_pipe
41477   reply_transport = address_reply
41478   no_verify
41479   skip_syntax_errors
41480   syntax_errors_to = real-$local_part@$domain
41481   syntax_errors_text = \
41482    This is an automatically generated message. An error has\n\
41483    been found in your .forward file. Details of the error are\n\
41484    reported below. While this error persists, you will receive\n\
41485    a copy of this message for every message that is addressed\n\
41486    to you. If your .forward file is a filter file, or if it is\n\
41487    a non-filter file containing no valid forwarding addresses,\n\
41488    a copy of each incoming message will be put in your normal\n\
41489    mailbox. If a non-filter file contains at least one valid\n\
41490    forwarding address, forwarding to the valid addresses will\n\
41491    happen, and those will be the only deliveries that occur.
41492 </literallayout>
41493 <para>
41494 You also need a router to ensure that local addresses that are prefixed by
41495 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
41496 put this immediately before the <command>userforward</command> router:
41497 </para>
41498 <literallayout class="monospaced">
41499 real_localuser:
41500   driver = accept
41501   check_local_user
41502   local_part_prefix = real-
41503   transport = local_delivery
41504 </literallayout>
41505 <para>
41506 For security, it would probably be a good idea to restrict the use of this
41507 router to locally-generated messages, using a condition such as this:
41508 </para>
41509 <literallayout class="monospaced">
41510   condition = ${if match {$sender_host_address}\
41511                          {\N^(|127\.0\.0\.1)$\N}}
41512 </literallayout>
41513 <para>
41514 <indexterm role="option">
41515 <primary><option>syntax_errors_text</option></primary>
41516 </indexterm>
41517 </para>
41518 <informaltable frame="all">
41519 <tgroup cols="4" colsep="0" rowsep="0">
41520 <colspec colwidth="8*" align="left"/>
41521 <colspec colwidth="6*" align="center"/>
41522 <colspec colwidth="6*" align="center"/>
41523 <colspec colwidth="6*" align="right"/>
41524 <tbody>
41525 <row>
41526 <entry><option>syntax_errors_text</option></entry>
41527 <entry>Use: <emphasis>redirect</emphasis></entry>
41528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41529 <entry>Default: <emphasis>unset</emphasis></entry>
41530 </row>
41531 </tbody>
41532 </tgroup>
41533 </informaltable>
41534 <para>
41535 See <option>skip_syntax_errors</option> above.
41536 </para>
41537 <para>
41538 <indexterm role="option">
41539 <primary><option>syntax_errors_to</option></primary>
41540 </indexterm>
41541 </para>
41542 <informaltable frame="all">
41543 <tgroup cols="4" colsep="0" rowsep="0">
41544 <colspec colwidth="8*" align="left"/>
41545 <colspec colwidth="6*" align="center"/>
41546 <colspec colwidth="6*" align="center"/>
41547 <colspec colwidth="6*" align="right"/>
41548 <tbody>
41549 <row>
41550 <entry><option>syntax_errors_to</option></entry>
41551 <entry>Use: <emphasis>redirect</emphasis></entry>
41552 <entry>Type: <emphasis>string</emphasis></entry>
41553 <entry>Default: <emphasis>unset</emphasis></entry>
41554 </row>
41555 </tbody>
41556 </tgroup>
41557 </informaltable>
41558 <para>
41559 See <option>skip_syntax_errors</option> above.
41560 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
41561 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
41562 </para>
41563 </section>
41564 </chapter>
41565
41566 <chapter id="CHAPenvironment">
41567 <title>Environment for running local transports</title>
41568 <titleabbrev>Environment for local transports</titleabbrev>
41569 <para>
41570 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
41571 <primary>local transports</primary>
41572 <secondary>environment for</secondary>
41573 </indexterm>
41574 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
41575 <primary>environment</primary>
41576 <secondary>local transports</secondary>
41577 </indexterm>
41578 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
41579 <primary>transport</primary>
41580 <secondary>local; environment for</secondary>
41581 </indexterm>
41582 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
41583 transport can be thought of as similar to a pipe.) Exim always runs transports
41584 in subprocesses, under specified uids and gids. Typical deliveries to local
41585 mailboxes run under the uid and gid of the local user.
41586 </para>
41587 <para>
41588 Exim also sets a specific current directory while running the transport; for
41589 some transports a home directory setting is also relevant. The <command>pipe</command>
41590 transport is the only one that sets up environment variables; see section
41591 <xref linkend="SECTpipeenv"/> for details.
41592 </para>
41593 <para>
41594 The values used for the uid, gid, and the directories may come from several
41595 different places. In many cases, the router that handles the address associates
41596 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
41597 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
41598 configuration, and these override anything that comes from the router.
41599 </para>
41600 <section id="SECID131">
41601 <title>Concurrent deliveries</title>
41602 <para>
41603 <indexterm role="concept">
41604 <primary>concurrent deliveries</primary>
41605 </indexterm>
41606 <indexterm role="concept">
41607 <primary>simultaneous deliveries</primary>
41608 </indexterm>
41609 If two different messages for the same local recipient arrive more or less
41610 simultaneously, the two delivery processes are likely to run concurrently. When
41611 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
41612 rules to stop concurrent processes from writing to the same file at the same
41613 time.
41614 </para>
41615 <para>
41616 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
41617 locking that is needed. Here is a silly example:
41618 </para>
41619 <literallayout class="monospaced">
41620 my_transport:
41621   driver = pipe
41622   command = /bin/sh -c 'cat &gt;&gt;/some/file'
41623 </literallayout>
41624 <para>
41625 This is supposed to write the message at the end of the file. However, if two
41626 messages arrive at the same time, the file will be scrambled. You can use the
41627 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
41628 file using the same algorithm that Exim itself uses.
41629 </para>
41630 </section>
41631 <section id="SECTenvuidgid">
41632 <title>Uids and gids</title>
41633 <para>
41634 <indexterm role="concept">
41635 <primary>local transports</primary>
41636 <secondary>uid and gid</secondary>
41637 </indexterm>
41638 <indexterm role="concept">
41639 <primary>transport</primary>
41640 <secondary>local; uid and gid</secondary>
41641 </indexterm>
41642 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
41643 overrides any group that the router set in the address, even if <option>user</option> is not
41644 set for the transport. This makes it possible, for example, to run local mail
41645 delivery under the uid of the recipient (set by the router), but in a special
41646 group (set by the transport). For example:
41647 </para>
41648 <literallayout class="monospaced">
41649 # Routers ...
41650 # User/group are set by check_local_user in this router
41651 local_users:
41652   driver = accept
41653   check_local_user
41654   transport = group_delivery
41655
41656 # Transports ...
41657 # This transport overrides the group
41658 group_delivery:
41659   driver = appendfile
41660   file = /var/spool/mail/$local_part_data
41661   group = mail
41662 </literallayout>
41663 <para>
41664 If <option>user</option> is set for a transport, its value overrides what is set in the
41665 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
41666 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
41667 set.
41668 </para>
41669 <para>
41670 <indexterm role="option">
41671 <primary><option>initgroups</option></primary>
41672 </indexterm>
41673 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
41674 function is called for the groups associated with that uid if the
41675 <option>initgroups</option> option is set for the transport. When the uid is not specified
41676 by the transport, but is associated with the address by a router, the option
41677 for calling <function>initgroups()</function> is taken from the router configuration.
41678 </para>
41679 <para>
41680 <indexterm role="concept">
41681 <primary><command>pipe</command> transport</primary>
41682 <secondary>uid for</secondary>
41683 </indexterm>
41684 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
41685 is set and <option>user</option> is not set, the uid of the process that called Exim to
41686 receive the message is used, and if <option>group</option> is not set, the corresponding
41687 original gid is also used.
41688 </para>
41689 <para>
41690 This is the detailed preference order for obtaining a gid; the first of the
41691 following that is set is used:
41692 </para>
41693 <itemizedlist>
41694 <listitem>
41695 <para>
41696 A <option>group</option> setting of the transport;
41697 </para>
41698 </listitem>
41699 <listitem>
41700 <para>
41701 A <option>group</option> setting of the router;
41702 </para>
41703 </listitem>
41704 <listitem>
41705 <para>
41706 A gid associated with a user setting of the router, either as a result of
41707 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
41708 </para>
41709 </listitem>
41710 <listitem>
41711 <para>
41712 The group associated with a non-numeric <option>user</option> setting of the transport;
41713 </para>
41714 </listitem>
41715 <listitem>
41716 <para>
41717 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
41718 the uid is the creator&#x2019;s uid;
41719 </para>
41720 </listitem>
41721 <listitem>
41722 <para>
41723 The Exim gid if the Exim uid is being used as a default.
41724 </para>
41725 </listitem>
41726 </itemizedlist>
41727 <para>
41728 If, for example, the user is specified numerically on the router and there are
41729 no group settings, no gid is available. In this situation, an error occurs.
41730 This is different for the uid, for which there always is an ultimate default.
41731 The first of the following that is set is used:
41732 </para>
41733 <itemizedlist>
41734 <listitem>
41735 <para>
41736 A <option>user</option> setting of the transport;
41737 </para>
41738 </listitem>
41739 <listitem>
41740 <para>
41741 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
41742 </para>
41743 </listitem>
41744 <listitem>
41745 <para>
41746 A <option>user</option> setting of the router;
41747 </para>
41748 </listitem>
41749 <listitem>
41750 <para>
41751 A <option>check_local_user</option> setting of the router;
41752 </para>
41753 </listitem>
41754 <listitem>
41755 <para>
41756 The Exim uid.
41757 </para>
41758 </listitem>
41759 </itemizedlist>
41760 <para>
41761 Of course, an error will still occur if the uid that is chosen is on the
41762 <option>never_users</option> list.
41763 </para>
41764 </section>
41765 <section id="SECID132">
41766 <title>Current and home directories</title>
41767 <para>
41768 <indexterm role="concept">
41769 <primary>current directory for local transport</primary>
41770 </indexterm>
41771 <indexterm role="concept">
41772 <primary>home directory</primary>
41773 <secondary>for local transport</secondary>
41774 </indexterm>
41775 <indexterm role="concept">
41776 <primary>transport</primary>
41777 <secondary>local; home directory for</secondary>
41778 </indexterm>
41779 <indexterm role="concept">
41780 <primary>transport</primary>
41781 <secondary>local; current directory for</secondary>
41782 </indexterm>
41783 Routers may set current and home directories for local transports by means of
41784 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
41785 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
41786 are set, they override the router&#x2019;s values. In detail, the home directory
41787 for a local transport is taken from the first of these values that is set:
41788 </para>
41789 <itemizedlist>
41790 <listitem>
41791 <para>
41792 The <option>home_directory</option> option on the transport;
41793 </para>
41794 </listitem>
41795 <listitem>
41796 <para>
41797 The <option>transport_home_directory</option> option on the router;
41798 </para>
41799 </listitem>
41800 <listitem>
41801 <para>
41802 The password data if <option>check_local_user</option> is set on the router;
41803 </para>
41804 </listitem>
41805 <listitem>
41806 <para>
41807 The <option>router_home_directory</option> option on the router.
41808 </para>
41809 </listitem>
41810 </itemizedlist>
41811 <para>
41812 The current directory is taken from the first of these values that is set:
41813 </para>
41814 <itemizedlist>
41815 <listitem>
41816 <para>
41817 The <option>current_directory</option> option on the transport;
41818 </para>
41819 </listitem>
41820 <listitem>
41821 <para>
41822 The <option>transport_current_directory</option> option on the router.
41823 </para>
41824 </listitem>
41825 </itemizedlist>
41826 <para>
41827 If neither the router nor the transport sets a current directory, Exim uses the
41828 value of the home directory, if it is set. Otherwise it sets the current
41829 directory to <filename>/</filename> before running a local transport.
41830 </para>
41831 </section>
41832 <section id="SECID133">
41833 <title>Expansion variables derived from the address</title>
41834 <para>
41835 <indexterm role="variable">
41836 <primary><varname>$domain</varname></primary>
41837 </indexterm>
41838 <indexterm role="variable">
41839 <primary><varname>$local_part</varname></primary>
41840 </indexterm>
41841 <indexterm role="variable">
41842 <primary><varname>$original_domain</varname></primary>
41843 </indexterm>
41844 Normally a local delivery is handling a single address, and in that case the
41845 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
41846 deliveries. However, in some circumstances more than one address may be handled
41847 at once (for example, while writing batch SMTP for onward transmission by some
41848 other means). In this case, the variables associated with the local part are
41849 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
41850 and <varname>$original_domain</varname> is never set.
41851 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
41852 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
41853 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
41854 </para>
41855 </section>
41856 </chapter>
41857
41858 <chapter id="CHAPtransportgeneric">
41859 <title>Generic options for transports</title>
41860 <para>
41861 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
41862 <primary>generic options</primary>
41863 <secondary>transport</secondary>
41864 </indexterm>
41865 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
41866 <primary>options</primary>
41867 <secondary>generic; for transports</secondary>
41868 </indexterm>
41869 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
41870 <primary>transport</primary>
41871 <secondary>generic options for</secondary>
41872 </indexterm>
41873 The following generic options apply to all transports:
41874 </para>
41875 <para>
41876 <indexterm role="option">
41877 <primary><option>body_only</option></primary>
41878 </indexterm>
41879 </para>
41880 <informaltable frame="all">
41881 <tgroup cols="4" colsep="0" rowsep="0">
41882 <colspec colwidth="8*" align="left"/>
41883 <colspec colwidth="6*" align="center"/>
41884 <colspec colwidth="6*" align="center"/>
41885 <colspec colwidth="6*" align="right"/>
41886 <tbody>
41887 <row>
41888 <entry><option>body_only</option></entry>
41889 <entry>Use: <emphasis>transports</emphasis></entry>
41890 <entry>Type: <emphasis>boolean</emphasis></entry>
41891 <entry>Default: <emphasis>false</emphasis></entry>
41892 </row>
41893 </tbody>
41894 </tgroup>
41895 </informaltable>
41896 <para>
41897 <indexterm role="concept">
41898 <primary>transport</primary>
41899 <secondary>body only</secondary>
41900 </indexterm>
41901 <indexterm role="concept">
41902 <primary>message</primary>
41903 <secondary>transporting body only</secondary>
41904 </indexterm>
41905 <indexterm role="concept">
41906 <primary>body of message</primary>
41907 <secondary>transporting</secondary>
41908 </indexterm>
41909 If this option is set, the message&#x2019;s headers are not transported. It is
41910 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
41911 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
41912 <option>message_suffix</option> should be checked, because this option does not
41913 automatically suppress them.
41914 </para>
41915 <para>
41916 <indexterm role="option">
41917 <primary><option>current_directory</option></primary>
41918 </indexterm>
41919 </para>
41920 <informaltable frame="all">
41921 <tgroup cols="4" colsep="0" rowsep="0">
41922 <colspec colwidth="8*" align="left"/>
41923 <colspec colwidth="6*" align="center"/>
41924 <colspec colwidth="6*" align="center"/>
41925 <colspec colwidth="6*" align="right"/>
41926 <tbody>
41927 <row>
41928 <entry><option>current_directory</option></entry>
41929 <entry>Use: <emphasis>transports</emphasis></entry>
41930 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41931 <entry>Default: <emphasis>unset</emphasis></entry>
41932 </row>
41933 </tbody>
41934 </tgroup>
41935 </informaltable>
41936 <para>
41937 <indexterm role="concept">
41938 <primary>transport</primary>
41939 <secondary>current directory for</secondary>
41940 </indexterm>
41941 This specifies the current directory that is to be set while running the
41942 transport, overriding any value that may have been set by the router.
41943 If the expansion fails for any reason, including forced failure, an error is
41944 logged, and delivery is deferred.
41945 </para>
41946 <para>
41947 <indexterm role="option">
41948 <primary><option>disable_logging</option></primary>
41949 </indexterm>
41950 </para>
41951 <informaltable frame="all">
41952 <tgroup cols="4" colsep="0" rowsep="0">
41953 <colspec colwidth="8*" align="left"/>
41954 <colspec colwidth="6*" align="center"/>
41955 <colspec colwidth="6*" align="center"/>
41956 <colspec colwidth="6*" align="right"/>
41957 <tbody>
41958 <row>
41959 <entry><option>disable_logging</option></entry>
41960 <entry>Use: <emphasis>transports</emphasis></entry>
41961 <entry>Type: <emphasis>boolean</emphasis></entry>
41962 <entry>Default: <emphasis>false</emphasis></entry>
41963 </row>
41964 </tbody>
41965 </tgroup>
41966 </informaltable>
41967 <para>
41968 If this option is set true, nothing is logged for any
41969 deliveries by the transport or for any
41970 transport errors. You should not set this option unless you really, really know
41971 what you are doing.
41972 </para>
41973 <para>
41974 <indexterm role="option">
41975 <primary><option>debug_print</option></primary>
41976 </indexterm>
41977 </para>
41978 <informaltable frame="all">
41979 <tgroup cols="4" colsep="0" rowsep="0">
41980 <colspec colwidth="8*" align="left"/>
41981 <colspec colwidth="6*" align="center"/>
41982 <colspec colwidth="6*" align="center"/>
41983 <colspec colwidth="6*" align="right"/>
41984 <tbody>
41985 <row>
41986 <entry><option>debug_print</option></entry>
41987 <entry>Use: <emphasis>transports</emphasis></entry>
41988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41989 <entry>Default: <emphasis>unset</emphasis></entry>
41990 </row>
41991 </tbody>
41992 </tgroup>
41993 </informaltable>
41994 <para>
41995 <indexterm role="concept">
41996 <primary>testing</primary>
41997 <secondary>variables in drivers</secondary>
41998 </indexterm>
41999 If this option is set and debugging is enabled (see the <option>-d</option> command line
42000 option), the string is expanded and included in the debugging output when the
42001 transport is run.
42002 If expansion of the string fails, the error message is written to the debugging
42003 output, and Exim carries on processing.
42004 This facility is provided to help with checking out the values of variables and
42005 so on when debugging driver configurations. For example, if a <option>headers_add</option>
42006 option is not working properly, <option>debug_print</option> could be used to output the
42007 variables it references. A newline is added to the text if it does not end with
42008 one.
42009 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
42010 transport and the router that called it.
42011 </para>
42012 <para>
42013 <indexterm role="option">
42014 <primary><option>delivery_date_add</option></primary>
42015 </indexterm>
42016 </para>
42017 <informaltable frame="all">
42018 <tgroup cols="4" colsep="0" rowsep="0">
42019 <colspec colwidth="8*" align="left"/>
42020 <colspec colwidth="6*" align="center"/>
42021 <colspec colwidth="6*" align="center"/>
42022 <colspec colwidth="6*" align="right"/>
42023 <tbody>
42024 <row>
42025 <entry><option>delivery_date_add</option></entry>
42026 <entry>Use: <emphasis>transports</emphasis></entry>
42027 <entry>Type: <emphasis>boolean</emphasis></entry>
42028 <entry>Default: <emphasis>false</emphasis></entry>
42029 </row>
42030 </tbody>
42031 </tgroup>
42032 </informaltable>
42033 <para>
42034 <indexterm role="concept">
42035 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
42036 </indexterm>
42037 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
42038 This gives the actual time the delivery was made. As this is not a standard
42039 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
42040 requests its removal from incoming messages, so that delivered messages can
42041 safely be resent to other recipients.
42042 </para>
42043 <para>
42044 <indexterm role="option">
42045 <primary><option>driver</option></primary>
42046 </indexterm>
42047 </para>
42048 <informaltable frame="all">
42049 <tgroup cols="4" colsep="0" rowsep="0">
42050 <colspec colwidth="8*" align="left"/>
42051 <colspec colwidth="6*" align="center"/>
42052 <colspec colwidth="6*" align="center"/>
42053 <colspec colwidth="6*" align="right"/>
42054 <tbody>
42055 <row>
42056 <entry><option>driver</option></entry>
42057 <entry>Use: <emphasis>transports</emphasis></entry>
42058 <entry>Type: <emphasis>string</emphasis></entry>
42059 <entry>Default: <emphasis>unset</emphasis></entry>
42060 </row>
42061 </tbody>
42062 </tgroup>
42063 </informaltable>
42064 <para>
42065 This specifies which of the available transport drivers is to be used.
42066 There is no default, and this option must be set for every transport.
42067 </para>
42068 <para>
42069 <indexterm role="option">
42070 <primary><option>envelope_to_add</option></primary>
42071 </indexterm>
42072 </para>
42073 <informaltable frame="all">
42074 <tgroup cols="4" colsep="0" rowsep="0">
42075 <colspec colwidth="8*" align="left"/>
42076 <colspec colwidth="6*" align="center"/>
42077 <colspec colwidth="6*" align="center"/>
42078 <colspec colwidth="6*" align="right"/>
42079 <tbody>
42080 <row>
42081 <entry><option>envelope_to_add</option></entry>
42082 <entry>Use: <emphasis>transports</emphasis></entry>
42083 <entry>Type: <emphasis>boolean</emphasis></entry>
42084 <entry>Default: <emphasis>false</emphasis></entry>
42085 </row>
42086 </tbody>
42087 </tgroup>
42088 </informaltable>
42089 <para>
42090 <indexterm role="concept">
42091 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
42092 </indexterm>
42093 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
42094 This gives the original address(es) in the incoming envelope that caused this
42095 delivery to happen. More than one address may be present if the transport is
42096 configured to handle several addresses at once, or if more than one original
42097 address was redirected to the same final address. As this is not a standard
42098 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
42099 its removal from incoming messages, so that delivered messages can safely be
42100 resent to other recipients.
42101 </para>
42102 <para>
42103 <indexterm role="option">
42104 <primary><option>event_action</option></primary>
42105 </indexterm>
42106 </para>
42107 <informaltable frame="all">
42108 <tgroup cols="4" colsep="0" rowsep="0">
42109 <colspec colwidth="8*" align="left"/>
42110 <colspec colwidth="6*" align="center"/>
42111 <colspec colwidth="6*" align="center"/>
42112 <colspec colwidth="6*" align="right"/>
42113 <tbody>
42114 <row>
42115 <entry><option>event_action</option></entry>
42116 <entry>Use: <emphasis>transports</emphasis></entry>
42117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42118 <entry>Default: <emphasis>unset</emphasis></entry>
42119 </row>
42120 </tbody>
42121 </tgroup>
42122 </informaltable>
42123 <para>
42124 <indexterm role="concept">
42125 <primary>events</primary>
42126 </indexterm>
42127 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
42128 For details see chapter <xref linkend="CHAPevents"/>.
42129 </para>
42130 <para>
42131 <indexterm role="option">
42132 <primary><option>group</option></primary>
42133 </indexterm>
42134 </para>
42135 <informaltable frame="all">
42136 <tgroup cols="4" colsep="0" rowsep="0">
42137 <colspec colwidth="8*" align="left"/>
42138 <colspec colwidth="6*" align="center"/>
42139 <colspec colwidth="6*" align="center"/>
42140 <colspec colwidth="6*" align="right"/>
42141 <tbody>
42142 <row>
42143 <entry><option>group</option></entry>
42144 <entry>Use: <emphasis>transports</emphasis></entry>
42145 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42146 <entry>Default: <emphasis>Exim group</emphasis></entry>
42147 </row>
42148 </tbody>
42149 </tgroup>
42150 </informaltable>
42151 <para>
42152 <indexterm role="concept">
42153 <primary>transport</primary>
42154 <secondary>group; specifying</secondary>
42155 </indexterm>
42156 This option specifies a gid for running the transport process, overriding any
42157 value that the router supplies, and also overriding any value associated with
42158 <option>user</option> (see below).
42159 </para>
42160 <para>
42161 <indexterm role="option">
42162 <primary><option>headers_add</option></primary>
42163 </indexterm>
42164 </para>
42165 <informaltable frame="all">
42166 <tgroup cols="4" colsep="0" rowsep="0">
42167 <colspec colwidth="8*" align="left"/>
42168 <colspec colwidth="6*" align="center"/>
42169 <colspec colwidth="6*" align="center"/>
42170 <colspec colwidth="6*" align="right"/>
42171 <tbody>
42172 <row>
42173 <entry><option>headers_add</option></entry>
42174 <entry>Use: <emphasis>transports</emphasis></entry>
42175 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
42176 <entry>Default: <emphasis>unset</emphasis></entry>
42177 </row>
42178 </tbody>
42179 </tgroup>
42180 </informaltable>
42181 <para>
42182 <indexterm role="concept">
42183 <primary>header lines</primary>
42184 <secondary>adding in transport</secondary>
42185 </indexterm>
42186 <indexterm role="concept">
42187 <primary>transport</primary>
42188 <secondary>header lines; adding</secondary>
42189 </indexterm>
42190 This option specifies a list of text headers,
42191 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
42192 which are (separately) expanded and added to the header
42193 portion of a message as it is transported, as described in section
42194 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
42195 routers. If the result of the expansion is an empty string, or if the expansion
42196 is forced to fail, no action is taken. Other expansion failures are treated as
42197 errors and cause the delivery to be deferred.
42198 </para>
42199 <para>
42200 Unlike most options, <option>headers_add</option> can be specified multiple times
42201 for a transport; all listed headers are added.
42202 </para>
42203 <para>
42204 <indexterm role="option">
42205 <primary><option>headers_only</option></primary>
42206 </indexterm>
42207 </para>
42208 <informaltable frame="all">
42209 <tgroup cols="4" colsep="0" rowsep="0">
42210 <colspec colwidth="8*" align="left"/>
42211 <colspec colwidth="6*" align="center"/>
42212 <colspec colwidth="6*" align="center"/>
42213 <colspec colwidth="6*" align="right"/>
42214 <tbody>
42215 <row>
42216 <entry><option>headers_only</option></entry>
42217 <entry>Use: <emphasis>transports</emphasis></entry>
42218 <entry>Type: <emphasis>boolean</emphasis></entry>
42219 <entry>Default: <emphasis>false</emphasis></entry>
42220 </row>
42221 </tbody>
42222 </tgroup>
42223 </informaltable>
42224 <para>
42225 <indexterm role="concept">
42226 <primary>transport</primary>
42227 <secondary>header lines only</secondary>
42228 </indexterm>
42229 <indexterm role="concept">
42230 <primary>message</primary>
42231 <secondary>transporting headers only</secondary>
42232 </indexterm>
42233 <indexterm role="concept">
42234 <primary>header lines</primary>
42235 <secondary>transporting</secondary>
42236 </indexterm>
42237 If this option is set, the message&#x2019;s body is not transported. It is mutually
42238 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
42239 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
42240 checked, since this option does not automatically suppress them.
42241 </para>
42242 <para>
42243 <indexterm role="option">
42244 <primary><option>headers_remove</option></primary>
42245 </indexterm>
42246 </para>
42247 <informaltable frame="all">
42248 <tgroup cols="4" colsep="0" rowsep="0">
42249 <colspec colwidth="8*" align="left"/>
42250 <colspec colwidth="6*" align="center"/>
42251 <colspec colwidth="6*" align="center"/>
42252 <colspec colwidth="6*" align="right"/>
42253 <tbody>
42254 <row>
42255 <entry><option>headers_remove</option></entry>
42256 <entry>Use: <emphasis>transports</emphasis></entry>
42257 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
42258 <entry>Default: <emphasis>unset</emphasis></entry>
42259 </row>
42260 </tbody>
42261 </tgroup>
42262 </informaltable>
42263 <para>
42264 <indexterm role="concept">
42265 <primary>header lines</primary>
42266 <secondary>removing</secondary>
42267 </indexterm>
42268 <indexterm role="concept">
42269 <primary>transport</primary>
42270 <secondary>header lines; removing</secondary>
42271 </indexterm>
42272 This option specifies a list of text headers,
42273 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
42274 to be removed from the message.
42275 However, the option has no effect when an address is just being verified.
42276 Each list item is separately expanded.
42277 If the result of the expansion is an empty string, or if the expansion
42278 is forced to fail, no action is taken. Other expansion failures are treated as
42279 errors and cause the delivery to be deferred.
42280 </para>
42281 <para revisionflag="changed">
42282 If an item ends in *, it will match any header with the given prefix.
42283 </para>
42284 <para>
42285 Matching headers are omitted from the message as it is transported, as described
42286 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
42287 routers.
42288 </para>
42289 <para>
42290 Unlike most options, <option>headers_remove</option> can be specified multiple times
42291 for a transport; all listed headers are removed.
42292 </para>
42293 <para>
42294 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
42295 items that contain a list separator must have it doubled.
42296 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
42297 </para>
42298 <para>
42299 <indexterm role="option">
42300 <primary><option>headers_rewrite</option></primary>
42301 </indexterm>
42302 </para>
42303 <informaltable frame="all">
42304 <tgroup cols="4" colsep="0" rowsep="0">
42305 <colspec colwidth="8*" align="left"/>
42306 <colspec colwidth="6*" align="center"/>
42307 <colspec colwidth="6*" align="center"/>
42308 <colspec colwidth="6*" align="right"/>
42309 <tbody>
42310 <row>
42311 <entry><option>headers_rewrite</option></entry>
42312 <entry>Use: <emphasis>transports</emphasis></entry>
42313 <entry>Type: <emphasis>string</emphasis></entry>
42314 <entry>Default: <emphasis>unset</emphasis></entry>
42315 </row>
42316 </tbody>
42317 </tgroup>
42318 </informaltable>
42319 <para>
42320 <indexterm role="concept">
42321 <primary>transport</primary>
42322 <secondary>header lines; rewriting</secondary>
42323 </indexterm>
42324 <indexterm role="concept">
42325 <primary>rewriting</primary>
42326 <secondary>at transport time</secondary>
42327 </indexterm>
42328 This option allows addresses in header lines to be rewritten at transport time,
42329 that is, as the message is being copied to its destination. The contents of the
42330 option are a colon-separated list of rewriting rules. Each rule is in exactly
42331 the same form as one of the general rewriting rules that are applied when a
42332 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
42333 example,
42334 </para>
42335 <literallayout class="monospaced">
42336 headers_rewrite = a@b c@d f : \
42337                   x@y w@z
42338 </literallayout>
42339 <para>
42340 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
42341 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
42342 header lines just before they are written out at transport time, so they affect
42343 only those copies of the message that pass through the transport. However, only
42344 the message&#x2019;s original header lines, and any that were added by a system
42345 filter, are rewritten. If a router or transport adds header lines, they are not
42346 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
42347 envelope. You can change the return path using <option>return_path</option>, but you cannot
42348 change envelope recipients at this time.
42349 </para>
42350 <para>
42351 <indexterm role="option">
42352 <primary><option>home_directory</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>home_directory</option></entry>
42364 <entry>Use: <emphasis>transports</emphasis></entry>
42365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></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>home directory for</secondary>
42375 </indexterm>
42376 <indexterm role="variable">
42377 <primary><varname>$home</varname></primary>
42378 </indexterm>
42379 This option specifies a home directory setting for a local transport,
42380 overriding any value that may be set by the router. The home directory is
42381 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
42382 used as the current directory if no current directory is set by the
42383 <option>current_directory</option> option on the transport or the
42384 <option>transport_current_directory</option> option on the router. If the expansion fails
42385 for any reason, including forced failure, an error is logged, and delivery is
42386 deferred.
42387 </para>
42388 <para>
42389 <indexterm role="option">
42390 <primary><option>initgroups</option></primary>
42391 </indexterm>
42392 </para>
42393 <informaltable frame="all">
42394 <tgroup cols="4" colsep="0" rowsep="0">
42395 <colspec colwidth="8*" align="left"/>
42396 <colspec colwidth="6*" align="center"/>
42397 <colspec colwidth="6*" align="center"/>
42398 <colspec colwidth="6*" align="right"/>
42399 <tbody>
42400 <row>
42401 <entry><option>initgroups</option></entry>
42402 <entry>Use: <emphasis>transports</emphasis></entry>
42403 <entry>Type: <emphasis>boolean</emphasis></entry>
42404 <entry>Default: <emphasis>false</emphasis></entry>
42405 </row>
42406 </tbody>
42407 </tgroup>
42408 </informaltable>
42409 <para>
42410 <indexterm role="concept">
42411 <primary>additional groups</primary>
42412 </indexterm>
42413 <indexterm role="concept">
42414 <primary>groups</primary>
42415 <secondary>additional</secondary>
42416 </indexterm>
42417 <indexterm role="concept">
42418 <primary>transport</primary>
42419 <secondary>group; additional</secondary>
42420 </indexterm>
42421 If this option is true and the uid for the delivery process is provided by the
42422 transport, the <function>initgroups()</function> function is called when running the transport
42423 to ensure that any additional groups associated with the uid are set up.
42424 </para>
42425 <para>
42426 <indexterm role="option">
42427 <primary><option>max_parallel</option></primary>
42428 </indexterm>
42429 </para>
42430 <informaltable frame="all">
42431 <tgroup cols="4" colsep="0" rowsep="0">
42432 <colspec colwidth="8*" align="left"/>
42433 <colspec colwidth="6*" align="center"/>
42434 <colspec colwidth="6*" align="center"/>
42435 <colspec colwidth="6*" align="right"/>
42436 <tbody>
42437 <row>
42438 <entry><option>max_parallel</option></entry>
42439 <entry>Use: <emphasis>transports</emphasis></entry>
42440 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
42441 <entry>Default: <emphasis>unset</emphasis></entry>
42442 </row>
42443 </tbody>
42444 </tgroup>
42445 </informaltable>
42446 <para>
42447 <indexterm role="concept">
42448 <primary>limit</primary>
42449 <secondary>transport parallelism</secondary>
42450 </indexterm>
42451 <indexterm role="concept">
42452 <primary>transport</primary>
42453 <secondary>parallel processes</secondary>
42454 </indexterm>
42455 <indexterm role="concept">
42456 <primary>transport</primary>
42457 <secondary>concurrency limit</secondary>
42458 </indexterm>
42459 <indexterm role="concept">
42460 <primary>delivery</primary>
42461 <secondary>parallelism for transport</secondary>
42462 </indexterm>
42463 If this option is set and expands to an integer greater than zero
42464 it limits the number of concurrent runs of the transport.
42465 The control does not apply to shadow transports.
42466 </para>
42467 <para>
42468 <indexterm role="concept">
42469 <primary>hints database</primary>
42470 <secondary>transport concurrency control</secondary>
42471 </indexterm>
42472 Exim implements this control by means of a hints database in which a record is
42473 incremented whenever a transport process is being created. The record
42474 is decremented and possibly removed when the process terminates.
42475 Obviously there is scope for
42476 records to get left lying around if there is a system or program crash. To
42477 guard against this, Exim ignores any records that are more than six hours old.
42478 </para>
42479 <para>
42480 If you use this option, you should also arrange to delete the
42481 relevant hints database whenever your system reboots. The names of the files
42482 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42483 may be one or two files, depending on the type of DBM in use. The same files
42484 are used for ETRN and smtp transport serialization.
42485 </para>
42486 <para>
42487 <indexterm role="option">
42488 <primary><option>message_size_limit</option></primary>
42489 </indexterm>
42490 </para>
42491 <informaltable frame="all">
42492 <tgroup cols="4" colsep="0" rowsep="0">
42493 <colspec colwidth="8*" align="left"/>
42494 <colspec colwidth="6*" align="center"/>
42495 <colspec colwidth="6*" align="center"/>
42496 <colspec colwidth="6*" align="right"/>
42497 <tbody>
42498 <row>
42499 <entry><option>message_size_limit</option></entry>
42500 <entry>Use: <emphasis>transports</emphasis></entry>
42501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42502 <entry>Default: <emphasis>0</emphasis></entry>
42503 </row>
42504 </tbody>
42505 </tgroup>
42506 </informaltable>
42507 <para>
42508 <indexterm role="concept">
42509 <primary>limit</primary>
42510 <secondary>message size per transport</secondary>
42511 </indexterm>
42512 <indexterm role="concept">
42513 <primary>size</primary>
42514 <secondary>of message, limit</secondary>
42515 </indexterm>
42516 <indexterm role="concept">
42517 <primary>transport</primary>
42518 <secondary>message size; limiting</secondary>
42519 </indexterm>
42520 This option controls the size of messages passed through the transport. It is
42521 expanded before use; the result of the expansion must be a sequence of decimal
42522 digits, optionally followed by K or M. If the expansion fails for any reason,
42523 including forced failure, or if the result is not of the required form,
42524 delivery is deferred. If the value is greater than zero and the size of a
42525 message exceeds this limit, the address is failed. If there is any chance that
42526 the resulting bounce message could be routed to the same transport, you should
42527 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
42528 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
42529 delivered.
42530 </para>
42531 <para>
42532 <indexterm role="option">
42533 <primary><option>rcpt_include_affixes</option></primary>
42534 </indexterm>
42535 </para>
42536 <informaltable frame="all">
42537 <tgroup cols="4" colsep="0" rowsep="0">
42538 <colspec colwidth="8*" align="left"/>
42539 <colspec colwidth="6*" align="center"/>
42540 <colspec colwidth="6*" align="center"/>
42541 <colspec colwidth="6*" align="right"/>
42542 <tbody>
42543 <row>
42544 <entry><option>rcpt_include_affixes</option></entry>
42545 <entry>Use: <emphasis>transports</emphasis></entry>
42546 <entry>Type: <emphasis>boolean</emphasis></entry>
42547 <entry>Default: <emphasis>false</emphasis></entry>
42548 </row>
42549 </tbody>
42550 </tgroup>
42551 </informaltable>
42552 <para>
42553 <indexterm role="concept">
42554 <primary>prefix</primary>
42555 <secondary>for local part, including in envelope</secondary>
42556 </indexterm>
42557 <indexterm role="concept">
42558 <primary>suffix for local part</primary>
42559 <secondary>including in envelope</secondary>
42560 </indexterm>
42561 <indexterm role="concept">
42562 <primary>local part</primary>
42563 <secondary>prefix</secondary>
42564 </indexterm>
42565 <indexterm role="concept">
42566 <primary>local part</primary>
42567 <secondary>suffix</secondary>
42568 </indexterm>
42569 When this option is false (the default), and an address that has had any
42570 affixes (prefixes or suffixes) removed from the local part is delivered by any
42571 form of SMTP or LMTP, the affixes are not included. For example, if a router
42572 that contains
42573 </para>
42574 <literallayout class="monospaced">
42575 local_part_prefix = *-
42576 </literallayout>
42577 <para>
42578 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
42579 is delivered with
42580 </para>
42581 <literallayout class="monospaced">
42582 RCPT TO:&lt;xyz@some.domain&gt;
42583 </literallayout>
42584 <para>
42585 This is also the case when an ACL-time callout is being used to verify a
42586 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
42587 whole local part is included in the RCPT command. This option applies to BSMTP
42588 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
42589 <command>lmtp</command> and <command>smtp</command> transports.
42590 </para>
42591 <para>
42592 <indexterm role="option">
42593 <primary><option>retry_use_local_part</option></primary>
42594 </indexterm>
42595 </para>
42596 <informaltable frame="all">
42597 <tgroup cols="4" colsep="0" rowsep="0">
42598 <colspec colwidth="8*" align="left"/>
42599 <colspec colwidth="6*" align="center"/>
42600 <colspec colwidth="6*" align="center"/>
42601 <colspec colwidth="6*" align="right"/>
42602 <tbody>
42603 <row>
42604 <entry><option>retry_use_local_part</option></entry>
42605 <entry>Use: <emphasis>transports</emphasis></entry>
42606 <entry>Type: <emphasis>boolean</emphasis></entry>
42607 <entry>Default: <emphasis>see below</emphasis></entry>
42608 </row>
42609 </tbody>
42610 </tgroup>
42611 </informaltable>
42612 <para>
42613 <indexterm role="concept">
42614 <primary>hints database</primary>
42615 <secondary>retry keys</secondary>
42616 </indexterm>
42617 When a delivery suffers a temporary failure, a retry record is created
42618 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
42619 is based on the name and/or IP address of the failing remote host. For local
42620 deliveries, the key is normally the entire address, including both the local
42621 part and the domain. This is suitable for most common cases of local delivery
42622 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
42623 deliveries to that mailbox, not to the whole domain.
42624 </para>
42625 <para>
42626 However, in some special cases you may want to treat a temporary local delivery
42627 as a failure associated with the domain, and not with a particular local part.
42628 (For example, if you are storing all mail for some domain in files.) You can do
42629 this by setting <option>retry_use_local_part</option> false.
42630 </para>
42631 <para>
42632 For all the local transports, its default value is true. For remote transports,
42633 the default value is false for tidiness, but changing the value has no effect
42634 on a remote transport in the current implementation.
42635 </para>
42636 <para>
42637 <indexterm role="option">
42638 <primary><option>return_path</option></primary>
42639 </indexterm>
42640 </para>
42641 <informaltable frame="all">
42642 <tgroup cols="4" colsep="0" rowsep="0">
42643 <colspec colwidth="8*" align="left"/>
42644 <colspec colwidth="6*" align="center"/>
42645 <colspec colwidth="6*" align="center"/>
42646 <colspec colwidth="6*" align="right"/>
42647 <tbody>
42648 <row>
42649 <entry><option>return_path</option></entry>
42650 <entry>Use: <emphasis>transports</emphasis></entry>
42651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42652 <entry>Default: <emphasis>unset</emphasis></entry>
42653 </row>
42654 </tbody>
42655 </tgroup>
42656 </informaltable>
42657 <para>
42658 <indexterm role="concept">
42659 <primary>envelope sender</primary>
42660 </indexterm>
42661 <indexterm role="concept">
42662 <primary>envelope from</primary>
42663 </indexterm>
42664 <indexterm role="concept">
42665 <primary>transport</primary>
42666 <secondary>return path; changing</secondary>
42667 </indexterm>
42668 <indexterm role="concept">
42669 <primary>return path</primary>
42670 <secondary>changing in transport</secondary>
42671 </indexterm>
42672 If this option is set, the string is expanded at transport time and replaces
42673 the existing return path (envelope sender) value in the copy of the message
42674 that is being delivered. An empty return path is permitted. This feature is
42675 designed for remote deliveries, where the value of this option is used in the
42676 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
42677 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
42678 header line, if one is added to the message (see the next option).
42679 </para>
42680 <para>
42681 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
42682 <option>return_path_on_delivery</option> to the log selector.
42683 </para>
42684 <para>
42685 <indexterm role="variable">
42686 <primary><varname>$return_path</varname></primary>
42687 </indexterm>
42688 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
42689 either the message&#x2019;s envelope sender, or an address set by the
42690 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
42691 replacement occurs; if it fails for another reason, delivery is deferred. This
42692 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
42693 section <xref linkend="SECTverp"/>.
42694 </para>
42695 <para>
42696 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
42697 remote server rejects a message at SMTP time, the bounce message is not sent to
42698 the value of this option. It is sent to the previously set errors address.
42699 This defaults to the incoming sender address, but can be changed by setting
42700 <option>errors_to</option> in a router.
42701 </para>
42702 <para>
42703 <indexterm role="option">
42704 <primary><option>return_path_add</option></primary>
42705 </indexterm>
42706 </para>
42707 <informaltable frame="all">
42708 <tgroup cols="4" colsep="0" rowsep="0">
42709 <colspec colwidth="8*" align="left"/>
42710 <colspec colwidth="6*" align="center"/>
42711 <colspec colwidth="6*" align="center"/>
42712 <colspec colwidth="6*" align="right"/>
42713 <tbody>
42714 <row>
42715 <entry><option>return_path_add</option></entry>
42716 <entry>Use: <emphasis>transports</emphasis></entry>
42717 <entry>Type: <emphasis>boolean</emphasis></entry>
42718 <entry>Default: <emphasis>false</emphasis></entry>
42719 </row>
42720 </tbody>
42721 </tgroup>
42722 </informaltable>
42723 <para>
42724 <indexterm role="concept">
42725 <primary><emphasis>Return-path:</emphasis> header line</primary>
42726 </indexterm>
42727 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
42728 Although the return path is normally available in the prefix line of BSD
42729 mailboxes, this is commonly not displayed by MUAs, and so the user does not
42730 have easy access to it.
42731 </para>
42732 <para>
42733 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
42734 the delivery SMTP server makes the final delivery</quote>. This implies that this
42735 header should not be present in incoming messages. Exim has a configuration
42736 option, <option>return_path_remove</option>, which requests removal of this header from
42737 incoming messages, so that delivered messages can safely be resent to other
42738 recipients.
42739 </para>
42740 <para>
42741 <indexterm role="option">
42742 <primary><option>shadow_condition</option></primary>
42743 </indexterm>
42744 </para>
42745 <informaltable frame="all">
42746 <tgroup cols="4" colsep="0" rowsep="0">
42747 <colspec colwidth="8*" align="left"/>
42748 <colspec colwidth="6*" align="center"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="right"/>
42751 <tbody>
42752 <row>
42753 <entry><option>shadow_condition</option></entry>
42754 <entry>Use: <emphasis>transports</emphasis></entry>
42755 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42756 <entry>Default: <emphasis>unset</emphasis></entry>
42757 </row>
42758 </tbody>
42759 </tgroup>
42760 </informaltable>
42761 <para>
42762 See <option>shadow_transport</option> below.
42763 </para>
42764 <para>
42765 <indexterm role="option">
42766 <primary><option>shadow_transport</option></primary>
42767 </indexterm>
42768 </para>
42769 <informaltable frame="all">
42770 <tgroup cols="4" colsep="0" rowsep="0">
42771 <colspec colwidth="8*" align="left"/>
42772 <colspec colwidth="6*" align="center"/>
42773 <colspec colwidth="6*" align="center"/>
42774 <colspec colwidth="6*" align="right"/>
42775 <tbody>
42776 <row>
42777 <entry><option>shadow_transport</option></entry>
42778 <entry>Use: <emphasis>transports</emphasis></entry>
42779 <entry>Type: <emphasis>string</emphasis></entry>
42780 <entry>Default: <emphasis>unset</emphasis></entry>
42781 </row>
42782 </tbody>
42783 </tgroup>
42784 </informaltable>
42785 <para>
42786 <indexterm role="concept">
42787 <primary>shadow transport</primary>
42788 </indexterm>
42789 <indexterm role="concept">
42790 <primary>transport</primary>
42791 <secondary>shadow</secondary>
42792 </indexterm>
42793 A local transport may set the <option>shadow_transport</option> option to the name of
42794 another local transport. Shadow remote transports are not supported.
42795 </para>
42796 <para>
42797 Whenever a delivery to the main transport succeeds, and either
42798 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
42799 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
42800 passed to the shadow transport, with the same delivery address or addresses. If
42801 expansion fails, no action is taken except that non-forced expansion failures
42802 cause a log line to be written.
42803 </para>
42804 <para>
42805 The result of the shadow transport is discarded and does not affect the
42806 subsequent processing of the message. Only a single level of shadowing is
42807 provided; the <option>shadow_transport</option> option is ignored on any transport when it
42808 is running as a shadow. Options concerned with output from pipes are also
42809 ignored. The log line for the successful delivery has an item added on the end,
42810 of the form
42811 </para>
42812 <literallayout class="monospaced">
42813 ST=&lt;shadow transport name&gt;
42814 </literallayout>
42815 <para>
42816 If the shadow transport did not succeed, the error message is put in
42817 parentheses afterwards. Shadow transports can be used for a number of different
42818 purposes, including keeping more detailed log information than Exim normally
42819 provides, and implementing automatic acknowledgment policies based on message
42820 headers that some sites insist on.
42821 </para>
42822 <para>
42823 <indexterm role="option">
42824 <primary><option>transport_filter</option></primary>
42825 </indexterm>
42826 </para>
42827 <informaltable frame="all">
42828 <tgroup cols="4" colsep="0" rowsep="0">
42829 <colspec colwidth="8*" align="left"/>
42830 <colspec colwidth="6*" align="center"/>
42831 <colspec colwidth="6*" align="center"/>
42832 <colspec colwidth="6*" align="right"/>
42833 <tbody>
42834 <row>
42835 <entry><option>transport_filter</option></entry>
42836 <entry>Use: <emphasis>transports</emphasis></entry>
42837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42838 <entry>Default: <emphasis>unset</emphasis></entry>
42839 </row>
42840 </tbody>
42841 </tgroup>
42842 </informaltable>
42843 <para>
42844 <indexterm role="concept">
42845 <primary>transport</primary>
42846 <secondary>filter</secondary>
42847 </indexterm>
42848 <indexterm role="concept">
42849 <primary>filter</primary>
42850 <secondary>transport filter</secondary>
42851 </indexterm>
42852 This option sets up a filtering (in the Unix shell sense) process for messages
42853 at transport time. It should not be confused with mail filtering as set up by
42854 individual users or via a system filter.
42855 If unset, or expanding to an empty string, no filtering is done.
42856 </para>
42857 <para>
42858 When the message is about to be written out, the command specified by
42859 <option>transport_filter</option> is started up in a separate, parallel process, and
42860 the entire message, including the header lines, is passed to it on its standard
42861 input (this in fact is done from a third process, to avoid deadlock). The
42862 command must be specified as an absolute path.
42863 </para>
42864 <para>
42865 The lines of the message that are written to the transport filter are
42866 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
42867 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
42868 lines beginning with a dot, and also before any processing implied by the
42869 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
42870 <command>pipe</command> transports.
42871 </para>
42872 <para>
42873 The standard error for the filter process is set to the same destination as its
42874 standard output; this is read and written to the message&#x2019;s ultimate
42875 destination. The process that writes the message to the filter, the
42876 filter itself, and the original process that reads the result and delivers it
42877 are all run in parallel, like a shell pipeline.
42878 </para>
42879 <para>
42880 The filter can perform any transformations it likes, but of course should take
42881 care not to break RFC 2822 syntax. Exim does not check the result, except to
42882 test for a final newline when SMTP is in use. All messages transmitted over
42883 SMTP must end with a newline, so Exim supplies one if it is missing.
42884 </para>
42885 <para>
42886 <indexterm role="concept">
42887 <primary>content scanning</primary>
42888 <secondary>per user</secondary>
42889 </indexterm>
42890 A transport filter can be used to provide content-scanning on a per-user basis
42891 at delivery time if the only required effect of the scan is to modify the
42892 message. For example, a content scan could insert a new header line containing
42893 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
42894 not possible to discard a message at this stage.
42895 </para>
42896 <para>
42897 <indexterm role="concept">
42898 <primary>SIZE</primary>
42899 <secondary>ESMTP extension</secondary>
42900 </indexterm>
42901 A problem might arise if the filter increases the size of a message that is
42902 being sent down an SMTP connection. If the receiving SMTP server has indicated
42903 support for the SIZE parameter, Exim will have sent the size of the message
42904 at the start of the SMTP session. If what is actually sent is substantially
42905 more, the server might reject the message. This can be worked round by setting
42906 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
42907 additions to the message, or to disable the use of SIZE altogether.
42908 </para>
42909 <para>
42910 <indexterm role="variable">
42911 <primary><varname>$pipe_addresses</varname></primary>
42912 </indexterm>
42913 The value of the <option>transport_filter</option> option is the command string for starting
42914 the filter, which is run directly from Exim, not under a shell. The string is
42915 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
42916 Exim breaks it up into arguments and then expands each argument separately (see
42917 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
42918 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
42919 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
42920 an ideal name for this feature here, but as it was already implemented for the
42921 <command>pipe</command> transport, it seemed sensible not to change it.)
42922 </para>
42923 <para>
42924 <indexterm role="variable">
42925 <primary><varname>$host</varname></primary>
42926 </indexterm>
42927 <indexterm role="variable">
42928 <primary><varname>$host_address</varname></primary>
42929 </indexterm>
42930 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
42931 transport is a remote one. They contain the name and IP address of the host to
42932 which the message is being sent. For example:
42933 </para>
42934 <literallayout class="monospaced">
42935 transport_filter = /some/directory/transport-filter.pl \
42936   $host $host_address $sender_address $pipe_addresses
42937 </literallayout>
42938 <para>
42939 Two problems arise if you want to use more complicated expansion items to
42940 generate transport filter commands, both of which due to the fact that the
42941 command is split up <emphasis>before</emphasis> expansion.
42942 </para>
42943 <itemizedlist>
42944 <listitem>
42945 <para>
42946 If an expansion item contains white space, you must quote it, so that it is all
42947 part of the same command item. If the entire option setting is one such
42948 expansion item, you have to take care what kind of quoting you use. For
42949 example:
42950 </para>
42951 <literallayout class="monospaced">
42952 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
42953 </literallayout>
42954 <para>
42955 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
42956 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
42957 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
42958 the single quotes were missing, the line would be split into two items,
42959 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
42960 Exim tried to expand the first one.
42961 </para>
42962 </listitem>
42963 <listitem>
42964 <para>
42965 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
42966 expansion cannot generate multiple arguments, or a command name followed by
42967 arguments. Consider this example:
42968 </para>
42969 <literallayout class="monospaced">
42970 transport_filter = ${lookup{$host}lsearch{/a/file}\
42971                     {$value}{/bin/cat}}
42972 </literallayout>
42973 <para>
42974 The result of the lookup is interpreted as the name of the command, even
42975 if it contains white space. The simplest way round this is to use a shell:
42976 </para>
42977 <literallayout class="monospaced">
42978 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
42979                                {$value}{/bin/cat}}
42980 </literallayout>
42981 </listitem>
42982 </itemizedlist>
42983 <para>
42984 The filter process is run under the same uid and gid as the normal delivery.
42985 For remote deliveries this is the Exim uid/gid by default. The command should
42986 normally yield a zero return code. Transport filters are not supposed to fail.
42987 A non-zero code is taken to mean that the transport filter encountered some
42988 serious problem. Delivery of the message is deferred; the message remains on
42989 the queue and is tried again later. It is not possible to cause a message to be
42990 bounced from a transport filter.
42991 </para>
42992 <para>
42993 If a transport filter is set on an autoreply transport, the original message is
42994 passed through the filter as it is being copied into the newly generated
42995 message, which happens if the <option>return_message</option> option is set.
42996 </para>
42997 <para>
42998 <indexterm role="option">
42999 <primary><option>transport_filter_timeout</option></primary>
43000 </indexterm>
43001 </para>
43002 <informaltable frame="all">
43003 <tgroup cols="4" colsep="0" rowsep="0">
43004 <colspec colwidth="8*" align="left"/>
43005 <colspec colwidth="6*" align="center"/>
43006 <colspec colwidth="6*" align="center"/>
43007 <colspec colwidth="6*" align="right"/>
43008 <tbody>
43009 <row>
43010 <entry><option>transport_filter_timeout</option></entry>
43011 <entry>Use: <emphasis>transports</emphasis></entry>
43012 <entry>Type: <emphasis>time</emphasis></entry>
43013 <entry>Default: <emphasis>5m</emphasis></entry>
43014 </row>
43015 </tbody>
43016 </tgroup>
43017 </informaltable>
43018 <para>
43019 <indexterm role="concept">
43020 <primary>transport</primary>
43021 <secondary>filter, timeout</secondary>
43022 </indexterm>
43023 When Exim is reading the output of a transport filter, it applies a timeout
43024 that can be set by this option. Exceeding the timeout is normally treated as a
43025 temporary delivery failure. However, if a transport filter is used with a
43026 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
43027 way as a timeout in the pipe command itself. By default, a timeout is a hard
43028 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
43029 becomes a temporary error.
43030 </para>
43031 <para>
43032 <indexterm role="option">
43033 <primary><option>user</option></primary>
43034 </indexterm>
43035 </para>
43036 <informaltable frame="all">
43037 <tgroup cols="4" colsep="0" rowsep="0">
43038 <colspec colwidth="8*" align="left"/>
43039 <colspec colwidth="6*" align="center"/>
43040 <colspec colwidth="6*" align="center"/>
43041 <colspec colwidth="6*" align="right"/>
43042 <tbody>
43043 <row>
43044 <entry><option>user</option></entry>
43045 <entry>Use: <emphasis>transports</emphasis></entry>
43046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43047 <entry>Default: <emphasis>Exim user</emphasis></entry>
43048 </row>
43049 </tbody>
43050 </tgroup>
43051 </informaltable>
43052 <para>
43053 <indexterm role="concept">
43054 <primary>uid (user id)</primary>
43055 <secondary>local delivery</secondary>
43056 </indexterm>
43057 <indexterm role="concept">
43058 <primary>transport</primary>
43059 <secondary>user, specifying</secondary>
43060 </indexterm>
43061 This option specifies the user under whose uid the delivery process is to be
43062 run, overriding any uid that may have been set by the router. If the user is
43063 given as a name, the uid is looked up from the password data, and the
43064 associated group is taken as the value of the gid to be used if the <option>group</option>
43065 option is not set.
43066 </para>
43067 <para>
43068 For deliveries that use local transports, a user and group are normally
43069 specified explicitly or implicitly (for example, as a result of
43070 <option>check_local_user</option>) by the router or transport.
43071 </para>
43072 <para>
43073 <indexterm role="concept">
43074 <primary>hints database</primary>
43075 <secondary>access by remote transport</secondary>
43076 </indexterm>
43077 For remote transports, you should leave this option unset unless you really are
43078 sure you know what you are doing. When a remote transport is running, it needs
43079 to be able to access Exim&#x2019;s hints databases, because each host may have its own
43080 retry data.
43081 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
43082 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
43083 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
43084 </para>
43085 </chapter>
43086
43087 <chapter id="CHAPbatching">
43088 <title>Address batching in local transports</title>
43089 <titleabbrev>Address batching</titleabbrev>
43090 <para>
43091 <indexterm role="concept">
43092 <primary>transport</primary>
43093 <secondary>local; address batching in</secondary>
43094 </indexterm>
43095 The only remote transport (<command>smtp</command>) is normally configured to handle more than
43096 one address at a time, so that when several addresses are routed to the same
43097 remote host, just one copy of the message is sent. Local transports, however,
43098 normally handle one address at a time. That is, a separate instance of the
43099 transport is run for each address that is routed to the transport. A separate
43100 copy of the message is delivered each time.
43101 </para>
43102 <para>
43103 <indexterm role="concept">
43104 <primary>batched local delivery</primary>
43105 </indexterm>
43106 <indexterm role="option">
43107 <primary><option>batch_max</option></primary>
43108 </indexterm>
43109 <indexterm role="option">
43110 <primary><option>batch_id</option></primary>
43111 </indexterm>
43112 In special cases, it may be desirable to handle several addresses at once in a
43113 local transport, for example:
43114 </para>
43115 <itemizedlist>
43116 <listitem>
43117 <para>
43118 In an <command>appendfile</command> transport, when storing messages in files for later
43119 delivery by some other means, a single copy of the message with multiple
43120 recipients saves space.
43121 </para>
43122 </listitem>
43123 <listitem>
43124 <para>
43125 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
43126 a single copy saves time, and is the normal way LMTP is expected to work.
43127 </para>
43128 </listitem>
43129 <listitem>
43130 <para>
43131 In a <command>pipe</command> transport, when passing the message
43132 to a scanner program or
43133 to some other delivery mechanism such as UUCP, multiple recipients may be
43134 acceptable.
43135 </para>
43136 </listitem>
43137 </itemizedlist>
43138 <para>
43139 These three local transports all have the same options for controlling multiple
43140 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
43141 repeating the information for each transport, these options are described here.
43142 </para>
43143 <para>
43144 The <option>batch_max</option> option specifies the maximum number of addresses that can be
43145 delivered together in a single run of the transport. Its default value is one
43146 (no batching). When more than one address is routed to a transport that has a
43147 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
43148 (that is, in a single run of the transport with multiple recipients), subject
43149 to certain conditions:
43150 </para>
43151 <itemizedlist>
43152 <listitem>
43153 <para>
43154 <indexterm role="variable">
43155 <primary><varname>$local_part</varname></primary>
43156 </indexterm>
43157 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
43158 batching is possible.
43159 </para>
43160 </listitem>
43161 <listitem>
43162 <para>
43163 <indexterm role="variable">
43164 <primary><varname>$domain</varname></primary>
43165 </indexterm>
43166 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
43167 addresses with the same domain are batched.
43168 </para>
43169 </listitem>
43170 <listitem>
43171 <para>
43172 <indexterm role="concept">
43173 <primary>customizing</primary>
43174 <secondary>batching condition</secondary>
43175 </indexterm>
43176 If <option>batch_id</option> is set, it is expanded for each address, and only those
43177 addresses with the same expanded value are batched. This allows you to specify
43178 customized batching conditions. Failure of the expansion for any reason,
43179 including forced failure, disables batching, but it does not stop the delivery
43180 from taking place.
43181 </para>
43182 </listitem>
43183 <listitem>
43184 <para>
43185 Batched addresses must also have the same errors address (where to send
43186 delivery errors), the same header additions and removals, the same user and
43187 group for the transport, and if a host list is present, the first host must
43188 be the same.
43189 </para>
43190 </listitem>
43191 </itemizedlist>
43192 <para>
43193 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
43194 both when the file or pipe command is specified in the transport, and when it
43195 is specified by a <command>redirect</command> router, but all the batched addresses must of
43196 course be routed to the same file or pipe command. These two transports have an
43197 option called <option>use_bsmtp</option>, which causes them to deliver the message in
43198 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
43199 <option>check_string</option> and <option>escape_string</option> options are forced to the values
43200 </para>
43201 <literallayout class="monospaced">
43202 check_string = "."
43203 escape_string = ".."
43204 </literallayout>
43205 <para>
43206 when batched SMTP is in use. A full description of the batch SMTP mechanism is
43207 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
43208 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
43209 </para>
43210 <para>
43211 <indexterm role="concept">
43212 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
43213 </indexterm>
43214 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
43215 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
43216 that are being processed together. If you are using a batching <command>appendfile</command>
43217 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
43218 addresses is to set the <option>envelope_to_add</option> option.
43219 </para>
43220 <para>
43221 <indexterm role="concept">
43222 <primary><command>pipe</command> transport</primary>
43223 <secondary>with multiple addresses</secondary>
43224 </indexterm>
43225 <indexterm role="variable">
43226 <primary><varname>$pipe_addresses</varname></primary>
43227 </indexterm>
43228 If you are using a <command>pipe</command> transport without BSMTP, and setting the
43229 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
43230 the command. This is not a true variable; it is a bit of magic that causes each
43231 of the recipient addresses to be inserted into the command as a separate
43232 argument. This provides a way of accessing all the addresses that are being
43233 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
43234 are specified by a <command>redirect</command> router.
43235 </para>
43236 </chapter>
43237
43238 <chapter id="CHAPappendfile">
43239 <title>The appendfile transport</title>
43240 <para>
43241 <indexterm role="concept" id="IIDapptra1" class="startofrange">
43242 <primary><command>appendfile</command> transport</primary>
43243 </indexterm>
43244 <indexterm role="concept" id="IIDapptra2" class="startofrange">
43245 <primary>transports</primary>
43246 <secondary><command>appendfile</command></secondary>
43247 </indexterm>
43248 <indexterm role="concept">
43249 <primary>directory creation</primary>
43250 </indexterm>
43251 <indexterm role="concept">
43252 <primary>creating directories</primary>
43253 </indexterm>
43254 The <command>appendfile</command> transport delivers a message by appending it to an existing
43255 file, or by creating an entirely new file in a specified directory. Single
43256 files to which messages are appended can be in the traditional Unix mailbox
43257 format, or optionally in the MBX format supported by the Pine MUA and
43258 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
43259 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
43260 to give added protection against failures that happen part-way through the
43261 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
43262 supported. For all file formats, Exim attempts to create as many levels of
43263 directory as necessary, provided that <option>create_directory</option> is set.
43264 </para>
43265 <para>
43266 The code for the optional formats is not included in the Exim binary by
43267 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
43268 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
43269 included.
43270 </para>
43271 <para>
43272 <indexterm role="concept">
43273 <primary>quota</primary>
43274 <secondary>system</secondary>
43275 </indexterm>
43276 Exim recognizes system quota errors, and generates an appropriate message. Exim
43277 also supports its own quota control within the transport, for use when the
43278 system facility is unavailable or cannot be used for some reason.
43279 </para>
43280 <para>
43281 If there is an error while appending to a file (for example, quota exceeded or
43282 partition filled), Exim attempts to reset the file&#x2019;s length and last
43283 modification time back to what they were before. If there is an error while
43284 creating an entirely new file, the new file is removed.
43285 </para>
43286 <para>
43287 Before appending to a file, a number of security checks are made, and the
43288 file is locked. A detailed description is given below, after the list of
43289 private options.
43290 </para>
43291 <para>
43292 The <command>appendfile</command> transport is most commonly used for local deliveries to
43293 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
43294 putting messages into files for remote delivery by some means other than Exim.
43295 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
43296 option).
43297 </para>
43298 <section id="SECTfildiropt">
43299 <title>The file and directory options</title>
43300 <para>
43301 The <option>file</option> option specifies a single file, to which the message is appended;
43302 the <option>directory</option> option specifies a directory, in which a new file containing
43303 the message is created. Only one of these two options can be set, and for
43304 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
43305 </para>
43306 <para>
43307 <indexterm role="variable">
43308 <primary><varname>$address_file</varname></primary>
43309 </indexterm>
43310 <indexterm role="variable">
43311 <primary><varname>$local_part</varname></primary>
43312 </indexterm>
43313 However, <command>appendfile</command> is also used for delivering messages to files or
43314 directories whose names (or parts of names) are obtained from alias,
43315 forwarding, or filtering operations (for example, a <option>save</option> command in a
43316 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
43317 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
43318 name (or partial name) of the file or directory generated by the redirection
43319 operation. There are two cases:
43320 </para>
43321 <itemizedlist>
43322 <listitem>
43323 <para>
43324 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
43325 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
43326 common case when users with local accounts use filtering to sort mail into
43327 different folders. See for example, the <command>address_file</command> transport in the
43328 default configuration. If the path ends with a slash, it is assumed to be the
43329 name of a directory. A delivery to a directory can also be forced by setting
43330 <option>maildir_format</option> or <option>mailstore_format</option>.
43331 </para>
43332 </listitem>
43333 <listitem>
43334 <para>
43335 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
43336 used to determine the file or directory name for the delivery. Normally, the
43337 contents of <varname>$address_file</varname> are used in some way in the string expansion.
43338 </para>
43339 </listitem>
43340 </itemizedlist>
43341 <para revisionflag="changed">
43342 <indexterm role="concept">
43343 <primary>tainted data</primary>
43344 <secondary>in filenames</secondary>
43345 </indexterm>
43346 <indexterm role="concept">
43347 <primary>appendfile</primary>
43348 <secondary>tainted data</secondary>
43349 </indexterm>
43350 Tainted data may not be used for a file or directory name.
43351 This means that, for instance, <varname>$local_part</varname> cannot be used directly
43352 as a component of a path.  It can however be used as the key for a lookup
43353 which returns a path (or component).
43354 </para>
43355 <para>
43356 <indexterm role="concept">
43357 <primary>Sieve filter</primary>
43358 <secondary>configuring <command>appendfile</command></secondary>
43359 </indexterm>
43360 <indexterm role="concept">
43361 <primary>Sieve filter</primary>
43362 <secondary>relative mailbox path handling</secondary>
43363 </indexterm>
43364 As an example of the second case, consider an environment where users do not
43365 have home directories. They may be permitted to use Exim filter commands of the
43366 form:
43367 </para>
43368 <literallayout class="monospaced">
43369 save folder23
43370 </literallayout>
43371 <para>
43372 or Sieve filter commands of the form:
43373 </para>
43374 <literallayout class="monospaced">
43375 require "fileinto";
43376 fileinto "folder23";
43377 </literallayout>
43378 <para>
43379 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
43380 must transform the relative path into an appropriate absolute filename. In the
43381 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
43382 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
43383 way of handling this requirement:
43384 </para>
43385 <literallayout class="monospaced">
43386 file = ${if eq{$address_file}{inbox} \
43387             {/var/mail/$local_part_data} \
43388             {${if eq{${substr_0_1:$address_file}}{/} \
43389                   {$address_file} \
43390                   {$home/mail/$address_file} \
43391             }} \
43392        }
43393 </literallayout>
43394 <para>
43395 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
43396 location, absolute paths are used without change, and other folders are in the
43397 <filename>mail</filename> directory within the home directory.
43398 </para>
43399 <para>
43400 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
43401 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
43402 the router. In particular, this is the case if <option>check_local_user</option> is set. If
43403 you want to prevent this happening at routing time, you can set
43404 <option>router_home_directory</option> empty. This forces the router to pass the relative
43405 path to the transport.
43406 </para>
43407 <para>
43408 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
43409 the <option>file</option> or <option>directory</option> option is still used if it is set.
43410 </para>
43411 </section>
43412 <section id="SECID134">
43413 <title>Private options for appendfile</title>
43414 <para>
43415 <indexterm role="concept">
43416 <primary>options</primary>
43417 <secondary><command>appendfile</command> transport</secondary>
43418 </indexterm>
43419 </para>
43420 <para>
43421 <indexterm role="option">
43422 <primary><option>allow_fifo</option></primary>
43423 </indexterm>
43424 </para>
43425 <informaltable frame="all">
43426 <tgroup cols="4" colsep="0" rowsep="0">
43427 <colspec colwidth="8*" align="left"/>
43428 <colspec colwidth="6*" align="center"/>
43429 <colspec colwidth="6*" align="center"/>
43430 <colspec colwidth="6*" align="right"/>
43431 <tbody>
43432 <row>
43433 <entry><option>allow_fifo</option></entry>
43434 <entry>Use: <emphasis>appendfile</emphasis></entry>
43435 <entry>Type: <emphasis>boolean</emphasis></entry>
43436 <entry>Default: <emphasis>false</emphasis></entry>
43437 </row>
43438 </tbody>
43439 </tgroup>
43440 </informaltable>
43441 <para>
43442 <indexterm role="concept">
43443 <primary>fifo (named pipe)</primary>
43444 </indexterm>
43445 <indexterm role="concept">
43446 <primary>named pipe (fifo)</primary>
43447 </indexterm>
43448 <indexterm role="concept">
43449 <primary>pipe</primary>
43450 <secondary>named (fifo)</secondary>
43451 </indexterm>
43452 Setting this option permits delivery to named pipes (FIFOs) as well as to
43453 regular files. If no process is reading the named pipe at delivery time, the
43454 delivery is deferred.
43455 </para>
43456 <para>
43457 <indexterm role="option">
43458 <primary><option>allow_symlink</option></primary>
43459 </indexterm>
43460 </para>
43461 <informaltable frame="all">
43462 <tgroup cols="4" colsep="0" rowsep="0">
43463 <colspec colwidth="8*" align="left"/>
43464 <colspec colwidth="6*" align="center"/>
43465 <colspec colwidth="6*" align="center"/>
43466 <colspec colwidth="6*" align="right"/>
43467 <tbody>
43468 <row>
43469 <entry><option>allow_symlink</option></entry>
43470 <entry>Use: <emphasis>appendfile</emphasis></entry>
43471 <entry>Type: <emphasis>boolean</emphasis></entry>
43472 <entry>Default: <emphasis>false</emphasis></entry>
43473 </row>
43474 </tbody>
43475 </tgroup>
43476 </informaltable>
43477 <para>
43478 <indexterm role="concept">
43479 <primary>symbolic link</primary>
43480 <secondary>to mailbox</secondary>
43481 </indexterm>
43482 <indexterm role="concept">
43483 <primary>mailbox</primary>
43484 <secondary>symbolic link</secondary>
43485 </indexterm>
43486 By default, <command>appendfile</command> will not deliver if the path name for the file is
43487 that of a symbolic link. Setting this option relaxes that constraint, but there
43488 are security issues involved in the use of symbolic links. Be sure you know
43489 what you are doing if you set this. Details of exactly what this option affects
43490 are included in the discussion which follows this list of options.
43491 </para>
43492 <para>
43493 <indexterm role="option">
43494 <primary><option>batch_id</option></primary>
43495 </indexterm>
43496 </para>
43497 <informaltable frame="all">
43498 <tgroup cols="4" colsep="0" rowsep="0">
43499 <colspec colwidth="8*" align="left"/>
43500 <colspec colwidth="6*" align="center"/>
43501 <colspec colwidth="6*" align="center"/>
43502 <colspec colwidth="6*" align="right"/>
43503 <tbody>
43504 <row>
43505 <entry><option>batch_id</option></entry>
43506 <entry>Use: <emphasis>appendfile</emphasis></entry>
43507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43508 <entry>Default: <emphasis>unset</emphasis></entry>
43509 </row>
43510 </tbody>
43511 </tgroup>
43512 </informaltable>
43513 <para>
43514 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43515 However, batching is automatically disabled for <command>appendfile</command> deliveries that
43516 happen as a result of forwarding or aliasing or other redirection directly to a
43517 file.
43518 </para>
43519 <para>
43520 <indexterm role="option">
43521 <primary><option>batch_max</option></primary>
43522 </indexterm>
43523 </para>
43524 <informaltable frame="all">
43525 <tgroup cols="4" colsep="0" rowsep="0">
43526 <colspec colwidth="8*" align="left"/>
43527 <colspec colwidth="6*" align="center"/>
43528 <colspec colwidth="6*" align="center"/>
43529 <colspec colwidth="6*" align="right"/>
43530 <tbody>
43531 <row>
43532 <entry><option>batch_max</option></entry>
43533 <entry>Use: <emphasis>appendfile</emphasis></entry>
43534 <entry>Type: <emphasis>integer</emphasis></entry>
43535 <entry>Default: <emphasis>1</emphasis></entry>
43536 </row>
43537 </tbody>
43538 </tgroup>
43539 </informaltable>
43540 <para>
43541 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43542 </para>
43543 <para>
43544 <indexterm role="option">
43545 <primary><option>check_group</option></primary>
43546 </indexterm>
43547 </para>
43548 <informaltable frame="all">
43549 <tgroup cols="4" colsep="0" rowsep="0">
43550 <colspec colwidth="8*" align="left"/>
43551 <colspec colwidth="6*" align="center"/>
43552 <colspec colwidth="6*" align="center"/>
43553 <colspec colwidth="6*" align="right"/>
43554 <tbody>
43555 <row>
43556 <entry><option>check_group</option></entry>
43557 <entry>Use: <emphasis>appendfile</emphasis></entry>
43558 <entry>Type: <emphasis>boolean</emphasis></entry>
43559 <entry>Default: <emphasis>false</emphasis></entry>
43560 </row>
43561 </tbody>
43562 </tgroup>
43563 </informaltable>
43564 <para>
43565 When this option is set, the group owner of the file defined by the <option>file</option>
43566 option is checked to see that it is the same as the group under which the
43567 delivery process is running. The default setting is false because the default
43568 file mode is 0600, which means that the group is irrelevant.
43569 </para>
43570 <para>
43571 <indexterm role="option">
43572 <primary><option>check_owner</option></primary>
43573 </indexterm>
43574 </para>
43575 <informaltable frame="all">
43576 <tgroup cols="4" colsep="0" rowsep="0">
43577 <colspec colwidth="8*" align="left"/>
43578 <colspec colwidth="6*" align="center"/>
43579 <colspec colwidth="6*" align="center"/>
43580 <colspec colwidth="6*" align="right"/>
43581 <tbody>
43582 <row>
43583 <entry><option>check_owner</option></entry>
43584 <entry>Use: <emphasis>appendfile</emphasis></entry>
43585 <entry>Type: <emphasis>boolean</emphasis></entry>
43586 <entry>Default: <emphasis>true</emphasis></entry>
43587 </row>
43588 </tbody>
43589 </tgroup>
43590 </informaltable>
43591 <para>
43592 When this option is set, the owner of the file defined by the <option>file</option> option
43593 is checked to ensure that it is the same as the user under which the delivery
43594 process is running.
43595 </para>
43596 <para>
43597 <indexterm role="option">
43598 <primary><option>check_string</option></primary>
43599 </indexterm>
43600 </para>
43601 <informaltable frame="all">
43602 <tgroup cols="4" colsep="0" rowsep="0">
43603 <colspec colwidth="8*" align="left"/>
43604 <colspec colwidth="6*" align="center"/>
43605 <colspec colwidth="6*" align="center"/>
43606 <colspec colwidth="6*" align="right"/>
43607 <tbody>
43608 <row>
43609 <entry><option>check_string</option></entry>
43610 <entry>Use: <emphasis>appendfile</emphasis></entry>
43611 <entry>Type: <emphasis>string</emphasis></entry>
43612 <entry>Default: <emphasis>see below</emphasis></entry>
43613 </row>
43614 </tbody>
43615 </tgroup>
43616 </informaltable>
43617 <para>
43618 <indexterm role="concept">
43619 <primary><quote>From</quote> line</primary>
43620 </indexterm>
43621 As <command>appendfile</command> writes the message, the start of each line is tested for
43622 matching <option>check_string</option>, and if it does, the initial matching characters are
43623 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
43624 a literal string, not a regular expression, and the case of any letters it
43625 contains is significant.
43626 </para>
43627 <para>
43628 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
43629 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
43630 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
43631 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
43632 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
43633 </para>
43634 <para>
43635 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
43636 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
43637 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
43638 if another format is used. For example, to deliver to mailboxes in MMDF format:
43639 <indexterm role="concept">
43640 <primary>MMDF format mailbox</primary>
43641 </indexterm>
43642 <indexterm role="concept">
43643 <primary>mailbox</primary>
43644 <secondary>MMDF format</secondary>
43645 </indexterm>
43646 </para>
43647 <literallayout class="monospaced">
43648 check_string = "\1\1\1\1\n"
43649 escape_string = "\1\1\1\1 \n"
43650 message_prefix = "\1\1\1\1\n"
43651 message_suffix = "\1\1\1\1\n"
43652 </literallayout>
43653 <para>
43654 <indexterm role="option">
43655 <primary><option>create_directory</option></primary>
43656 </indexterm>
43657 </para>
43658 <informaltable frame="all">
43659 <tgroup cols="4" colsep="0" rowsep="0">
43660 <colspec colwidth="8*" align="left"/>
43661 <colspec colwidth="6*" align="center"/>
43662 <colspec colwidth="6*" align="center"/>
43663 <colspec colwidth="6*" align="right"/>
43664 <tbody>
43665 <row>
43666 <entry><option>create_directory</option></entry>
43667 <entry>Use: <emphasis>appendfile</emphasis></entry>
43668 <entry>Type: <emphasis>boolean</emphasis></entry>
43669 <entry>Default: <emphasis>true</emphasis></entry>
43670 </row>
43671 </tbody>
43672 </tgroup>
43673 </informaltable>
43674 <para>
43675 <indexterm role="concept">
43676 <primary>directory creation</primary>
43677 </indexterm>
43678 When this option is true, Exim attempts to create any missing superior
43679 directories for the file that it is about to write. A created directory&#x2019;s mode
43680 is given by the <option>directory_mode</option> option.
43681 </para>
43682 <para>
43683 The group ownership of a newly created directory is highly dependent on the
43684 operating system (and possibly the file system) that is being used. For
43685 example, in Solaris, if the parent directory has the setgid bit set, its group
43686 is propagated to the child; if not, the currently set group is used. However,
43687 in FreeBSD, the parent&#x2019;s group is always used.
43688 </para>
43689 <para>
43690 <indexterm role="option">
43691 <primary><option>create_file</option></primary>
43692 </indexterm>
43693 </para>
43694 <informaltable frame="all">
43695 <tgroup cols="4" colsep="0" rowsep="0">
43696 <colspec colwidth="8*" align="left"/>
43697 <colspec colwidth="6*" align="center"/>
43698 <colspec colwidth="6*" align="center"/>
43699 <colspec colwidth="6*" align="right"/>
43700 <tbody>
43701 <row>
43702 <entry><option>create_file</option></entry>
43703 <entry>Use: <emphasis>appendfile</emphasis></entry>
43704 <entry>Type: <emphasis>string</emphasis></entry>
43705 <entry>Default: <emphasis>anywhere</emphasis></entry>
43706 </row>
43707 </tbody>
43708 </tgroup>
43709 </informaltable>
43710 <para>
43711 This option constrains the location of files and directories that are created
43712 by this transport. It applies to files defined by the <option>file</option> option and
43713 directories defined by the <option>directory</option> option. In the case of maildir
43714 delivery, it applies to the top level directory, not the maildir directories
43715 beneath.
43716 </para>
43717 <para>
43718 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
43719 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
43720 set for the transport. This option is not useful when an explicit filename is
43721 given for normal mailbox deliveries. It is intended for the case when filenames
43722 are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
43723 by an <command>appendfile</command> transport called <option>address_file</option>. See also
43724 <option>file_must_exist</option>.
43725 </para>
43726 <para>
43727 <indexterm role="option">
43728 <primary><option>directory</option></primary>
43729 </indexterm>
43730 </para>
43731 <informaltable frame="all">
43732 <tgroup cols="4" colsep="0" rowsep="0">
43733 <colspec colwidth="8*" align="left"/>
43734 <colspec colwidth="6*" align="center"/>
43735 <colspec colwidth="6*" align="center"/>
43736 <colspec colwidth="6*" align="right"/>
43737 <tbody>
43738 <row>
43739 <entry><option>directory</option></entry>
43740 <entry>Use: <emphasis>appendfile</emphasis></entry>
43741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43742 <entry>Default: <emphasis>unset</emphasis></entry>
43743 </row>
43744 </tbody>
43745 </tgroup>
43746 </informaltable>
43747 <para>
43748 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
43749 or <option>directory</option> must be set, unless the delivery is the direct result of a
43750 redirection (see section <xref linkend="SECTfildiropt"/>).
43751 </para>
43752 <para>
43753 When <option>directory</option> is set, the string is expanded, and the message is delivered
43754 into a new file or files in or below the given directory, instead of being
43755 appended to a single mailbox file. A number of different formats are provided
43756 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
43757 <xref linkend="SECTopdir"/> for further details of this form of delivery.
43758 </para>
43759 <para>
43760 <indexterm role="option">
43761 <primary><option>directory_file</option></primary>
43762 </indexterm>
43763 </para>
43764 <informaltable frame="all">
43765 <tgroup cols="4" colsep="0" rowsep="0">
43766 <colspec colwidth="8*" align="left"/>
43767 <colspec colwidth="6*" align="center"/>
43768 <colspec colwidth="6*" align="center"/>
43769 <colspec colwidth="6*" align="right"/>
43770 <tbody>
43771 <row>
43772 <entry><option>directory_file</option></entry>
43773 <entry>Use: <emphasis>appendfile</emphasis></entry>
43774 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43775 <entry>Default: <emphasis>see below</emphasis></entry>
43776 </row>
43777 </tbody>
43778 </tgroup>
43779 </informaltable>
43780 <para>
43781 <indexterm role="concept">
43782 <primary>base62</primary>
43783 </indexterm>
43784 <indexterm role="variable">
43785 <primary><varname>$inode</varname></primary>
43786 </indexterm>
43787 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
43788 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
43789 whose name is obtained by expanding this string. The default value is:
43790 </para>
43791 <literallayout class="monospaced">
43792 q${base62:$tod_epoch}-$inode
43793 </literallayout>
43794 <para>
43795 This generates a unique name from the current time, in base 62 form, and the
43796 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
43797 option.
43798 </para>
43799 <para>
43800 <indexterm role="option">
43801 <primary><option>directory_mode</option></primary>
43802 </indexterm>
43803 </para>
43804 <informaltable frame="all">
43805 <tgroup cols="4" colsep="0" rowsep="0">
43806 <colspec colwidth="8*" align="left"/>
43807 <colspec colwidth="6*" align="center"/>
43808 <colspec colwidth="6*" align="center"/>
43809 <colspec colwidth="6*" align="right"/>
43810 <tbody>
43811 <row>
43812 <entry><option>directory_mode</option></entry>
43813 <entry>Use: <emphasis>appendfile</emphasis></entry>
43814 <entry>Type: <emphasis>octal integer</emphasis></entry>
43815 <entry>Default: <emphasis>0700</emphasis></entry>
43816 </row>
43817 </tbody>
43818 </tgroup>
43819 </informaltable>
43820 <para>
43821 If <command>appendfile</command> creates any directories as a result of the
43822 <option>create_directory</option> option, their mode is specified by this option.
43823 </para>
43824 <para>
43825 <indexterm role="option">
43826 <primary><option>escape_string</option></primary>
43827 </indexterm>
43828 </para>
43829 <informaltable frame="all">
43830 <tgroup cols="4" colsep="0" rowsep="0">
43831 <colspec colwidth="8*" align="left"/>
43832 <colspec colwidth="6*" align="center"/>
43833 <colspec colwidth="6*" align="center"/>
43834 <colspec colwidth="6*" align="right"/>
43835 <tbody>
43836 <row>
43837 <entry><option>escape_string</option></entry>
43838 <entry>Use: <emphasis>appendfile</emphasis></entry>
43839 <entry>Type: <emphasis>string</emphasis></entry>
43840 <entry>Default: <emphasis>see description</emphasis></entry>
43841 </row>
43842 </tbody>
43843 </tgroup>
43844 </informaltable>
43845 <para>
43846 See <option>check_string</option> above.
43847 </para>
43848 <para>
43849 <indexterm role="option">
43850 <primary><option>file</option></primary>
43851 </indexterm>
43852 </para>
43853 <informaltable frame="all">
43854 <tgroup cols="4" colsep="0" rowsep="0">
43855 <colspec colwidth="8*" align="left"/>
43856 <colspec colwidth="6*" align="center"/>
43857 <colspec colwidth="6*" align="center"/>
43858 <colspec colwidth="6*" align="right"/>
43859 <tbody>
43860 <row>
43861 <entry><option>file</option></entry>
43862 <entry>Use: <emphasis>appendfile</emphasis></entry>
43863 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43864 <entry>Default: <emphasis>unset</emphasis></entry>
43865 </row>
43866 </tbody>
43867 </tgroup>
43868 </informaltable>
43869 <para>
43870 This option is mutually exclusive with the <option>directory</option> option, but one of
43871 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
43872 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
43873 specifies a single file, to which the message is appended. One or more of
43874 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
43875 <option>file</option>.
43876 </para>
43877 <para>
43878 <indexterm role="concept">
43879 <primary>NFS</primary>
43880 <secondary>lock file</secondary>
43881 </indexterm>
43882 <indexterm role="concept">
43883 <primary>locking files</primary>
43884 </indexterm>
43885 <indexterm role="concept">
43886 <primary>lock files</primary>
43887 </indexterm>
43888 If you are using more than one host to deliver over NFS into the same
43889 mailboxes, you should always use lock files.
43890 </para>
43891 <para>
43892 The string value is expanded for each delivery, and must yield an absolute
43893 path. The most common settings of this option are variations on one of these
43894 examples:
43895 </para>
43896 <literallayout class="monospaced">
43897 file = /var/spool/mail/$local_part_data
43898 file = /home/$local_part_data/inbox
43899 file = $home/inbox
43900 </literallayout>
43901 <para>
43902 <indexterm role="concept">
43903 <primary><quote>sticky</quote> bit</primary>
43904 </indexterm>
43905 In the first example, all deliveries are done into the same directory. If Exim
43906 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
43907 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
43908 deliveries to be possible, or alternatively the <option>group</option> option can be used to
43909 run the delivery under a group id which has write access to the directory.
43910 </para>
43911 <para>
43912 <indexterm role="option">
43913 <primary><option>file_format</option></primary>
43914 </indexterm>
43915 </para>
43916 <informaltable frame="all">
43917 <tgroup cols="4" colsep="0" rowsep="0">
43918 <colspec colwidth="8*" align="left"/>
43919 <colspec colwidth="6*" align="center"/>
43920 <colspec colwidth="6*" align="center"/>
43921 <colspec colwidth="6*" align="right"/>
43922 <tbody>
43923 <row>
43924 <entry><option>file_format</option></entry>
43925 <entry>Use: <emphasis>appendfile</emphasis></entry>
43926 <entry>Type: <emphasis>string</emphasis></entry>
43927 <entry>Default: <emphasis>unset</emphasis></entry>
43928 </row>
43929 </tbody>
43930 </tgroup>
43931 </informaltable>
43932 <para>
43933 <indexterm role="concept">
43934 <primary>file</primary>
43935 <secondary>mailbox; checking existing format</secondary>
43936 </indexterm>
43937 This option requests the transport to check the format of an existing file
43938 before adding to it. The check consists of matching a specific string at the
43939 start of the file. The value of the option consists of an even number of
43940 colon-separated strings. The first of each pair is the test string, and the
43941 second is the name of a transport. If the transport associated with a matched
43942 string is not the current transport, control is passed over to the other
43943 transport. For example, suppose the standard <command>local_delivery</command> transport has
43944 this added to it:
43945 </para>
43946 <literallayout class="monospaced">
43947 file_format = "From       : local_delivery :\
43948                \1\1\1\1\n : local_mmdf_delivery"
43949 </literallayout>
43950 <para>
43951 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
43952 a mailbox begins with four binary ones followed by a newline, control is passed
43953 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
43954 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
43955 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
43956 match any string, or if the transport named for a given string is not defined,
43957 delivery is deferred.
43958 </para>
43959 <para>
43960 <indexterm role="option">
43961 <primary><option>file_must_exist</option></primary>
43962 </indexterm>
43963 </para>
43964 <informaltable frame="all">
43965 <tgroup cols="4" colsep="0" rowsep="0">
43966 <colspec colwidth="8*" align="left"/>
43967 <colspec colwidth="6*" align="center"/>
43968 <colspec colwidth="6*" align="center"/>
43969 <colspec colwidth="6*" align="right"/>
43970 <tbody>
43971 <row>
43972 <entry><option>file_must_exist</option></entry>
43973 <entry>Use: <emphasis>appendfile</emphasis></entry>
43974 <entry>Type: <emphasis>boolean</emphasis></entry>
43975 <entry>Default: <emphasis>false</emphasis></entry>
43976 </row>
43977 </tbody>
43978 </tgroup>
43979 </informaltable>
43980 <para>
43981 If this option is true, the file specified by the <option>file</option> option must exist.
43982 A temporary error occurs if it does not, causing delivery to be deferred.
43983 If this option is false, the file is created if it does not exist.
43984 </para>
43985 <para>
43986 <indexterm role="option">
43987 <primary><option>lock_fcntl_timeout</option></primary>
43988 </indexterm>
43989 </para>
43990 <informaltable frame="all">
43991 <tgroup cols="4" colsep="0" rowsep="0">
43992 <colspec colwidth="8*" align="left"/>
43993 <colspec colwidth="6*" align="center"/>
43994 <colspec colwidth="6*" align="center"/>
43995 <colspec colwidth="6*" align="right"/>
43996 <tbody>
43997 <row>
43998 <entry><option>lock_fcntl_timeout</option></entry>
43999 <entry>Use: <emphasis>appendfile</emphasis></entry>
44000 <entry>Type: <emphasis>time</emphasis></entry>
44001 <entry>Default: <emphasis>0s</emphasis></entry>
44002 </row>
44003 </tbody>
44004 </tgroup>
44005 </informaltable>
44006 <para>
44007 <indexterm role="concept">
44008 <primary>timeout</primary>
44009 <secondary>mailbox locking</secondary>
44010 </indexterm>
44011 <indexterm role="concept">
44012 <primary>mailbox</primary>
44013 <secondary>locking, blocking and non-blocking</secondary>
44014 </indexterm>
44015 <indexterm role="concept">
44016 <primary>locking files</primary>
44017 </indexterm>
44018 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
44019 when locking an open mailbox file. If the call fails, the delivery process
44020 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
44021 Non-blocking calls are used so that the file is not kept open during the wait
44022 for the lock; the reason for this is to make it as safe as possible for
44023 deliveries over NFS in the case when processes might be accessing an NFS
44024 mailbox without using a lock file. This should not be done, but
44025 misunderstandings and hence misconfigurations are not unknown.
44026 </para>
44027 <para>
44028 On a busy system, however, the performance of a non-blocking lock approach is
44029 not as good as using a blocking lock with a timeout. In this case, the waiting
44030 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
44031 and can proceed as soon as the previous lock holder releases it.
44032 </para>
44033 <para>
44034 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
44035 timeout, are used. There may still be some retrying: the maximum number of
44036 retries is
44037 </para>
44038 <literallayout class="monospaced">
44039 (lock_retries * lock_interval) / lock_fcntl_timeout
44040 </literallayout>
44041 <para>
44042 rounded up to the next whole number. In other words, the total time during
44043 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
44044 <option>lock_fcntl_timeout</option> is set very large.
44045 </para>
44046 <para>
44047 You should consider setting this option if you are getting a lot of delayed
44048 local deliveries because of errors of the form
44049 </para>
44050 <literallayout class="monospaced">
44051 failed to lock mailbox /some/file (fcntl)
44052 </literallayout>
44053 <para>
44054 <indexterm role="option">
44055 <primary><option>lock_flock_timeout</option></primary>
44056 </indexterm>
44057 </para>
44058 <informaltable frame="all">
44059 <tgroup cols="4" colsep="0" rowsep="0">
44060 <colspec colwidth="8*" align="left"/>
44061 <colspec colwidth="6*" align="center"/>
44062 <colspec colwidth="6*" align="center"/>
44063 <colspec colwidth="6*" align="right"/>
44064 <tbody>
44065 <row>
44066 <entry><option>lock_flock_timeout</option></entry>
44067 <entry>Use: <emphasis>appendfile</emphasis></entry>
44068 <entry>Type: <emphasis>time</emphasis></entry>
44069 <entry>Default: <emphasis>0s</emphasis></entry>
44070 </row>
44071 </tbody>
44072 </tgroup>
44073 </informaltable>
44074 <para>
44075 This timeout applies to file locking when using <function>flock()</function> (see
44076 <option>use_flock</option>); the timeout operates in a similar manner to
44077 <option>lock_fcntl_timeout</option>.
44078 </para>
44079 <para>
44080 <indexterm role="option">
44081 <primary><option>lock_interval</option></primary>
44082 </indexterm>
44083 </para>
44084 <informaltable frame="all">
44085 <tgroup cols="4" colsep="0" rowsep="0">
44086 <colspec colwidth="8*" align="left"/>
44087 <colspec colwidth="6*" align="center"/>
44088 <colspec colwidth="6*" align="center"/>
44089 <colspec colwidth="6*" align="right"/>
44090 <tbody>
44091 <row>
44092 <entry><option>lock_interval</option></entry>
44093 <entry>Use: <emphasis>appendfile</emphasis></entry>
44094 <entry>Type: <emphasis>time</emphasis></entry>
44095 <entry>Default: <emphasis>3s</emphasis></entry>
44096 </row>
44097 </tbody>
44098 </tgroup>
44099 </informaltable>
44100 <para>
44101 This specifies the time to wait between attempts to lock the file. See below
44102 for details of locking.
44103 </para>
44104 <para>
44105 <indexterm role="option">
44106 <primary><option>lock_retries</option></primary>
44107 </indexterm>
44108 </para>
44109 <informaltable frame="all">
44110 <tgroup cols="4" colsep="0" rowsep="0">
44111 <colspec colwidth="8*" align="left"/>
44112 <colspec colwidth="6*" align="center"/>
44113 <colspec colwidth="6*" align="center"/>
44114 <colspec colwidth="6*" align="right"/>
44115 <tbody>
44116 <row>
44117 <entry><option>lock_retries</option></entry>
44118 <entry>Use: <emphasis>appendfile</emphasis></entry>
44119 <entry>Type: <emphasis>integer</emphasis></entry>
44120 <entry>Default: <emphasis>10</emphasis></entry>
44121 </row>
44122 </tbody>
44123 </tgroup>
44124 </informaltable>
44125 <para>
44126 This specifies the maximum number of attempts to lock the file. A value of zero
44127 is treated as 1. See below for details of locking.
44128 </para>
44129 <para>
44130 <indexterm role="option">
44131 <primary><option>lockfile_mode</option></primary>
44132 </indexterm>
44133 </para>
44134 <informaltable frame="all">
44135 <tgroup cols="4" colsep="0" rowsep="0">
44136 <colspec colwidth="8*" align="left"/>
44137 <colspec colwidth="6*" align="center"/>
44138 <colspec colwidth="6*" align="center"/>
44139 <colspec colwidth="6*" align="right"/>
44140 <tbody>
44141 <row>
44142 <entry><option>lockfile_mode</option></entry>
44143 <entry>Use: <emphasis>appendfile</emphasis></entry>
44144 <entry>Type: <emphasis>octal integer</emphasis></entry>
44145 <entry>Default: <emphasis>0600</emphasis></entry>
44146 </row>
44147 </tbody>
44148 </tgroup>
44149 </informaltable>
44150 <para>
44151 This specifies the mode of the created lock file, when a lock file is being
44152 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
44153 </para>
44154 <para>
44155 <indexterm role="option">
44156 <primary><option>lockfile_timeout</option></primary>
44157 </indexterm>
44158 </para>
44159 <informaltable frame="all">
44160 <tgroup cols="4" colsep="0" rowsep="0">
44161 <colspec colwidth="8*" align="left"/>
44162 <colspec colwidth="6*" align="center"/>
44163 <colspec colwidth="6*" align="center"/>
44164 <colspec colwidth="6*" align="right"/>
44165 <tbody>
44166 <row>
44167 <entry><option>lockfile_timeout</option></entry>
44168 <entry>Use: <emphasis>appendfile</emphasis></entry>
44169 <entry>Type: <emphasis>time</emphasis></entry>
44170 <entry>Default: <emphasis>30m</emphasis></entry>
44171 </row>
44172 </tbody>
44173 </tgroup>
44174 </informaltable>
44175 <para>
44176 <indexterm role="concept">
44177 <primary>timeout</primary>
44178 <secondary>mailbox locking</secondary>
44179 </indexterm>
44180 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
44181 exists and is older than this value, it is assumed to have been left behind by
44182 accident, and Exim attempts to remove it.
44183 </para>
44184 <para>
44185 <indexterm role="option">
44186 <primary><option>mailbox_filecount</option></primary>
44187 </indexterm>
44188 </para>
44189 <informaltable frame="all">
44190 <tgroup cols="4" colsep="0" rowsep="0">
44191 <colspec colwidth="8*" align="left"/>
44192 <colspec colwidth="6*" align="center"/>
44193 <colspec colwidth="6*" align="center"/>
44194 <colspec colwidth="6*" align="right"/>
44195 <tbody>
44196 <row>
44197 <entry><option>mailbox_filecount</option></entry>
44198 <entry>Use: <emphasis>appendfile</emphasis></entry>
44199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44200 <entry>Default: <emphasis>unset</emphasis></entry>
44201 </row>
44202 </tbody>
44203 </tgroup>
44204 </informaltable>
44205 <para>
44206 <indexterm role="concept">
44207 <primary>mailbox</primary>
44208 <secondary>specifying size of</secondary>
44209 </indexterm>
44210 <indexterm role="concept">
44211 <primary>size</primary>
44212 <secondary>of mailbox</secondary>
44213 </indexterm>
44214 If this option is set, it is expanded, and the result is taken as the current
44215 number of files in the mailbox. It must be a decimal number, optionally
44216 followed by K or M. This provides a way of obtaining this information from an
44217 external source that maintains the data.
44218 </para>
44219 <para>
44220 <indexterm role="option">
44221 <primary><option>mailbox_size</option></primary>
44222 </indexterm>
44223 </para>
44224 <informaltable frame="all">
44225 <tgroup cols="4" colsep="0" rowsep="0">
44226 <colspec colwidth="8*" align="left"/>
44227 <colspec colwidth="6*" align="center"/>
44228 <colspec colwidth="6*" align="center"/>
44229 <colspec colwidth="6*" align="right"/>
44230 <tbody>
44231 <row>
44232 <entry><option>mailbox_size</option></entry>
44233 <entry>Use: <emphasis>appendfile</emphasis></entry>
44234 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44235 <entry>Default: <emphasis>unset</emphasis></entry>
44236 </row>
44237 </tbody>
44238 </tgroup>
44239 </informaltable>
44240 <para>
44241 <indexterm role="concept">
44242 <primary>mailbox</primary>
44243 <secondary>specifying size of</secondary>
44244 </indexterm>
44245 <indexterm role="concept">
44246 <primary>size</primary>
44247 <secondary>of mailbox</secondary>
44248 </indexterm>
44249 If this option is set, it is expanded, and the result is taken as the current
44250 size the mailbox. It must be a decimal number, optionally followed by K or M.
44251 This provides a way of obtaining this information from an external source that
44252 maintains the data. This is likely to be helpful for maildir deliveries where
44253 it is computationally expensive to compute the size of a mailbox.
44254 </para>
44255 <para>
44256 <indexterm role="option">
44257 <primary><option>maildir_format</option></primary>
44258 </indexterm>
44259 </para>
44260 <informaltable frame="all">
44261 <tgroup cols="4" colsep="0" rowsep="0">
44262 <colspec colwidth="8*" align="left"/>
44263 <colspec colwidth="6*" align="center"/>
44264 <colspec colwidth="6*" align="center"/>
44265 <colspec colwidth="6*" align="right"/>
44266 <tbody>
44267 <row>
44268 <entry><option>maildir_format</option></entry>
44269 <entry>Use: <emphasis>appendfile</emphasis></entry>
44270 <entry>Type: <emphasis>boolean</emphasis></entry>
44271 <entry>Default: <emphasis>false</emphasis></entry>
44272 </row>
44273 </tbody>
44274 </tgroup>
44275 </informaltable>
44276 <para>
44277 <indexterm role="concept">
44278 <primary>maildir format</primary>
44279 <secondary>specifying</secondary>
44280 </indexterm>
44281 If this option is set with the <option>directory</option> option, the delivery is into a new
44282 file, in the <quote>maildir</quote> format that is used by other mail software. When the
44283 transport is activated directly from a <command>redirect</command> router (for example, the
44284 <command>address_file</command> transport in the default configuration), setting
44285 <option>maildir_format</option> causes the path received from the router to be treated as a
44286 directory, whether or not it ends with <literal>/</literal>. This option is available only if
44287 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
44288 <xref linkend="SECTmaildirdelivery"/> below for further details.
44289 </para>
44290 <para>
44291 <indexterm role="option">
44292 <primary><option>maildir_quota_directory_regex</option></primary>
44293 </indexterm>
44294 </para>
44295 <informaltable frame="all">
44296 <tgroup cols="4" colsep="0" rowsep="0">
44297 <colspec colwidth="8*" align="left"/>
44298 <colspec colwidth="6*" align="center"/>
44299 <colspec colwidth="6*" align="center"/>
44300 <colspec colwidth="6*" align="right"/>
44301 <tbody>
44302 <row>
44303 <entry><option>maildir_quota_directory_regex</option></entry>
44304 <entry>Use: <emphasis>appendfile</emphasis></entry>
44305 <entry>Type: <emphasis>string</emphasis></entry>
44306 <entry>Default: <emphasis>See below</emphasis></entry>
44307 </row>
44308 </tbody>
44309 </tgroup>
44310 </informaltable>
44311 <para>
44312 <indexterm role="concept">
44313 <primary>maildir format</primary>
44314 <secondary>quota; directories included in</secondary>
44315 </indexterm>
44316 <indexterm role="concept">
44317 <primary>quota</primary>
44318 <secondary>maildir; directories included in</secondary>
44319 </indexterm>
44320 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
44321 a regular expression for specifying directories, relative to the quota
44322 directory (see <option>quota_directory</option>), that should be included in the quota
44323 calculation. The default value is:
44324 </para>
44325 <literallayout class="monospaced">
44326 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
44327 </literallayout>
44328 <para>
44329 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
44330 (directories whose names begin with a dot). If you want to exclude the
44331 <filename>Trash</filename>
44332 folder from the count (as some sites do), you need to change this setting to
44333 </para>
44334 <literallayout class="monospaced">
44335 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
44336 </literallayout>
44337 <para>
44338 This uses a negative lookahead in the regular expression to exclude the
44339 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
44340 calculations, quota processing is bypassed for any messages that are delivered
44341 directly into that directory.
44342 </para>
44343 <para>
44344 <indexterm role="option">
44345 <primary><option>maildir_retries</option></primary>
44346 </indexterm>
44347 </para>
44348 <informaltable frame="all">
44349 <tgroup cols="4" colsep="0" rowsep="0">
44350 <colspec colwidth="8*" align="left"/>
44351 <colspec colwidth="6*" align="center"/>
44352 <colspec colwidth="6*" align="center"/>
44353 <colspec colwidth="6*" align="right"/>
44354 <tbody>
44355 <row>
44356 <entry><option>maildir_retries</option></entry>
44357 <entry>Use: <emphasis>appendfile</emphasis></entry>
44358 <entry>Type: <emphasis>integer</emphasis></entry>
44359 <entry>Default: <emphasis>10</emphasis></entry>
44360 </row>
44361 </tbody>
44362 </tgroup>
44363 </informaltable>
44364 <para>
44365 This option specifies the number of times to retry when writing a file in
44366 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
44367 </para>
44368 <para>
44369 <indexterm role="option">
44370 <primary><option>maildir_tag</option></primary>
44371 </indexterm>
44372 </para>
44373 <informaltable frame="all">
44374 <tgroup cols="4" colsep="0" rowsep="0">
44375 <colspec colwidth="8*" align="left"/>
44376 <colspec colwidth="6*" align="center"/>
44377 <colspec colwidth="6*" align="center"/>
44378 <colspec colwidth="6*" align="right"/>
44379 <tbody>
44380 <row>
44381 <entry><option>maildir_tag</option></entry>
44382 <entry>Use: <emphasis>appendfile</emphasis></entry>
44383 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44384 <entry>Default: <emphasis>unset</emphasis></entry>
44385 </row>
44386 </tbody>
44387 </tgroup>
44388 </informaltable>
44389 <para>
44390 This option applies only to deliveries in maildir format, and is described in
44391 section <xref linkend="SECTmaildirdelivery"/> below.
44392 </para>
44393 <para>
44394 <indexterm role="option">
44395 <primary><option>maildir_use_size_file</option></primary>
44396 </indexterm>
44397 </para>
44398 <informaltable frame="all">
44399 <tgroup cols="4" colsep="0" rowsep="0">
44400 <colspec colwidth="8*" align="left"/>
44401 <colspec colwidth="6*" align="center"/>
44402 <colspec colwidth="6*" align="center"/>
44403 <colspec colwidth="6*" align="right"/>
44404 <tbody>
44405 <row>
44406 <entry><option>maildir_use_size_file</option></entry>
44407 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
44408 <entry>Type: <emphasis>boolean</emphasis></entry>
44409 <entry>Default: <emphasis>false</emphasis></entry>
44410 </row>
44411 </tbody>
44412 </tgroup>
44413 </informaltable>
44414 <para>
44415 <indexterm role="concept">
44416 <primary>maildir format</primary>
44417 <secondary><filename>maildirsize</filename> file</secondary>
44418 </indexterm>
44419 The result of string expansion for this option must be a valid boolean value.
44420 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
44421 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
44422 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
44423 value is zero. See <option>maildir_quota_directory_regex</option> above and section
44424 <xref linkend="SECTmaildirdelivery"/> below for further details.
44425 </para>
44426 <para>
44427 <indexterm role="option">
44428 <primary><option>maildirfolder_create_regex</option></primary>
44429 </indexterm>
44430 </para>
44431 <informaltable frame="all">
44432 <tgroup cols="4" colsep="0" rowsep="0">
44433 <colspec colwidth="8*" align="left"/>
44434 <colspec colwidth="6*" align="center"/>
44435 <colspec colwidth="6*" align="center"/>
44436 <colspec colwidth="6*" align="right"/>
44437 <tbody>
44438 <row>
44439 <entry><option>maildirfolder_create_regex</option></entry>
44440 <entry>Use: <emphasis>appendfile</emphasis></entry>
44441 <entry>Type: <emphasis>string</emphasis></entry>
44442 <entry>Default: <emphasis>unset</emphasis></entry>
44443 </row>
44444 </tbody>
44445 </tgroup>
44446 </informaltable>
44447 <para>
44448 <indexterm role="concept">
44449 <primary>maildir format</primary>
44450 <secondary><filename>maildirfolder</filename> file</secondary>
44451 </indexterm>
44452 <indexterm role="concept">
44453 <primary><filename>maildirfolder</filename>, creating</primary>
44454 </indexterm>
44455 The value of this option is a regular expression. If it is unset, it has no
44456 effect. Otherwise, before a maildir delivery takes place, the pattern is
44457 matched against the name of the maildir directory, that is, the directory
44458 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
44459 delivery. If there is a match, Exim checks for the existence of a file called
44460 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
44461 See section <xref linkend="SECTmaildirdelivery"/> for more details.
44462 </para>
44463 <para>
44464 <indexterm role="option">
44465 <primary><option>mailstore_format</option></primary>
44466 </indexterm>
44467 </para>
44468 <informaltable frame="all">
44469 <tgroup cols="4" colsep="0" rowsep="0">
44470 <colspec colwidth="8*" align="left"/>
44471 <colspec colwidth="6*" align="center"/>
44472 <colspec colwidth="6*" align="center"/>
44473 <colspec colwidth="6*" align="right"/>
44474 <tbody>
44475 <row>
44476 <entry><option>mailstore_format</option></entry>
44477 <entry>Use: <emphasis>appendfile</emphasis></entry>
44478 <entry>Type: <emphasis>boolean</emphasis></entry>
44479 <entry>Default: <emphasis>false</emphasis></entry>
44480 </row>
44481 </tbody>
44482 </tgroup>
44483 </informaltable>
44484 <para>
44485 <indexterm role="concept">
44486 <primary>mailstore format</primary>
44487 <secondary>specifying</secondary>
44488 </indexterm>
44489 If this option is set with the <option>directory</option> option, the delivery is into two
44490 new files in  <quote>mailstore</quote> format. The option is available only if
44491 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
44492 below for further details.
44493 </para>
44494 <para>
44495 <indexterm role="option">
44496 <primary><option>mailstore_prefix</option></primary>
44497 </indexterm>
44498 </para>
44499 <informaltable frame="all">
44500 <tgroup cols="4" colsep="0" rowsep="0">
44501 <colspec colwidth="8*" align="left"/>
44502 <colspec colwidth="6*" align="center"/>
44503 <colspec colwidth="6*" align="center"/>
44504 <colspec colwidth="6*" align="right"/>
44505 <tbody>
44506 <row>
44507 <entry><option>mailstore_prefix</option></entry>
44508 <entry>Use: <emphasis>appendfile</emphasis></entry>
44509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44510 <entry>Default: <emphasis>unset</emphasis></entry>
44511 </row>
44512 </tbody>
44513 </tgroup>
44514 </informaltable>
44515 <para>
44516 This option applies only to deliveries in mailstore format, and is described in
44517 section <xref linkend="SECTopdir"/> below.
44518 </para>
44519 <para>
44520 <indexterm role="option">
44521 <primary><option>mailstore_suffix</option></primary>
44522 </indexterm>
44523 </para>
44524 <informaltable frame="all">
44525 <tgroup cols="4" colsep="0" rowsep="0">
44526 <colspec colwidth="8*" align="left"/>
44527 <colspec colwidth="6*" align="center"/>
44528 <colspec colwidth="6*" align="center"/>
44529 <colspec colwidth="6*" align="right"/>
44530 <tbody>
44531 <row>
44532 <entry><option>mailstore_suffix</option></entry>
44533 <entry>Use: <emphasis>appendfile</emphasis></entry>
44534 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44535 <entry>Default: <emphasis>unset</emphasis></entry>
44536 </row>
44537 </tbody>
44538 </tgroup>
44539 </informaltable>
44540 <para>
44541 This option applies only to deliveries in mailstore format, and is described in
44542 section <xref linkend="SECTopdir"/> below.
44543 </para>
44544 <para>
44545 <indexterm role="option">
44546 <primary><option>mbx_format</option></primary>
44547 </indexterm>
44548 </para>
44549 <informaltable frame="all">
44550 <tgroup cols="4" colsep="0" rowsep="0">
44551 <colspec colwidth="8*" align="left"/>
44552 <colspec colwidth="6*" align="center"/>
44553 <colspec colwidth="6*" align="center"/>
44554 <colspec colwidth="6*" align="right"/>
44555 <tbody>
44556 <row>
44557 <entry><option>mbx_format</option></entry>
44558 <entry>Use: <emphasis>appendfile</emphasis></entry>
44559 <entry>Type: <emphasis>boolean</emphasis></entry>
44560 <entry>Default: <emphasis>false</emphasis></entry>
44561 </row>
44562 </tbody>
44563 </tgroup>
44564 </informaltable>
44565 <para>
44566 <indexterm role="concept">
44567 <primary>locking files</primary>
44568 </indexterm>
44569 <indexterm role="concept">
44570 <primary>file</primary>
44571 <secondary>locking</secondary>
44572 </indexterm>
44573 <indexterm role="concept">
44574 <primary>file</primary>
44575 <secondary>MBX format</secondary>
44576 </indexterm>
44577 <indexterm role="concept">
44578 <primary>MBX format, specifying</primary>
44579 </indexterm>
44580 This option is available only if Exim has been compiled with SUPPORT_MBX
44581 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
44582 the message is appended to the mailbox file in MBX format instead of
44583 traditional Unix format. This format is supported by Pine4 and its associated
44584 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
44585 </para>
44586 <para>
44587 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
44588 automatically changed by the use of <option>mbx_format</option>. They should normally be set
44589 empty when using MBX format, so this option almost always appears in this
44590 combination:
44591 </para>
44592 <literallayout class="monospaced">
44593 mbx_format = true
44594 message_prefix =
44595 message_suffix =
44596 </literallayout>
44597 <para>
44598 If none of the locking options are mentioned in the configuration,
44599 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
44600 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
44601 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
44602 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
44603 should not be used if any program that does not use this form of locking is
44604 going to access the mailbox, nor should it be used if the mailbox file is NFS
44605 mounted, because it works only when the mailbox is accessed from a single host.
44606 </para>
44607 <para>
44608 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
44609 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
44610 (this means for the whole of a Pine or IMAP session), Exim will not be able to
44611 append messages to it.
44612 </para>
44613 <para>
44614 <indexterm role="option">
44615 <primary><option>message_prefix</option></primary>
44616 </indexterm>
44617 </para>
44618 <informaltable frame="all">
44619 <tgroup cols="4" colsep="0" rowsep="0">
44620 <colspec colwidth="8*" align="left"/>
44621 <colspec colwidth="6*" align="center"/>
44622 <colspec colwidth="6*" align="center"/>
44623 <colspec colwidth="6*" align="right"/>
44624 <tbody>
44625 <row>
44626 <entry><option>message_prefix</option></entry>
44627 <entry>Use: <emphasis>appendfile</emphasis></entry>
44628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44629 <entry>Default: <emphasis>see below</emphasis></entry>
44630 </row>
44631 </tbody>
44632 </tgroup>
44633 </informaltable>
44634 <para>
44635 <indexterm role="concept">
44636 <primary><quote>From</quote> line</primary>
44637 </indexterm>
44638 The string specified here is expanded and output at the start of every message.
44639 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
44640 in which case it is:
44641 </para>
44642 <literallayout class="monospaced">
44643 message_prefix = "From ${if def:return_path{$return_path}\
44644   {MAILER-DAEMON}} $tod_bsdinbox\n"
44645 </literallayout>
44646 <para>
44647 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44648 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
44649 </para>
44650 <para>
44651 <indexterm role="option">
44652 <primary><option>message_suffix</option></primary>
44653 </indexterm>
44654 </para>
44655 <informaltable frame="all">
44656 <tgroup cols="4" colsep="0" rowsep="0">
44657 <colspec colwidth="8*" align="left"/>
44658 <colspec colwidth="6*" align="center"/>
44659 <colspec colwidth="6*" align="center"/>
44660 <colspec colwidth="6*" align="right"/>
44661 <tbody>
44662 <row>
44663 <entry><option>message_suffix</option></entry>
44664 <entry>Use: <emphasis>appendfile</emphasis></entry>
44665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44666 <entry>Default: <emphasis>see below</emphasis></entry>
44667 </row>
44668 </tbody>
44669 </tgroup>
44670 </informaltable>
44671 <para>
44672 The string specified here is expanded and output at the end of every message.
44673 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
44674 in which case it is a single newline character. The suffix can be suppressed by
44675 setting
44676 </para>
44677 <literallayout class="monospaced">
44678 message_suffix =
44679 </literallayout>
44680 <para>
44681 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44682 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
44683 </para>
44684 <para>
44685 <indexterm role="option">
44686 <primary><option>mode</option></primary>
44687 </indexterm>
44688 </para>
44689 <informaltable frame="all">
44690 <tgroup cols="4" colsep="0" rowsep="0">
44691 <colspec colwidth="8*" align="left"/>
44692 <colspec colwidth="6*" align="center"/>
44693 <colspec colwidth="6*" align="center"/>
44694 <colspec colwidth="6*" align="right"/>
44695 <tbody>
44696 <row>
44697 <entry><option>mode</option></entry>
44698 <entry>Use: <emphasis>appendfile</emphasis></entry>
44699 <entry>Type: <emphasis>octal integer</emphasis></entry>
44700 <entry>Default: <emphasis>0600</emphasis></entry>
44701 </row>
44702 </tbody>
44703 </tgroup>
44704 </informaltable>
44705 <para>
44706 If the output file is created, it is given this mode. If it already exists and
44707 has wider permissions, they are reduced to this mode. If it has narrower
44708 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
44709 if the delivery is the result of a <option>save</option> command in a filter file specifying
44710 a particular mode, the mode of the output file is always forced to take that
44711 value, and this option is ignored.
44712 </para>
44713 <para>
44714 <indexterm role="option">
44715 <primary><option>mode_fail_narrower</option></primary>
44716 </indexterm>
44717 </para>
44718 <informaltable frame="all">
44719 <tgroup cols="4" colsep="0" rowsep="0">
44720 <colspec colwidth="8*" align="left"/>
44721 <colspec colwidth="6*" align="center"/>
44722 <colspec colwidth="6*" align="center"/>
44723 <colspec colwidth="6*" align="right"/>
44724 <tbody>
44725 <row>
44726 <entry><option>mode_fail_narrower</option></entry>
44727 <entry>Use: <emphasis>appendfile</emphasis></entry>
44728 <entry>Type: <emphasis>boolean</emphasis></entry>
44729 <entry>Default: <emphasis>true</emphasis></entry>
44730 </row>
44731 </tbody>
44732 </tgroup>
44733 </informaltable>
44734 <para>
44735 This option applies in the case when an existing mailbox file has a narrower
44736 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
44737 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
44738 continues with the delivery attempt, using the existing mode of the file.
44739 </para>
44740 <para>
44741 <indexterm role="option">
44742 <primary><option>notify_comsat</option></primary>
44743 </indexterm>
44744 </para>
44745 <informaltable frame="all">
44746 <tgroup cols="4" colsep="0" rowsep="0">
44747 <colspec colwidth="8*" align="left"/>
44748 <colspec colwidth="6*" align="center"/>
44749 <colspec colwidth="6*" align="center"/>
44750 <colspec colwidth="6*" align="right"/>
44751 <tbody>
44752 <row>
44753 <entry><option>notify_comsat</option></entry>
44754 <entry>Use: <emphasis>appendfile</emphasis></entry>
44755 <entry>Type: <emphasis>boolean</emphasis></entry>
44756 <entry>Default: <emphasis>false</emphasis></entry>
44757 </row>
44758 </tbody>
44759 </tgroup>
44760 </informaltable>
44761 <para>
44762 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
44763 successful delivery to a user mailbox. This is the daemon that notifies logged
44764 on users about incoming mail.
44765 </para>
44766 <para>
44767 <indexterm role="option">
44768 <primary><option>quota</option></primary>
44769 </indexterm>
44770 </para>
44771 <informaltable frame="all">
44772 <tgroup cols="4" colsep="0" rowsep="0">
44773 <colspec colwidth="8*" align="left"/>
44774 <colspec colwidth="6*" align="center"/>
44775 <colspec colwidth="6*" align="center"/>
44776 <colspec colwidth="6*" align="right"/>
44777 <tbody>
44778 <row>
44779 <entry><option>quota</option></entry>
44780 <entry>Use: <emphasis>appendfile</emphasis></entry>
44781 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44782 <entry>Default: <emphasis>unset</emphasis></entry>
44783 </row>
44784 </tbody>
44785 </tgroup>
44786 </informaltable>
44787 <para>
44788 <indexterm role="concept">
44789 <primary>quota</primary>
44790 <secondary>imposed by Exim</secondary>
44791 </indexterm>
44792 This option imposes a limit on the size of the file to which Exim is appending,
44793 or to the total space used in the directory tree when the <option>directory</option> option
44794 is set. In the latter case, computation of the space used is expensive, because
44795 all the files in the directory (and any sub-directories) have to be
44796 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
44797 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
44798 have no shell access to their mailboxes).
44799 </para>
44800 <para>
44801 As there is no interlock against two simultaneous deliveries into a
44802 multi-file mailbox, it is possible for the quota to be overrun in this case.
44803 For single-file mailboxes, of course, an interlock is a necessity.
44804 </para>
44805 <para>
44806 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
44807 may be a lot less than the actual amount of disk space allocated to the file.
44808 If the sizes of a number of files are being added up, the rounding effect can
44809 become quite noticeable, especially on systems that have large block sizes.
44810 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
44811 the obvious value which users understand most easily.
44812 </para>
44813 <para>
44814 The value of the option is expanded, and must then be a numerical value
44815 (decimal point allowed), optionally followed by one of the letters K, M, or G,
44816 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
44817 and further option modifiers. If Exim is running on a system with
44818 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
44819 be handled.
44820 </para>
44821 <para>
44822 The option modifier <option>no_check</option> can be used to force delivery even if the over
44823 quota condition is met. The quota gets updated as usual.
44824 </para>
44825 <para>
44826 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
44827 </para>
44828 <para>
44829 The expansion happens while Exim is running as root, before it changes uid for
44830 the delivery. This means that files that are inaccessible to the end user can
44831 be used to hold quota values that are looked up in the expansion. When delivery
44832 fails because this quota is exceeded, the handling of the error is as for
44833 system quota failures.
44834 </para>
44835 <para>
44836 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
44837 mailbox to the specified maximum size, though the value is not accurate to the
44838 last byte, owing to separator lines and additional headers that may get added
44839 during message delivery. When a mailbox is nearly full, large messages may get
44840 refused even though small ones are accepted, because the size of the current
44841 message is added to the quota when the check is made. This behaviour can be
44842 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
44843 for exceeding the quota does not include the current message. Thus, deliveries
44844 continue until the quota has been exceeded; thereafter, no further messages are
44845 delivered. See also <option>quota_warn_threshold</option>.
44846 </para>
44847 <para>
44848 <indexterm role="option">
44849 <primary><option>quota_directory</option></primary>
44850 </indexterm>
44851 </para>
44852 <informaltable frame="all">
44853 <tgroup cols="4" colsep="0" rowsep="0">
44854 <colspec colwidth="8*" align="left"/>
44855 <colspec colwidth="6*" align="center"/>
44856 <colspec colwidth="6*" align="center"/>
44857 <colspec colwidth="6*" align="right"/>
44858 <tbody>
44859 <row>
44860 <entry><option>quota_directory</option></entry>
44861 <entry>Use: <emphasis>appendfile</emphasis></entry>
44862 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44863 <entry>Default: <emphasis>unset</emphasis></entry>
44864 </row>
44865 </tbody>
44866 </tgroup>
44867 </informaltable>
44868 <para>
44869 This option defines the directory to check for quota purposes when delivering
44870 into individual files. The default is the delivery directory, or, if a file
44871 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
44872 delivery directory.
44873 </para>
44874 <para>
44875 <indexterm role="option">
44876 <primary><option>quota_filecount</option></primary>
44877 </indexterm>
44878 </para>
44879 <informaltable frame="all">
44880 <tgroup cols="4" colsep="0" rowsep="0">
44881 <colspec colwidth="8*" align="left"/>
44882 <colspec colwidth="6*" align="center"/>
44883 <colspec colwidth="6*" align="center"/>
44884 <colspec colwidth="6*" align="right"/>
44885 <tbody>
44886 <row>
44887 <entry><option>quota_filecount</option></entry>
44888 <entry>Use: <emphasis>appendfile</emphasis></entry>
44889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44890 <entry>Default: <emphasis>0</emphasis></entry>
44891 </row>
44892 </tbody>
44893 </tgroup>
44894 </informaltable>
44895 <para>
44896 This option applies when the <option>directory</option> option is set. It limits the total
44897 number of files in the directory (compare the inode limit in system quotas). It
44898 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
44899 failure causes delivery to be deferred. A value of zero is interpreted as
44900 <quote>no quota</quote>.
44901 </para>
44902 <para>
44903 The option modifier <option>no_check</option> can be used to force delivery even if the over
44904 quota condition is met. The quota gets updated as usual.
44905 </para>
44906 <para>
44907 <indexterm role="option">
44908 <primary><option>quota_is_inclusive</option></primary>
44909 </indexterm>
44910 </para>
44911 <informaltable frame="all">
44912 <tgroup cols="4" colsep="0" rowsep="0">
44913 <colspec colwidth="8*" align="left"/>
44914 <colspec colwidth="6*" align="center"/>
44915 <colspec colwidth="6*" align="center"/>
44916 <colspec colwidth="6*" align="right"/>
44917 <tbody>
44918 <row>
44919 <entry><option>quota_is_inclusive</option></entry>
44920 <entry>Use: <emphasis>appendfile</emphasis></entry>
44921 <entry>Type: <emphasis>boolean</emphasis></entry>
44922 <entry>Default: <emphasis>true</emphasis></entry>
44923 </row>
44924 </tbody>
44925 </tgroup>
44926 </informaltable>
44927 <para>
44928 See <option>quota</option> above.
44929 </para>
44930 <para>
44931 <indexterm role="option">
44932 <primary><option>quota_size_regex</option></primary>
44933 </indexterm>
44934 </para>
44935 <informaltable frame="all">
44936 <tgroup cols="4" colsep="0" rowsep="0">
44937 <colspec colwidth="8*" align="left"/>
44938 <colspec colwidth="6*" align="center"/>
44939 <colspec colwidth="6*" align="center"/>
44940 <colspec colwidth="6*" align="right"/>
44941 <tbody>
44942 <row>
44943 <entry><option>quota_size_regex</option></entry>
44944 <entry>Use: <emphasis>appendfile</emphasis></entry>
44945 <entry>Type: <emphasis>string</emphasis></entry>
44946 <entry>Default: <emphasis>unset</emphasis></entry>
44947 </row>
44948 </tbody>
44949 </tgroup>
44950 </informaltable>
44951 <para>
44952 This option applies when one of the delivery modes that writes a separate file
44953 for each message is being used. When Exim wants to find the size of one of
44954 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
44955 If this is set to a regular expression that matches the filename, and it
44956 captures one string, that string is interpreted as a representation of the
44957 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
44958 </para>
44959 <para>
44960 This feature is useful only when users have no shell access to their mailboxes
44961 &ndash; otherwise they could defeat the quota simply by renaming the files. This
44962 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
44963 the file length to the filename. For example:
44964 </para>
44965 <literallayout class="monospaced">
44966 maildir_tag = ,S=$message_size
44967 quota_size_regex = ,S=(\d+)
44968 </literallayout>
44969 <para>
44970 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
44971 number of lines in the message.
44972 </para>
44973 <para>
44974 The regular expression should not assume that the length is at the end of the
44975 filename (even though <option>maildir_tag</option> puts it there) because maildir MUAs
44976 sometimes add other information onto the ends of message filenames.
44977 </para>
44978 <para>
44979 Section <xref linkend="SECID136"/> contains further information.
44980 </para>
44981 <para>
44982 This option should not be used when other message-handling software
44983 may duplicate messages by making hardlinks to the files.  When that is done Exim
44984 will count the message size once for each filename, in contrast with the actual
44985 disk usage.  When the option is not set, calculating total usage requires
44986 a system-call per file to get the size; the number of links is then available also
44987 as is used to adjust the effective size.
44988 </para>
44989 <para>
44990 <indexterm role="option">
44991 <primary><option>quota_warn_message</option></primary>
44992 </indexterm>
44993 </para>
44994 <informaltable frame="all">
44995 <tgroup cols="4" colsep="0" rowsep="0">
44996 <colspec colwidth="8*" align="left"/>
44997 <colspec colwidth="6*" align="center"/>
44998 <colspec colwidth="6*" align="center"/>
44999 <colspec colwidth="6*" align="right"/>
45000 <tbody>
45001 <row>
45002 <entry><option>quota_warn_message</option></entry>
45003 <entry>Use: <emphasis>appendfile</emphasis></entry>
45004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45005 <entry>Default: <emphasis>see below</emphasis></entry>
45006 </row>
45007 </tbody>
45008 </tgroup>
45009 </informaltable>
45010 <para>
45011 See below for the use of this option. If it is not set when
45012 <option>quota_warn_threshold</option> is set, it defaults to
45013 </para>
45014 <literallayout class="monospaced">
45015 quota_warn_message = "\
45016   To: $local_part@$domain\n\
45017   Subject: Your mailbox\n\n\
45018   This message is automatically created \
45019   by mail delivery software.\n\n\
45020   The size of your mailbox has exceeded \
45021   a warning threshold that is\n\
45022   set by the system administrator.\n"
45023 </literallayout>
45024 <para>
45025 <indexterm role="option">
45026 <primary><option>quota_warn_threshold</option></primary>
45027 </indexterm>
45028 </para>
45029 <informaltable frame="all">
45030 <tgroup cols="4" colsep="0" rowsep="0">
45031 <colspec colwidth="8*" align="left"/>
45032 <colspec colwidth="6*" align="center"/>
45033 <colspec colwidth="6*" align="center"/>
45034 <colspec colwidth="6*" align="right"/>
45035 <tbody>
45036 <row>
45037 <entry><option>quota_warn_threshold</option></entry>
45038 <entry>Use: <emphasis>appendfile</emphasis></entry>
45039 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45040 <entry>Default: <emphasis>0</emphasis></entry>
45041 </row>
45042 </tbody>
45043 </tgroup>
45044 </informaltable>
45045 <para>
45046 <indexterm role="concept">
45047 <primary>quota</primary>
45048 <secondary>warning threshold</secondary>
45049 </indexterm>
45050 <indexterm role="concept">
45051 <primary>mailbox</primary>
45052 <secondary>size warning</secondary>
45053 </indexterm>
45054 <indexterm role="concept">
45055 <primary>size</primary>
45056 <secondary>of mailbox</secondary>
45057 </indexterm>
45058 This option is expanded in the same way as <option>quota</option> (see above). If the
45059 resulting value is greater than zero, and delivery of the message causes the
45060 size of the file or total space in the directory tree to cross the given
45061 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
45062 may be specified as a percentage of it by following the value with a percent
45063 sign. For example:
45064 </para>
45065 <literallayout class="monospaced">
45066 quota = 10M
45067 quota_warn_threshold = 75%
45068 </literallayout>
45069 <para>
45070 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
45071 percent sign is ignored.
45072 </para>
45073 <para>
45074 The warning message itself is specified by the <option>quota_warn_message</option> option,
45075 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
45076 warning message. These do not necessarily have to include the recipient(s) of
45077 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
45078 can include any other header lines that you want. If you do not include a
45079 <emphasis>From:</emphasis> line, the default is:
45080 </para>
45081 <literallayout class="monospaced">
45082 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
45083 </literallayout>
45084 <para>
45085 <indexterm role="option">
45086 <primary><option>errors_reply_to</option></primary>
45087 </indexterm>
45088 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
45089 option.
45090 </para>
45091 <para>
45092 The <option>quota</option> option does not have to be set in order to use this option; they
45093 are independent of one another except when the threshold is specified as a
45094 percentage.
45095 </para>
45096 <para>
45097 <indexterm role="option">
45098 <primary><option>use_bsmtp</option></primary>
45099 </indexterm>
45100 </para>
45101 <informaltable frame="all">
45102 <tgroup cols="4" colsep="0" rowsep="0">
45103 <colspec colwidth="8*" align="left"/>
45104 <colspec colwidth="6*" align="center"/>
45105 <colspec colwidth="6*" align="center"/>
45106 <colspec colwidth="6*" align="right"/>
45107 <tbody>
45108 <row>
45109 <entry><option>use_bsmtp</option></entry>
45110 <entry>Use: <emphasis>appendfile</emphasis></entry>
45111 <entry>Type: <emphasis>boolean</emphasis></entry>
45112 <entry>Default: <emphasis>false</emphasis></entry>
45113 </row>
45114 </tbody>
45115 </tgroup>
45116 </informaltable>
45117 <para>
45118 <indexterm role="concept">
45119 <primary>envelope from</primary>
45120 </indexterm>
45121 <indexterm role="concept">
45122 <primary>envelope sender</primary>
45123 </indexterm>
45124 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
45125 format, with the envelope sender and recipient(s) included as SMTP commands. If
45126 you want to include a leading HELO command with such messages, you can do
45127 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
45128 for details of batch SMTP.
45129 </para>
45130 <para>
45131 <indexterm role="option">
45132 <primary><option>use_crlf</option></primary>
45133 </indexterm>
45134 </para>
45135 <informaltable frame="all">
45136 <tgroup cols="4" colsep="0" rowsep="0">
45137 <colspec colwidth="8*" align="left"/>
45138 <colspec colwidth="6*" align="center"/>
45139 <colspec colwidth="6*" align="center"/>
45140 <colspec colwidth="6*" align="right"/>
45141 <tbody>
45142 <row>
45143 <entry><option>use_crlf</option></entry>
45144 <entry>Use: <emphasis>appendfile</emphasis></entry>
45145 <entry>Type: <emphasis>boolean</emphasis></entry>
45146 <entry>Default: <emphasis>false</emphasis></entry>
45147 </row>
45148 </tbody>
45149 </tgroup>
45150 </informaltable>
45151 <para>
45152 <indexterm role="concept">
45153 <primary>carriage return</primary>
45154 </indexterm>
45155 <indexterm role="concept">
45156 <primary>linefeed</primary>
45157 </indexterm>
45158 This option causes lines to be terminated with the two-character CRLF sequence
45159 (carriage return, linefeed) instead of just a linefeed character. In the case
45160 of batched SMTP, the byte sequence written to the file is then an exact image
45161 of what would be sent down a real SMTP connection.
45162 </para>
45163 <para>
45164 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
45165 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
45166 in Berkeley-style mailboxes) are written verbatim, so must contain their own
45167 carriage return characters if these are needed. In cases where these options
45168 have non-empty defaults, the values end with a single linefeed, so they must be
45169 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45170 </para>
45171 <para>
45172 <indexterm role="option">
45173 <primary><option>use_fcntl_lock</option></primary>
45174 </indexterm>
45175 </para>
45176 <informaltable frame="all">
45177 <tgroup cols="4" colsep="0" rowsep="0">
45178 <colspec colwidth="8*" align="left"/>
45179 <colspec colwidth="6*" align="center"/>
45180 <colspec colwidth="6*" align="center"/>
45181 <colspec colwidth="6*" align="right"/>
45182 <tbody>
45183 <row>
45184 <entry><option>use_fcntl_lock</option></entry>
45185 <entry>Use: <emphasis>appendfile</emphasis></entry>
45186 <entry>Type: <emphasis>boolean</emphasis></entry>
45187 <entry>Default: <emphasis>see below</emphasis></entry>
45188 </row>
45189 </tbody>
45190 </tgroup>
45191 </informaltable>
45192 <para>
45193 This option controls the use of the <function>fcntl()</function> function to lock a file for
45194 exclusive use when a message is being appended. It is set by default unless
45195 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
45196 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
45197 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
45198 </para>
45199 <para>
45200 <indexterm role="option">
45201 <primary><option>use_flock_lock</option></primary>
45202 </indexterm>
45203 </para>
45204 <informaltable frame="all">
45205 <tgroup cols="4" colsep="0" rowsep="0">
45206 <colspec colwidth="8*" align="left"/>
45207 <colspec colwidth="6*" align="center"/>
45208 <colspec colwidth="6*" align="center"/>
45209 <colspec colwidth="6*" align="right"/>
45210 <tbody>
45211 <row>
45212 <entry><option>use_flock_lock</option></entry>
45213 <entry>Use: <emphasis>appendfile</emphasis></entry>
45214 <entry>Type: <emphasis>boolean</emphasis></entry>
45215 <entry>Default: <emphasis>false</emphasis></entry>
45216 </row>
45217 </tbody>
45218 </tgroup>
45219 </informaltable>
45220 <para>
45221 This option is provided to support the use of <function>flock()</function> for file locking, for
45222 the few situations where it is needed. Most modern operating systems support
45223 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
45224 each other. Exim uses <function>fcntl()</function> locking by default.
45225 </para>
45226 <para>
45227 This option is required only if you are using an operating system where
45228 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
45229 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
45230 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
45231 </para>
45232 <para>
45233 <indexterm role="concept">
45234 <primary>Solaris</primary>
45235 <secondary><function>flock()</function> support</secondary>
45236 </indexterm>
45237 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
45238 have it (and some, I think, provide a not quite right version built on top of
45239 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
45240 the ability to use it, and any attempt to do so will cause a configuration
45241 error.
45242 </para>
45243 <para>
45244 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
45245 is just being mapped onto <function>fcntl()</function> by the OS).
45246 </para>
45247 <para>
45248 <indexterm role="option">
45249 <primary><option>use_lockfile</option></primary>
45250 </indexterm>
45251 </para>
45252 <informaltable frame="all">
45253 <tgroup cols="4" colsep="0" rowsep="0">
45254 <colspec colwidth="8*" align="left"/>
45255 <colspec colwidth="6*" align="center"/>
45256 <colspec colwidth="6*" align="center"/>
45257 <colspec colwidth="6*" align="right"/>
45258 <tbody>
45259 <row>
45260 <entry><option>use_lockfile</option></entry>
45261 <entry>Use: <emphasis>appendfile</emphasis></entry>
45262 <entry>Type: <emphasis>boolean</emphasis></entry>
45263 <entry>Default: <emphasis>see below</emphasis></entry>
45264 </row>
45265 </tbody>
45266 </tgroup>
45267 </informaltable>
45268 <para>
45269 If this option is turned off, Exim does not attempt to create a lock file when
45270 appending to a mailbox file. In this situation, the only locking is by
45271 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
45272 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
45273 <function>fcntl()</function> rather than a lock file, and even then only when you are not
45274 delivering over NFS from more than one host.
45275 </para>
45276 <para>
45277 <indexterm role="concept">
45278 <primary>NFS</primary>
45279 <secondary>lock file</secondary>
45280 </indexterm>
45281 In order to append to an NFS file safely from more than one host, it is
45282 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
45283 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
45284 file corruption.
45285 </para>
45286 <para>
45287 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
45288 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
45289 except when <option>mbx_format</option> is set.
45290 </para>
45291 <para>
45292 <indexterm role="option">
45293 <primary><option>use_mbx_lock</option></primary>
45294 </indexterm>
45295 </para>
45296 <informaltable frame="all">
45297 <tgroup cols="4" colsep="0" rowsep="0">
45298 <colspec colwidth="8*" align="left"/>
45299 <colspec colwidth="6*" align="center"/>
45300 <colspec colwidth="6*" align="center"/>
45301 <colspec colwidth="6*" align="right"/>
45302 <tbody>
45303 <row>
45304 <entry><option>use_mbx_lock</option></entry>
45305 <entry>Use: <emphasis>appendfile</emphasis></entry>
45306 <entry>Type: <emphasis>boolean</emphasis></entry>
45307 <entry>Default: <emphasis>see below</emphasis></entry>
45308 </row>
45309 </tbody>
45310 </tgroup>
45311 </informaltable>
45312 <para>
45313 This option is available only if Exim has been compiled with SUPPORT_MBX
45314 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
45315 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
45316 of the locking options are mentioned in the configuration. The locking rules
45317 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
45318 the IMAP4 and POP daemons that come with it (see the discussion below). The
45319 rules allow for shared access to the mailbox. However, this kind of locking
45320 does not work when the mailbox is NFS mounted.
45321 </para>
45322 <para>
45323 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
45324 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
45325 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
45326 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
45327 </para>
45328 </section>
45329 <section id="SECTopappend">
45330 <title>Operational details for appending</title>
45331 <para>
45332 <indexterm role="concept">
45333 <primary>appending to a file</primary>
45334 </indexterm>
45335 <indexterm role="concept">
45336 <primary>file</primary>
45337 <secondary>appending</secondary>
45338 </indexterm>
45339 Before appending to a file, the following preparations are made:
45340 </para>
45341 <itemizedlist>
45342 <listitem>
45343 <para>
45344 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
45345 return is given.
45346 </para>
45347 </listitem>
45348 <listitem>
45349 <para>
45350 <indexterm role="concept">
45351 <primary>directory creation</primary>
45352 </indexterm>
45353 If any directories on the file&#x2019;s path are missing, Exim creates them if the
45354 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
45355 <option>directory_mode</option> option.
45356 </para>
45357 </listitem>
45358 <listitem>
45359 <para>
45360 If <option>file_format</option> is set, the format of an existing file is checked. If this
45361 indicates that a different transport should be used, control is passed to that
45362 transport.
45363 </para>
45364 </listitem>
45365 <listitem>
45366 <para>
45367 <indexterm role="concept">
45368 <primary>file</primary>
45369 <secondary>locking</secondary>
45370 </indexterm>
45371 <indexterm role="concept">
45372 <primary>locking files</primary>
45373 </indexterm>
45374 <indexterm role="concept">
45375 <primary>NFS</primary>
45376 <secondary>lock file</secondary>
45377 </indexterm>
45378 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
45379 reliably over NFS, as follows:
45380 </para>
45381 <orderedlist numeration="arabic">
45382 <listitem>
45383 <para>
45384 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
45385 current time, primary host name, and process id added, by opening for writing
45386 as a new file. If this fails with an access error, delivery is deferred.
45387 </para>
45388 </listitem>
45389 <listitem>
45390 <para>
45391 Close the hitching post file, and hard link it to the lock filename.
45392 </para>
45393 </listitem>
45394 <listitem>
45395 <para>
45396 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
45397 Unlink the hitching post name.
45398 </para>
45399 </listitem>
45400 <listitem>
45401 <para>
45402 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
45403 then unlink hitching post name. If the number of links is exactly two, creation
45404 of the lock file succeeded but something (for example, an NFS server crash and
45405 restart) caused this fact not to be communicated to the <function>link()</function> call.
45406 </para>
45407 </listitem>
45408 <listitem>
45409 <para>
45410 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
45411 up to <option>lock_retries</option> times. However, since any program that writes to a
45412 mailbox should complete its task very quickly, it is reasonable to time out old
45413 lock files that are normally the result of user agent and system crashes. If an
45414 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
45415 it before trying again.
45416 </para>
45417 </listitem>
45418 </orderedlist>
45419 </listitem>
45420 <listitem>
45421 <para>
45422 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
45423 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
45424 than non-existence, delivery is deferred.
45425 </para>
45426 </listitem>
45427 <listitem>
45428 <para>
45429 <indexterm role="concept">
45430 <primary>symbolic link</primary>
45431 <secondary>to mailbox</secondary>
45432 </indexterm>
45433 <indexterm role="concept">
45434 <primary>mailbox</primary>
45435 <secondary>symbolic link</secondary>
45436 </indexterm>
45437 If the file does exist and is a symbolic link, delivery is deferred, unless the
45438 <option>allow_symlink</option> option is set, in which case the ownership of the link is
45439 checked, and then <function>stat()</function> is called to find out about the real file, which
45440 is then subjected to the checks below. The check on the top-level link
45441 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
45442 directory, though allowing symbolic links in this case is definitely not a good
45443 idea. If there is a chain of symbolic links, the intermediate ones are not
45444 checked.
45445 </para>
45446 </listitem>
45447 <listitem>
45448 <para>
45449 If the file already exists but is not a regular file, or if the file&#x2019;s owner
45450 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
45451 different from the user and group under which the delivery is running,
45452 delivery is deferred.
45453 </para>
45454 </listitem>
45455 <listitem>
45456 <para>
45457 If the file&#x2019;s permissions are more generous than specified, they are reduced.
45458 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
45459 is set false, in which case the delivery is tried using the existing
45460 permissions.
45461 </para>
45462 </listitem>
45463 <listitem>
45464 <para>
45465 The file&#x2019;s inode number is saved, and the file is then opened for appending.
45466 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
45467 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
45468 </para>
45469 </listitem>
45470 <listitem>
45471 <para>
45472 If the file is opened successfully, check that the inode number hasn&#x2019;t
45473 changed, that it is still a regular file, and that the owner and permissions
45474 have not changed. If anything is wrong, defer delivery and freeze the message.
45475 </para>
45476 </listitem>
45477 <listitem>
45478 <para>
45479 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
45480 option is set. Otherwise, check that the file is being created in a permitted
45481 directory if the <option>create_file</option> option is set (deferring on failure), and then
45482 open for writing as a new file, with the O_EXCL and O_CREAT options,
45483 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
45484 set). In this case, which can happen if the link points to a non-existent file,
45485 the file is opened for writing using O_CREAT but not O_EXCL, because
45486 that prevents link following.
45487 </para>
45488 </listitem>
45489 <listitem>
45490 <para>
45491 <indexterm role="concept">
45492 <primary>loop</primary>
45493 <secondary>while file testing</secondary>
45494 </indexterm>
45495 If opening fails because the file exists, obey the tests given above for
45496 existing files. However, to avoid looping in a situation where the file is
45497 being continuously created and destroyed, the exists/not-exists loop is broken
45498 after 10 repetitions, and the message is then frozen.
45499 </para>
45500 </listitem>
45501 <listitem>
45502 <para>
45503 If opening fails with any other error, defer delivery.
45504 </para>
45505 </listitem>
45506 <listitem>
45507 <para>
45508 <indexterm role="concept">
45509 <primary>file</primary>
45510 <secondary>locking</secondary>
45511 </indexterm>
45512 <indexterm role="concept">
45513 <primary>locking files</primary>
45514 </indexterm>
45515 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
45516 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
45517 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
45518 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
45519 file, and an exclusive lock on the file whose name is
45520 </para>
45521 <literallayout class="monospaced">
45522 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
45523 </literallayout>
45524 <para>
45525 using the device and inode numbers of the open mailbox file, in accordance with
45526 the MBX locking rules. This file is created with a mode that is specified by
45527 the <option>lockfile_mode</option> option.
45528 </para>
45529 <para>
45530 If Exim fails to lock the file, there are two possible courses of action,
45531 depending on the value of the locking timeout. This is obtained from
45532 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
45533 </para>
45534 <para>
45535 If the timeout value is zero, the file is closed, Exim waits for
45536 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
45537 to lock it again. This happens up to <option>lock_retries</option> times, after which the
45538 delivery is deferred.
45539 </para>
45540 <para>
45541 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
45542 <function>flock()</function> are used (with the given timeout), so there has already been some
45543 waiting involved by the time locking fails. Nevertheless, Exim does not give up
45544 immediately. It retries up to
45545 </para>
45546 <literallayout class="monospaced">
45547 (lock_retries * lock_interval) / &lt;timeout&gt;
45548 </literallayout>
45549 <para>
45550 times (rounded up).
45551 </para>
45552 </listitem>
45553 </itemizedlist>
45554 <para>
45555 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
45556 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
45557 </para>
45558 </section>
45559 <section id="SECTopdir">
45560 <title>Operational details for delivery to a new file</title>
45561 <para>
45562 <indexterm role="concept">
45563 <primary>delivery</primary>
45564 <secondary>to single file</secondary>
45565 </indexterm>
45566 <indexterm role="concept">
45567 <primary><quote>From</quote> line</primary>
45568 </indexterm>
45569 When the <option>directory</option> option is set instead of <option>file</option>, each message is
45570 delivered into a newly-created file or set of files. When <command>appendfile</command> is
45571 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
45572 <option>directory</option> is normally set, because the path for delivery is supplied by the
45573 router. (See for example, the <command>address_file</command> transport in the default
45574 configuration.) In this case, delivery is to a new file if either the path name
45575 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
45576 </para>
45577 <para>
45578 No locking is required while writing the message to a new file, so the various
45579 locking options of the transport are ignored. The <quote>From</quote> line that by default
45580 separates messages in a single file is not normally needed, nor is the escaping
45581 of message lines that start with <quote>From</quote>, and there is no need to ensure a
45582 newline at the end of each message. Consequently, the default values for
45583 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
45584 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
45585 </para>
45586 <para>
45587 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
45588 the files in the delivery directory by default. However, you can specify a
45589 different directory by setting <option>quota_directory</option>. Also, for maildir
45590 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
45591 </para>
45592 <para>
45593 <indexterm role="concept">
45594 <primary>maildir format</primary>
45595 </indexterm>
45596 <indexterm role="concept">
45597 <primary>mailstore format</primary>
45598 </indexterm>
45599 There are three different ways in which delivery to individual files can be
45600 done, controlled by the settings of the <option>maildir_format</option> and
45601 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
45602 formats is not included in the binary unless SUPPORT_MAILDIR or
45603 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
45604 </para>
45605 <para>
45606 <indexterm role="concept">
45607 <primary>directory creation</primary>
45608 </indexterm>
45609 In all three cases an attempt is made to create the directory and any necessary
45610 sub-directories if they do not exist, provided that the <option>create_directory</option>
45611 option is set (the default). The location of a created directory can be
45612 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
45613 the <option>directory_mode</option> option. If creation fails, or if the
45614 <option>create_directory</option> option is not set when creation is required, delivery is
45615 deferred.
45616 </para>
45617 </section>
45618 <section id="SECTmaildirdelivery">
45619 <title>Maildir delivery</title>
45620 <para>
45621 <indexterm role="concept">
45622 <primary>maildir format</primary>
45623 <secondary>description of</secondary>
45624 </indexterm>
45625 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
45626 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
45627 directory that is defined by the <option>directory</option> option (the <quote>delivery
45628 directory</quote>). If the delivery is successful, the file is renamed into the
45629 <filename>new</filename> subdirectory.
45630 </para>
45631 <para>
45632 In the filename, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
45633 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
45634 Exim checks that the time-of-day clock has moved on by at least one microsecond
45635 before terminating the delivery process. This guarantees uniqueness for the
45636 filename. However, as a precaution, Exim calls <function>stat()</function> for the file before
45637 opening it. If any response other than ENOENT (does not exist) is given,
45638 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
45639 </para>
45640 <para>
45641 Before Exim carries out a maildir delivery, it ensures that subdirectories
45642 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
45643 do not exist, Exim tries to create them and any superior directories in their
45644 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
45645 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
45646 contains matches the delivery directory, Exim also ensures that a file called
45647 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
45648 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
45649 </para>
45650 <para>
45651 These features make it possible to use Exim to create all the necessary files
45652 and directories in a maildir mailbox, including subdirectories for maildir++
45653 folders. Consider this example:
45654 </para>
45655 <literallayout class="monospaced">
45656 maildir_format = true
45657 directory = /var/mail/$local_part_data\
45658            ${if eq{$local_part_suffix}{}{}\
45659            {/.${substr_1:$local_part_suffix}}}
45660 maildirfolder_create_regex = /\.[^/]+$
45661 </literallayout>
45662 <para>
45663 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
45664 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
45665 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
45666 not match this name, so Exim will not look for or create the file
45667 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
45668 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
45669 </para>
45670 <para>
45671 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
45672 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
45673 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
45674 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
45675 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
45676 </para>
45677 <para>
45678 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
45679 not inadvertently match the toplevel maildir directory, because a
45680 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
45681 </para>
45682 <para>
45683 <indexterm role="concept">
45684 <primary>quota</primary>
45685 <secondary>in maildir delivery</secondary>
45686 </indexterm>
45687 <indexterm role="concept">
45688 <primary>maildir++</primary>
45689 </indexterm>
45690 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
45691 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
45692 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
45693 Exim assumes the directory is a maildir++ folder directory, which is one level
45694 down from the user&#x2019;s top level mailbox directory. This causes it to start at
45695 the parent directory instead of the current directory when calculating the
45696 amount of space used.
45697 </para>
45698 <para>
45699 One problem with delivering into a multi-file mailbox is that it is
45700 computationally expensive to compute the size of the mailbox for quota
45701 checking. Various approaches have been taken to reduce the amount of work
45702 needed. The next two sections describe two of them. A third alternative is to
45703 use some external process for maintaining the size data, and use the expansion
45704 of the <option>mailbox_size</option> option as a way of importing it into Exim.
45705 </para>
45706 </section>
45707 <section id="SECID135">
45708 <title>Using tags to record message sizes</title>
45709 <para>
45710 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
45711 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
45712 tag is added to its name. However, if adding the tag takes the length of the
45713 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
45714 the tag is dropped and the maildir file is created with no tag.
45715 </para>
45716 <para>
45717 <indexterm role="variable">
45718 <primary><varname>$message_size</varname></primary>
45719 </indexterm>
45720 Tags can be used to encode the size of files in their names; see
45721 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
45722 happens after the message has been written. The value of the <varname>$message_size</varname>
45723 variable is set to the number of bytes actually written. If the expansion is
45724 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
45725 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
45726 Non-printing characters in the string are ignored; if the resulting string is
45727 empty, it is ignored. If it starts with an alphanumeric character, a leading
45728 colon is inserted; this default has not proven to be the path that popular
45729 maildir implementations have chosen (but changing it in Exim would break
45730 backwards compatibility).
45731 </para>
45732 <para>
45733 For one common implementation, you might set:
45734 </para>
45735 <literallayout class="monospaced">
45736 maildir_tag = ,S=${message_size}
45737 </literallayout>
45738 <para>
45739 but you should check the documentation of the other software to be sure.
45740 </para>
45741 <para>
45742 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
45743 as this allows Exim to extract the size from your tag, instead of having to
45744 <function>stat()</function> each message file.
45745 </para>
45746 </section>
45747 <section id="SECID136">
45748 <title>Using a maildirsize file</title>
45749 <para>
45750 <indexterm role="concept">
45751 <primary>quota</primary>
45752 <secondary>in maildir delivery</secondary>
45753 </indexterm>
45754 <indexterm role="concept">
45755 <primary>maildir format</primary>
45756 <secondary><filename>maildirsize</filename> file</secondary>
45757 </indexterm>
45758 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
45759 storing quota and message size information in a file called <filename>maildirsize</filename>
45760 within the toplevel maildir directory. If this file does not exist, Exim
45761 creates it, setting the quota from the <option>quota</option> option of the transport. If
45762 the maildir directory itself does not exist, it is created before any attempt
45763 to write a <filename>maildirsize</filename> file.
45764 </para>
45765 <para>
45766 The <filename>maildirsize</filename> file is used to hold information about the sizes of
45767 messages in the maildir, thus speeding up quota calculations. The quota value
45768 in the file is just a cache; if the quota is changed in the transport, the new
45769 value overrides the cached value when the next message is delivered. The cache
45770 is maintained for the benefit of other programs that access the maildir and
45771 need to know the quota.
45772 </para>
45773 <para>
45774 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
45775 file is maintained (with a zero quota setting), but no quota is imposed.
45776 </para>
45777 <para>
45778 A regular expression is available for controlling which directories in the
45779 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
45780 See the description of the <option>maildir_quota_directory_regex</option> option above for
45781 details.
45782 </para>
45783 </section>
45784 <section id="SECID137">
45785 <title>Mailstore delivery</title>
45786 <para>
45787 <indexterm role="concept">
45788 <primary>mailstore format</primary>
45789 <secondary>description of</secondary>
45790 </indexterm>
45791 If the <option>mailstore_format</option> option is true, each message is written as two
45792 files in the given directory. A unique base name is constructed from the
45793 message id and the current delivery process, and the files that are written use
45794 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
45795 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
45796 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
45797 </para>
45798 <para>
45799 During delivery, the envelope is first written to a file with the suffix
45800 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
45801 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
45802 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
45803 file before accessing either of them. An alternative approach is to wait for
45804 the absence of a <filename>.tmp</filename> file.
45805 </para>
45806 <para>
45807 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
45808 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
45809 the sender address on one line, then all the recipient addresses, one per line.
45810 There can be more than one recipient only if the <option>batch_max</option> option is set
45811 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
45812 appended to the file, followed by a newline if it does not end with one.
45813 </para>
45814 <para>
45815 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
45816 failure, it is ignored. Other expansion errors are treated as serious
45817 configuration errors, and delivery is deferred. The variable
45818 <varname>$mailstore_basename</varname> is available for use during these expansions.
45819 </para>
45820 </section>
45821 <section id="SECID138">
45822 <title>Non-special new file delivery</title>
45823 <para>
45824 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
45825 file is created directly in the named directory. For example, when delivering
45826 messages into files in batched SMTP format for later delivery to some host (see
45827 section <xref linkend="SECTbatchSMTP"/>), a setting such as
45828 </para>
45829 <literallayout class="monospaced">
45830 directory = /var/bsmtp/$host
45831 </literallayout>
45832 <para>
45833 might be used. A message is written to a file with a temporary name, which is
45834 then renamed when the delivery is complete. The final name is obtained by
45835 expanding the contents of the <option>directory_file</option> option.
45836 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
45837 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
45838 </para>
45839 </section>
45840 </chapter>
45841
45842 <chapter id="CHID8">
45843 <title>The autoreply transport</title>
45844 <para>
45845 <indexterm role="concept" id="IIDauttra1" class="startofrange">
45846 <primary>transports</primary>
45847 <secondary><command>autoreply</command></secondary>
45848 </indexterm>
45849 <indexterm role="concept" id="IIDauttra2" class="startofrange">
45850 <primary><command>autoreply</command> transport</primary>
45851 </indexterm>
45852 The <command>autoreply</command> transport is not a true transport in that it does not cause
45853 the message to be transmitted. Instead, it generates a new mail message as an
45854 automatic reply to the incoming message. <emphasis>References:</emphasis> and
45855 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
45856 to the rules in RFCs 2822 and 3834, respectively.
45857 </para>
45858 <para>
45859 If the router that passes the message to this transport does not have the
45860 <option>unseen</option> option set, the original message (for the current recipient) is not
45861 delivered anywhere. However, when the <option>unseen</option> option is set on the router
45862 that passes the message to this transport, routing of the address continues, so
45863 another router can set up a normal message delivery.
45864 </para>
45865 <para>
45866 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
45867 <quote>vacation</quote> message being the standard example. However, it can also be run
45868 directly from a router like any other transport. To reduce the possibility of
45869 message cascades, messages created by the <command>autoreply</command> transport always have
45870 empty envelope sender addresses, like bounce messages.
45871 </para>
45872 <para>
45873 The parameters of the message to be sent can be specified in the configuration
45874 by options described below. However, these are used only when the address
45875 passed to the transport does not contain its own reply information. When the
45876 transport is run as a consequence of a
45877 <option>mail</option>
45878 or <option>vacation</option> command in a filter file, the parameters of the message are
45879 supplied by the filter, and passed with the address. The transport&#x2019;s options
45880 that define the message are then ignored (so they are not usually set in this
45881 case). The message is specified entirely by the filter or by the transport; it
45882 is never built from a mixture of options. However, the <option>file_optional</option>,
45883 <option>mode</option>, and <option>return_message</option> options apply in all cases.
45884 </para>
45885 <para>
45886 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
45887 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
45888 gid of the user, and with appropriate current and home directories (see chapter
45889 <xref linkend="CHAPenvironment"/>).
45890 </para>
45891 <para>
45892 There is a subtle difference between routing a message to a <command>pipe</command> transport
45893 that generates some text to be returned to the sender, and routing it to an
45894 <command>autoreply</command> transport. This difference is noticeable only if more than one
45895 address from the same message is so handled. In the case of a pipe, the
45896 separate outputs from the different addresses are gathered up and returned to
45897 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
45898 message is generated for each address that is passed to it.
45899 </para>
45900 <para>
45901 Non-printing characters are not permitted in the header lines generated for the
45902 message that <command>autoreply</command> creates, with the exception of newlines that are
45903 immediately followed by white space. If any non-printing characters are found,
45904 the transport defers.
45905 Whether characters with the top bit set count as printing characters or not is
45906 controlled by the <option>print_topbitchars</option> global option.
45907 </para>
45908 <para>
45909 If any of the generic options for manipulating headers (for example,
45910 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
45911 of the original message that is included in the generated message when
45912 <option>return_message</option> is set. They do not apply to the generated message itself.
45913 </para>
45914 <para>
45915 <indexterm role="variable">
45916 <primary><varname>$sender_address</varname></primary>
45917 </indexterm>
45918 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
45919 the message, indicating that there were no recipients, it does not treat this
45920 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
45921 is empty (because the incoming message is a bounce message) do not cause
45922 problems. They are just discarded.
45923 </para>
45924 <section id="SECID139">
45925 <title>Private options for autoreply</title>
45926 <para>
45927 <indexterm role="concept">
45928 <primary>options</primary>
45929 <secondary><command>autoreply</command> transport</secondary>
45930 </indexterm>
45931 </para>
45932 <para>
45933 <indexterm role="option">
45934 <primary><option>bcc</option></primary>
45935 </indexterm>
45936 </para>
45937 <informaltable frame="all">
45938 <tgroup cols="4" colsep="0" rowsep="0">
45939 <colspec colwidth="8*" align="left"/>
45940 <colspec colwidth="6*" align="center"/>
45941 <colspec colwidth="6*" align="center"/>
45942 <colspec colwidth="6*" align="right"/>
45943 <tbody>
45944 <row>
45945 <entry><option>bcc</option></entry>
45946 <entry>Use: <emphasis>autoreply</emphasis></entry>
45947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45948 <entry>Default: <emphasis>unset</emphasis></entry>
45949 </row>
45950 </tbody>
45951 </tgroup>
45952 </informaltable>
45953 <para>
45954 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
45955 message when the message is specified by the transport.
45956 </para>
45957 <para>
45958 <indexterm role="option">
45959 <primary><option>cc</option></primary>
45960 </indexterm>
45961 </para>
45962 <informaltable frame="all">
45963 <tgroup cols="4" colsep="0" rowsep="0">
45964 <colspec colwidth="8*" align="left"/>
45965 <colspec colwidth="6*" align="center"/>
45966 <colspec colwidth="6*" align="center"/>
45967 <colspec colwidth="6*" align="right"/>
45968 <tbody>
45969 <row>
45970 <entry><option>cc</option></entry>
45971 <entry>Use: <emphasis>autoreply</emphasis></entry>
45972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45973 <entry>Default: <emphasis>unset</emphasis></entry>
45974 </row>
45975 </tbody>
45976 </tgroup>
45977 </informaltable>
45978 <para>
45979 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
45980 when the message is specified by the transport.
45981 </para>
45982 <para>
45983 <indexterm role="option">
45984 <primary><option>file</option></primary>
45985 </indexterm>
45986 </para>
45987 <informaltable frame="all">
45988 <tgroup cols="4" colsep="0" rowsep="0">
45989 <colspec colwidth="8*" align="left"/>
45990 <colspec colwidth="6*" align="center"/>
45991 <colspec colwidth="6*" align="center"/>
45992 <colspec colwidth="6*" align="right"/>
45993 <tbody>
45994 <row>
45995 <entry><option>file</option></entry>
45996 <entry>Use: <emphasis>autoreply</emphasis></entry>
45997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45998 <entry>Default: <emphasis>unset</emphasis></entry>
45999 </row>
46000 </tbody>
46001 </tgroup>
46002 </informaltable>
46003 <para>
46004 The contents of the file are sent as the body of the message when the message
46005 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
46006 string comes first.
46007 </para>
46008 <para>
46009 <indexterm role="option">
46010 <primary><option>file_expand</option></primary>
46011 </indexterm>
46012 </para>
46013 <informaltable frame="all">
46014 <tgroup cols="4" colsep="0" rowsep="0">
46015 <colspec colwidth="8*" align="left"/>
46016 <colspec colwidth="6*" align="center"/>
46017 <colspec colwidth="6*" align="center"/>
46018 <colspec colwidth="6*" align="right"/>
46019 <tbody>
46020 <row>
46021 <entry><option>file_expand</option></entry>
46022 <entry>Use: <emphasis>autoreply</emphasis></entry>
46023 <entry>Type: <emphasis>boolean</emphasis></entry>
46024 <entry>Default: <emphasis>false</emphasis></entry>
46025 </row>
46026 </tbody>
46027 </tgroup>
46028 </informaltable>
46029 <para>
46030 If this is set, the contents of the file named by the <option>file</option> option are
46031 subjected to string expansion as they are added to the message.
46032 </para>
46033 <para>
46034 <indexterm role="option">
46035 <primary><option>file_optional</option></primary>
46036 </indexterm>
46037 </para>
46038 <informaltable frame="all">
46039 <tgroup cols="4" colsep="0" rowsep="0">
46040 <colspec colwidth="8*" align="left"/>
46041 <colspec colwidth="6*" align="center"/>
46042 <colspec colwidth="6*" align="center"/>
46043 <colspec colwidth="6*" align="right"/>
46044 <tbody>
46045 <row>
46046 <entry><option>file_optional</option></entry>
46047 <entry>Use: <emphasis>autoreply</emphasis></entry>
46048 <entry>Type: <emphasis>boolean</emphasis></entry>
46049 <entry>Default: <emphasis>false</emphasis></entry>
46050 </row>
46051 </tbody>
46052 </tgroup>
46053 </informaltable>
46054 <para>
46055 If this option is true, no error is generated if the file named by the <option>file</option>
46056 option or passed with the address does not exist or cannot be read.
46057 </para>
46058 <para>
46059 <indexterm role="option">
46060 <primary><option>from</option></primary>
46061 </indexterm>
46062 </para>
46063 <informaltable frame="all">
46064 <tgroup cols="4" colsep="0" rowsep="0">
46065 <colspec colwidth="8*" align="left"/>
46066 <colspec colwidth="6*" align="center"/>
46067 <colspec colwidth="6*" align="center"/>
46068 <colspec colwidth="6*" align="right"/>
46069 <tbody>
46070 <row>
46071 <entry><option>from</option></entry>
46072 <entry>Use: <emphasis>autoreply</emphasis></entry>
46073 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46074 <entry>Default: <emphasis>unset</emphasis></entry>
46075 </row>
46076 </tbody>
46077 </tgroup>
46078 </informaltable>
46079 <para>
46080 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
46081 specified by the transport.
46082 </para>
46083 <para>
46084 <indexterm role="option">
46085 <primary><option>headers</option></primary>
46086 </indexterm>
46087 </para>
46088 <informaltable frame="all">
46089 <tgroup cols="4" colsep="0" rowsep="0">
46090 <colspec colwidth="8*" align="left"/>
46091 <colspec colwidth="6*" align="center"/>
46092 <colspec colwidth="6*" align="center"/>
46093 <colspec colwidth="6*" align="right"/>
46094 <tbody>
46095 <row>
46096 <entry><option>headers</option></entry>
46097 <entry>Use: <emphasis>autoreply</emphasis></entry>
46098 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46099 <entry>Default: <emphasis>unset</emphasis></entry>
46100 </row>
46101 </tbody>
46102 </tgroup>
46103 </informaltable>
46104 <para>
46105 This specifies additional RFC 2822 headers that are to be added to the message
46106 when the message is specified by the transport. Several can be given by using
46107 <quote>\n</quote> to separate them. There is no check on the format.
46108 </para>
46109 <para>
46110 <indexterm role="option">
46111 <primary><option>log</option></primary>
46112 </indexterm>
46113 </para>
46114 <informaltable frame="all">
46115 <tgroup cols="4" colsep="0" rowsep="0">
46116 <colspec colwidth="8*" align="left"/>
46117 <colspec colwidth="6*" align="center"/>
46118 <colspec colwidth="6*" align="center"/>
46119 <colspec colwidth="6*" align="right"/>
46120 <tbody>
46121 <row>
46122 <entry><option>log</option></entry>
46123 <entry>Use: <emphasis>autoreply</emphasis></entry>
46124 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46125 <entry>Default: <emphasis>unset</emphasis></entry>
46126 </row>
46127 </tbody>
46128 </tgroup>
46129 </informaltable>
46130 <para>
46131 This option names a file in which a record of every message sent is logged when
46132 the message is specified by the transport.
46133 </para>
46134 <para>
46135 <indexterm role="option">
46136 <primary><option>mode</option></primary>
46137 </indexterm>
46138 </para>
46139 <informaltable frame="all">
46140 <tgroup cols="4" colsep="0" rowsep="0">
46141 <colspec colwidth="8*" align="left"/>
46142 <colspec colwidth="6*" align="center"/>
46143 <colspec colwidth="6*" align="center"/>
46144 <colspec colwidth="6*" align="right"/>
46145 <tbody>
46146 <row>
46147 <entry><option>mode</option></entry>
46148 <entry>Use: <emphasis>autoreply</emphasis></entry>
46149 <entry>Type: <emphasis>octal integer</emphasis></entry>
46150 <entry>Default: <emphasis>0600</emphasis></entry>
46151 </row>
46152 </tbody>
46153 </tgroup>
46154 </informaltable>
46155 <para>
46156 If either the log file or the <quote>once</quote> file has to be created, this mode is
46157 used.
46158 </para>
46159 <para>
46160 <indexterm role="option">
46161 <primary><option>never_mail</option></primary>
46162 </indexterm>
46163 </para>
46164 <informaltable frame="all">
46165 <tgroup cols="4" colsep="0" rowsep="0">
46166 <colspec colwidth="8*" align="left"/>
46167 <colspec colwidth="6*" align="center"/>
46168 <colspec colwidth="6*" align="center"/>
46169 <colspec colwidth="6*" align="right"/>
46170 <tbody>
46171 <row>
46172 <entry><option>never_mail</option></entry>
46173 <entry>Use: <emphasis>autoreply</emphasis></entry>
46174 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
46175 <entry>Default: <emphasis>unset</emphasis></entry>
46176 </row>
46177 </tbody>
46178 </tgroup>
46179 </informaltable>
46180 <para>
46181 If any run of the transport creates a message with a recipient that matches any
46182 item in the list, that recipient is quietly discarded. If all recipients are
46183 discarded, no message is created. This applies both when the recipients are
46184 generated by a filter and when they are specified in the transport.
46185 </para>
46186 <para>
46187 <indexterm role="option">
46188 <primary><option>once</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>once</option></entry>
46200 <entry>Use: <emphasis>autoreply</emphasis></entry>
46201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46202 <entry>Default: <emphasis>unset</emphasis></entry>
46203 </row>
46204 </tbody>
46205 </tgroup>
46206 </informaltable>
46207 <para>
46208 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
46209 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
46210 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
46211 </para>
46212 <para>
46213 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
46214 By default, if <option>once</option> is set to a non-empty filename, the message
46215 is not sent if a potential recipient is already listed in the database.
46216 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
46217 message is sent if that much time has elapsed since a message was last sent to
46218 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
46219 prevents a message from being sent a second time &ndash; in this case, zero means
46220 infinity.
46221 </para>
46222 <para>
46223 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
46224 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
46225 greater than zero, it changes the way Exim implements the <option>once</option> option.
46226 Instead of using a DBM file to record every recipient it sends to, it uses a
46227 regular file, whose size will never get larger than the given value.
46228 </para>
46229 <para>
46230 In the file, Exim keeps a linear list of recipient addresses and the times at
46231 which they were sent messages. If the file is full when a new address needs to
46232 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
46233 means that a given recipient may receive multiple messages, but at
46234 unpredictable intervals that depend on the rate of turnover of addresses in the
46235 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
46236 </para>
46237 <para>
46238 <indexterm role="option">
46239 <primary><option>once_file_size</option></primary>
46240 </indexterm>
46241 </para>
46242 <informaltable frame="all">
46243 <tgroup cols="4" colsep="0" rowsep="0">
46244 <colspec colwidth="8*" align="left"/>
46245 <colspec colwidth="6*" align="center"/>
46246 <colspec colwidth="6*" align="center"/>
46247 <colspec colwidth="6*" align="right"/>
46248 <tbody>
46249 <row>
46250 <entry><option>once_file_size</option></entry>
46251 <entry>Use: <emphasis>autoreply</emphasis></entry>
46252 <entry>Type: <emphasis>integer</emphasis></entry>
46253 <entry>Default: <emphasis>0</emphasis></entry>
46254 </row>
46255 </tbody>
46256 </tgroup>
46257 </informaltable>
46258 <para>
46259 See <option>once</option> above.
46260 </para>
46261 <para>
46262 <indexterm role="option">
46263 <primary><option>once_repeat</option></primary>
46264 </indexterm>
46265 </para>
46266 <informaltable frame="all">
46267 <tgroup cols="4" colsep="0" rowsep="0">
46268 <colspec colwidth="8*" align="left"/>
46269 <colspec colwidth="6*" align="center"/>
46270 <colspec colwidth="6*" align="center"/>
46271 <colspec colwidth="6*" align="right"/>
46272 <tbody>
46273 <row>
46274 <entry><option>once_repeat</option></entry>
46275 <entry>Use: <emphasis>autoreply</emphasis></entry>
46276 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
46277 <entry>Default: <emphasis>0s</emphasis></entry>
46278 </row>
46279 </tbody>
46280 </tgroup>
46281 </informaltable>
46282 <para>
46283 See <option>once</option> above.
46284 After expansion, the value of this option must be a valid time value.
46285 </para>
46286 <para>
46287 <indexterm role="option">
46288 <primary><option>reply_to</option></primary>
46289 </indexterm>
46290 </para>
46291 <informaltable frame="all">
46292 <tgroup cols="4" colsep="0" rowsep="0">
46293 <colspec colwidth="8*" align="left"/>
46294 <colspec colwidth="6*" align="center"/>
46295 <colspec colwidth="6*" align="center"/>
46296 <colspec colwidth="6*" align="right"/>
46297 <tbody>
46298 <row>
46299 <entry><option>reply_to</option></entry>
46300 <entry>Use: <emphasis>autoreply</emphasis></entry>
46301 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46302 <entry>Default: <emphasis>unset</emphasis></entry>
46303 </row>
46304 </tbody>
46305 </tgroup>
46306 </informaltable>
46307 <para>
46308 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
46309 specified by the transport.
46310 </para>
46311 <para>
46312 <indexterm role="option">
46313 <primary><option>return_message</option></primary>
46314 </indexterm>
46315 </para>
46316 <informaltable frame="all">
46317 <tgroup cols="4" colsep="0" rowsep="0">
46318 <colspec colwidth="8*" align="left"/>
46319 <colspec colwidth="6*" align="center"/>
46320 <colspec colwidth="6*" align="center"/>
46321 <colspec colwidth="6*" align="right"/>
46322 <tbody>
46323 <row>
46324 <entry><option>return_message</option></entry>
46325 <entry>Use: <emphasis>autoreply</emphasis></entry>
46326 <entry>Type: <emphasis>boolean</emphasis></entry>
46327 <entry>Default: <emphasis>false</emphasis></entry>
46328 </row>
46329 </tbody>
46330 </tgroup>
46331 </informaltable>
46332 <para>
46333 If this is set, a copy of the original message is returned with the new
46334 message, subject to the maximum size set in the <option>return_size_limit</option> global
46335 configuration option.
46336 </para>
46337 <para>
46338 <indexterm role="option">
46339 <primary><option>subject</option></primary>
46340 </indexterm>
46341 </para>
46342 <informaltable frame="all">
46343 <tgroup cols="4" colsep="0" rowsep="0">
46344 <colspec colwidth="8*" align="left"/>
46345 <colspec colwidth="6*" align="center"/>
46346 <colspec colwidth="6*" align="center"/>
46347 <colspec colwidth="6*" align="right"/>
46348 <tbody>
46349 <row>
46350 <entry><option>subject</option></entry>
46351 <entry>Use: <emphasis>autoreply</emphasis></entry>
46352 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46353 <entry>Default: <emphasis>unset</emphasis></entry>
46354 </row>
46355 </tbody>
46356 </tgroup>
46357 </informaltable>
46358 <para>
46359 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
46360 specified by the transport. It is tempting to quote the original subject in
46361 automatic responses. For example:
46362 </para>
46363 <literallayout class="monospaced">
46364 subject = Re: $h_subject:
46365 </literallayout>
46366 <para>
46367 There is a danger in doing this, however. It may allow a third party to
46368 subscribe your users to an opt-in mailing list, provided that the list accepts
46369 bounce messages as subscription confirmations. Well-managed lists require a
46370 non-bounce message to confirm a subscription, so the danger is relatively
46371 small.
46372 </para>
46373 <para>
46374 <indexterm role="option">
46375 <primary><option>text</option></primary>
46376 </indexterm>
46377 </para>
46378 <informaltable frame="all">
46379 <tgroup cols="4" colsep="0" rowsep="0">
46380 <colspec colwidth="8*" align="left"/>
46381 <colspec colwidth="6*" align="center"/>
46382 <colspec colwidth="6*" align="center"/>
46383 <colspec colwidth="6*" align="right"/>
46384 <tbody>
46385 <row>
46386 <entry><option>text</option></entry>
46387 <entry>Use: <emphasis>autoreply</emphasis></entry>
46388 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46389 <entry>Default: <emphasis>unset</emphasis></entry>
46390 </row>
46391 </tbody>
46392 </tgroup>
46393 </informaltable>
46394 <para>
46395 This specifies a single string to be used as the body of the message when the
46396 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
46397 the text comes first.
46398 </para>
46399 <para>
46400 <indexterm role="option">
46401 <primary><option>to</option></primary>
46402 </indexterm>
46403 </para>
46404 <informaltable frame="all">
46405 <tgroup cols="4" colsep="0" rowsep="0">
46406 <colspec colwidth="8*" align="left"/>
46407 <colspec colwidth="6*" align="center"/>
46408 <colspec colwidth="6*" align="center"/>
46409 <colspec colwidth="6*" align="right"/>
46410 <tbody>
46411 <row>
46412 <entry><option>to</option></entry>
46413 <entry>Use: <emphasis>autoreply</emphasis></entry>
46414 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46415 <entry>Default: <emphasis>unset</emphasis></entry>
46416 </row>
46417 </tbody>
46418 </tgroup>
46419 </informaltable>
46420 <para>
46421 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
46422 when the message is specified by the transport.
46423 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
46424 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
46425 </para>
46426 </section>
46427 </chapter>
46428
46429 <chapter id="CHAPLMTP">
46430 <title>The lmtp transport</title>
46431 <para>
46432 <indexterm role="concept">
46433 <primary>transports</primary>
46434 <secondary><command>lmtp</command></secondary>
46435 </indexterm>
46436 <indexterm role="concept">
46437 <primary><command>lmtp</command> transport</primary>
46438 </indexterm>
46439 <indexterm role="concept">
46440 <primary>LMTP</primary>
46441 <secondary>over a pipe</secondary>
46442 </indexterm>
46443 <indexterm role="concept">
46444 <primary>LMTP</primary>
46445 <secondary>over a socket</secondary>
46446 </indexterm>
46447 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
46448 specified command
46449 or by interacting with a Unix domain socket.
46450 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
46451 transports. Exim also has support for using LMTP over TCP/IP; this is
46452 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
46453 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
46454 has it commented out. You need to ensure that
46455 </para>
46456 <literallayout class="monospaced">
46457 TRANSPORT_LMTP=yes
46458 </literallayout>
46459 <para>
46460 <indexterm role="concept">
46461 <primary>options</primary>
46462 <secondary><command>lmtp</command> transport</secondary>
46463 </indexterm>
46464 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
46465 included in the Exim binary. The private options of the <command>lmtp</command> transport are
46466 as follows:
46467 </para>
46468 <para>
46469 <indexterm role="option">
46470 <primary><option>batch_id</option></primary>
46471 </indexterm>
46472 </para>
46473 <informaltable frame="all">
46474 <tgroup cols="4" colsep="0" rowsep="0">
46475 <colspec colwidth="8*" align="left"/>
46476 <colspec colwidth="6*" align="center"/>
46477 <colspec colwidth="6*" align="center"/>
46478 <colspec colwidth="6*" align="right"/>
46479 <tbody>
46480 <row>
46481 <entry><option>batch_id</option></entry>
46482 <entry>Use: <emphasis>lmtp</emphasis></entry>
46483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46484 <entry>Default: <emphasis>unset</emphasis></entry>
46485 </row>
46486 </tbody>
46487 </tgroup>
46488 </informaltable>
46489 <para>
46490 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
46491 </para>
46492 <para>
46493 <indexterm role="option">
46494 <primary><option>batch_max</option></primary>
46495 </indexterm>
46496 </para>
46497 <informaltable frame="all">
46498 <tgroup cols="4" colsep="0" rowsep="0">
46499 <colspec colwidth="8*" align="left"/>
46500 <colspec colwidth="6*" align="center"/>
46501 <colspec colwidth="6*" align="center"/>
46502 <colspec colwidth="6*" align="right"/>
46503 <tbody>
46504 <row>
46505 <entry><option>batch_max</option></entry>
46506 <entry>Use: <emphasis>lmtp</emphasis></entry>
46507 <entry>Type: <emphasis>integer</emphasis></entry>
46508 <entry>Default: <emphasis>1</emphasis></entry>
46509 </row>
46510 </tbody>
46511 </tgroup>
46512 </informaltable>
46513 <para>
46514 This limits the number of addresses that can be handled in a single delivery.
46515 Most LMTP servers can handle several addresses at once, so it is normally a
46516 good idea to increase this value. See the description of local delivery
46517 batching in chapter <xref linkend="CHAPbatching"/>.
46518 </para>
46519 <para>
46520 <indexterm role="option">
46521 <primary><option>command</option></primary>
46522 </indexterm>
46523 </para>
46524 <informaltable frame="all">
46525 <tgroup cols="4" colsep="0" rowsep="0">
46526 <colspec colwidth="8*" align="left"/>
46527 <colspec colwidth="6*" align="center"/>
46528 <colspec colwidth="6*" align="center"/>
46529 <colspec colwidth="6*" align="right"/>
46530 <tbody>
46531 <row>
46532 <entry><option>command</option></entry>
46533 <entry>Use: <emphasis>lmtp</emphasis></entry>
46534 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46535 <entry>Default: <emphasis>unset</emphasis></entry>
46536 </row>
46537 </tbody>
46538 </tgroup>
46539 </informaltable>
46540 <para>
46541 This option must be set if <option>socket</option> is not set. The string is a command which
46542 is run in a separate process. It is split up into a command name and list of
46543 arguments, each of which is separately expanded (so expansion cannot change the
46544 number of arguments). The command is run directly, not via a shell. The message
46545 is passed to the new process using the standard input and output to operate the
46546 LMTP protocol.
46547 </para>
46548 <para>
46549 <indexterm role="option">
46550 <primary><option>ignore_quota</option></primary>
46551 </indexterm>
46552 </para>
46553 <informaltable frame="all">
46554 <tgroup cols="4" colsep="0" rowsep="0">
46555 <colspec colwidth="8*" align="left"/>
46556 <colspec colwidth="6*" align="center"/>
46557 <colspec colwidth="6*" align="center"/>
46558 <colspec colwidth="6*" align="right"/>
46559 <tbody>
46560 <row>
46561 <entry><option>ignore_quota</option></entry>
46562 <entry>Use: <emphasis>lmtp</emphasis></entry>
46563 <entry>Type: <emphasis>boolean</emphasis></entry>
46564 <entry>Default: <emphasis>false</emphasis></entry>
46565 </row>
46566 </tbody>
46567 </tgroup>
46568 </informaltable>
46569 <para>
46570 <indexterm role="concept">
46571 <primary>LMTP</primary>
46572 <secondary>ignoring quota errors</secondary>
46573 </indexterm>
46574 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
46575 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
46576 in its response to the LHLO command.
46577 </para>
46578 <para>
46579 <indexterm role="option">
46580 <primary><option>socket</option></primary>
46581 </indexterm>
46582 </para>
46583 <informaltable frame="all">
46584 <tgroup cols="4" colsep="0" rowsep="0">
46585 <colspec colwidth="8*" align="left"/>
46586 <colspec colwidth="6*" align="center"/>
46587 <colspec colwidth="6*" align="center"/>
46588 <colspec colwidth="6*" align="right"/>
46589 <tbody>
46590 <row>
46591 <entry><option>socket</option></entry>
46592 <entry>Use: <emphasis>lmtp</emphasis></entry>
46593 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46594 <entry>Default: <emphasis>unset</emphasis></entry>
46595 </row>
46596 </tbody>
46597 </tgroup>
46598 </informaltable>
46599 <para>
46600 This option must be set if <option>command</option> is not set. The result of expansion must
46601 be the name of a Unix domain socket. The transport connects to the socket and
46602 delivers the message to it using the LMTP protocol.
46603 </para>
46604 <para>
46605 <indexterm role="option">
46606 <primary><option>timeout</option></primary>
46607 </indexterm>
46608 </para>
46609 <informaltable frame="all">
46610 <tgroup cols="4" colsep="0" rowsep="0">
46611 <colspec colwidth="8*" align="left"/>
46612 <colspec colwidth="6*" align="center"/>
46613 <colspec colwidth="6*" align="center"/>
46614 <colspec colwidth="6*" align="right"/>
46615 <tbody>
46616 <row>
46617 <entry><option>timeout</option></entry>
46618 <entry>Use: <emphasis>lmtp</emphasis></entry>
46619 <entry>Type: <emphasis>time</emphasis></entry>
46620 <entry>Default: <emphasis>5m</emphasis></entry>
46621 </row>
46622 </tbody>
46623 </tgroup>
46624 </informaltable>
46625 <para>
46626 The transport is aborted if the created process or Unix domain socket does not
46627 respond to LMTP commands or message input within this timeout. Delivery
46628 is deferred, and will be tried again later. Here is an example of a typical
46629 LMTP transport:
46630 </para>
46631 <literallayout class="monospaced">
46632 lmtp:
46633   driver = lmtp
46634   command = /some/local/lmtp/delivery/program
46635   batch_max = 20
46636   user = exim
46637 </literallayout>
46638 <para>
46639 This delivers up to 20 addresses at a time, in a mixture of domains if
46640 necessary, running as the user <emphasis>exim</emphasis>.
46641 </para>
46642 </chapter>
46643
46644 <chapter id="CHAPpipetransport">
46645 <title>The pipe transport</title>
46646 <para>
46647 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
46648 <primary>transports</primary>
46649 <secondary><command>pipe</command></secondary>
46650 </indexterm>
46651 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
46652 <primary><command>pipe</command> transport</primary>
46653 </indexterm>
46654 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
46655 running in another process. One example is the use of <command>pipe</command> as a
46656 pseudo-remote transport for passing messages to some other delivery mechanism
46657 (such as UUCP). Another is the use by individual users to automatically process
46658 their incoming messages. The <command>pipe</command> transport can be used in one of the
46659 following ways:
46660 </para>
46661 <itemizedlist>
46662 <listitem>
46663 <para>
46664 <indexterm role="variable">
46665 <primary><varname>$local_part</varname></primary>
46666 </indexterm>
46667 A router routes one address to a transport in the normal way, and the
46668 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
46669 contains the local part of the address (as usual), and the command that is run
46670 is specified by the <option>command</option> option on the transport.
46671 </para>
46672 </listitem>
46673 <listitem>
46674 <para>
46675 <indexterm role="variable">
46676 <primary><varname>$pipe_addresses</varname></primary>
46677 </indexterm>
46678 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
46679 transport can handle more than one address in a single run. In this case, when
46680 more than one address is routed to the transport, <varname>$local_part</varname> is not set
46681 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
46682 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
46683 that are routed to the transport.
46684 </para>
46685 </listitem>
46686 <listitem>
46687 <para>
46688 <indexterm role="variable">
46689 <primary><varname>$address_pipe</varname></primary>
46690 </indexterm>
46691 A router redirects an address directly to a pipe command (for example, from an
46692 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
46693 pipe command, and the <option>command</option> option on the transport is ignored unless
46694 <option>force_command</option> is set. If only one address is being transported
46695 (<option>batch_max</option> is not greater than one, or only one address was redirected to
46696 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
46697 </para>
46698 </listitem>
46699 </itemizedlist>
46700 <para>
46701 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
46702 deliver messages over pipes using the LMTP interactive protocol. This is
46703 implemented by the <command>lmtp</command> transport.
46704 </para>
46705 <para>
46706 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
46707 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
46708 other cases, the uid and gid have to be specified explicitly, either on the
46709 transport or on the router that handles the address. Current and <quote>home</quote>
46710 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
46711 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
46712 for a discussion of local delivery batching.
46713 </para>
46714 <para revisionflag="changed">
46715 <indexterm role="concept">
46716 <primary>tainted data</primary>
46717 <secondary>in pipe command</secondary>
46718 </indexterm>
46719 <indexterm role="concept">
46720 <primary>pipe</primary>
46721 <secondary>tainted data</secondary>
46722 </indexterm>
46723 Tainted data may not be used for the command name.
46724 </para>
46725 <section id="SECID140">
46726 <title>Concurrent delivery</title>
46727 <para>
46728 If two messages arrive at almost the same time, and both are routed to a pipe
46729 delivery, the two pipe transports may be run concurrently. You must ensure that
46730 any pipe commands you set up are robust against this happening. If the commands
46731 write to a file, the <option>exim_lock</option> utility might be of use.
46732 Alternatively the <option>max_parallel</option> option could be used with a value
46733 of "1" to enforce serialization.
46734 </para>
46735 </section>
46736 <section id="SECID141">
46737 <title>Returned status and data</title>
46738 <para>
46739 <indexterm role="concept">
46740 <primary><command>pipe</command> transport</primary>
46741 <secondary>returned data</secondary>
46742 </indexterm>
46743 If the command exits with a non-zero return code, the delivery is deemed to
46744 have failed, unless either the <option>ignore_status</option> option is set (in which case
46745 the return code is treated as zero), or the return code is one of those listed
46746 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
46747 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
46748 logged, but are not included in the bounce message, which merely contains
46749 <quote>local delivery failed</quote>.
46750 </para>
46751 <para>
46752 If the command exits on a signal and the <option>freeze_signal</option> option is set then
46753 the message will be frozen in the queue. If that option is not set, a bounce
46754 will be sent as normal.
46755 </para>
46756 <para>
46757 If the return code is greater than 128 and the command being run is a shell
46758 script, it normally means that the script was terminated by a signal whose
46759 value is the return code minus 128. The <option>freeze_signal</option> option does not
46760 apply in this case.
46761 </para>
46762 <para>
46763 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
46764 return code is set to 127. This is the value that a shell returns if it is
46765 asked to run a non-existent command. The wording for the log line suggests that
46766 a non-existent command may be the problem.
46767 </para>
46768 <para>
46769 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
46770 set and the command produces any output on its standard output or standard
46771 error streams, the command is considered to have failed, even if it gave a zero
46772 return code or if <option>ignore_status</option> is set. The output from the command is
46773 included as part of the bounce message. The <option>return_fail_output</option> option is
46774 similar, except that output is returned only when the command exits with a
46775 failure return code, that is, a value other than zero or a code that matches
46776 <option>temp_errors</option>.
46777 </para>
46778 </section>
46779 <section id="SECThowcommandrun">
46780 <title>How the command is run</title>
46781 <para>
46782 <indexterm role="concept">
46783 <primary><command>pipe</command> transport</primary>
46784 <secondary>path for command</secondary>
46785 </indexterm>
46786 The command line is (by default) broken down into a command name and arguments
46787 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
46788 <option>restrict_to_path</option> options can be used to restrict the commands that may be
46789 run.
46790 </para>
46791 <para>
46792 <indexterm role="concept">
46793 <primary>quoting</primary>
46794 <secondary>in pipe command</secondary>
46795 </indexterm>
46796 Unquoted arguments are delimited by white space. If an argument appears in
46797 double quotes, backslash is interpreted as an escape character in the usual
46798 way. If an argument appears in single quotes, no escaping is done.
46799 </para>
46800 <para>
46801 String expansion is applied to the command line except when it comes from a
46802 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
46803 expansion is applied to each argument in turn rather than to the whole line.
46804 For this reason, any string expansion item that contains white space must be
46805 quoted so as to be contained within a single argument. A setting such as
46806 </para>
46807 <literallayout class="monospaced">
46808 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
46809 </literallayout>
46810 <para>
46811 will not work, because the expansion item gets split between several
46812 arguments. You have to write
46813 </para>
46814 <literallayout class="monospaced">
46815 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
46816 </literallayout>
46817 <para>
46818 to ensure that it is all in one argument. The expansion is done in this way,
46819 argument by argument, so that the number of arguments cannot be changed as a
46820 result of expansion, and quotes or backslashes in inserted variables do not
46821 interact with external quoting. However, this leads to problems if you want to
46822 generate multiple arguments (or the command name plus arguments) from a single
46823 expansion. In this situation, the simplest solution is to use a shell. For
46824 example:
46825 </para>
46826 <literallayout class="monospaced">
46827 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
46828 </literallayout>
46829 <para>
46830 <indexterm role="concept">
46831 <primary>transport</primary>
46832 <secondary>filter</secondary>
46833 </indexterm>
46834 <indexterm role="concept">
46835 <primary>filter</primary>
46836 <secondary>transport filter</secondary>
46837 </indexterm>
46838 <indexterm role="variable">
46839 <primary><varname>$pipe_addresses</varname></primary>
46840 </indexterm>
46841 Special handling takes place when an argument consists of precisely the text
46842 <literal>$pipe_addresses</literal> (no quotes).
46843 This is not a general expansion variable; the only
46844 place this string is recognized is when it appears as an argument for a pipe or
46845 transport filter command. It causes each address that is being handled to be
46846 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
46847 avoids any problems with spaces or shell metacharacters, and is of use when a
46848 <command>pipe</command> transport is handling groups of addresses in a batch.
46849 </para>
46850 <para>
46851 If <option>force_command</option> is enabled on the transport, special handling takes place
46852 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
46853 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
46854 argument is inserted in the argument list at that point
46855 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
46856 the only item in the argument; in fact, if it were then <option>force_command</option>
46857 should behave as a no-op.  Rather, it should be used to adjust the command
46858 run while preserving the argument vector separation.
46859 </para>
46860 <para>
46861 After splitting up into arguments and expansion, the resulting command is run
46862 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
46863 message that is being delivered is supplied on the standard input, and the
46864 standard output and standard error are both connected to a single pipe that is
46865 read by Exim. The <option>max_output</option> option controls how much output the command
46866 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
46867 control what is done with it.
46868 </para>
46869 <para>
46870 Not running the command under a shell (by default) lessens the security risks
46871 in cases when a command from a user&#x2019;s filter file is built out of data that was
46872 taken from an incoming message. If a shell is required, it can of course be
46873 explicitly specified as the command to be run. However, there are circumstances
46874 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
46875 under a shell and cannot easily be modified. To allow for these cases, there is
46876 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
46877 works. Instead of breaking up the command line as just described, it expands it
46878 as a single string and passes the result to <filename>/bin/sh</filename>. The
46879 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
46880 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
46881 </para>
46882 </section>
46883 <section id="SECTpipeenv">
46884 <title>Environment variables</title>
46885 <para>
46886 <indexterm role="concept">
46887 <primary><command>pipe</command> transport</primary>
46888 <secondary>environment for command</secondary>
46889 </indexterm>
46890 <indexterm role="concept">
46891 <primary>environment</primary>
46892 <secondary><command>pipe</command> transport</secondary>
46893 </indexterm>
46894 The environment variables listed below are set up when the command is invoked.
46895 This list is a compromise for maximum compatibility with other MTAs. Note that
46896 the <option>environment</option> option can be used to add additional variables to this
46897 environment. The environment for the <command>pipe</command> transport is not subject
46898 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
46899 </para>
46900 <literallayout>
46901 <literal>DOMAIN            </literal>   the domain of the address
46902 <literal>HOME              </literal>   the home directory, if set
46903 <literal>HOST              </literal>   the host name when called from a router (see below)
46904 <literal>LOCAL_PART        </literal>   see below
46905 <literal>LOCAL_PART_PREFIX </literal>   see below
46906 <literal>LOCAL_PART_SUFFIX </literal>   see below
46907 <literal>LOGNAME           </literal>   see below
46908 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
46909 <literal>PATH              </literal>   as specified by the <option>path</option> option below
46910 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
46911 <literal>RECIPIENT         </literal>   the complete recipient address
46912 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
46913 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
46914 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
46915 <literal>USER              </literal>   see below
46916 </literallayout>
46917 <para>
46918 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
46919 router, LOCAL_PART is set to the local part of the address. When it is
46920 called as a result of a forward or alias expansion, LOCAL_PART is set to
46921 the local part of the address that was expanded. In both cases, any affixes are
46922 removed from the local part, and made available in LOCAL_PART_PREFIX and
46923 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
46924 same value as LOCAL_PART for compatibility with other MTAs.
46925 </para>
46926 <para>
46927 <indexterm role="concept">
46928 <primary>HOST</primary>
46929 </indexterm>
46930 HOST is set only when a <command>pipe</command> transport is called from a router that
46931 associates hosts with an address, typically when using <command>pipe</command> as a
46932 pseudo-remote transport. HOST is set to the first host name specified by
46933 the router.
46934 </para>
46935 <para>
46936 <indexterm role="concept">
46937 <primary>HOME</primary>
46938 </indexterm>
46939 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
46940 for the HOME environment variable. Otherwise, a home directory may be set
46941 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
46942 user&#x2019;s home directory if <option>check_local_user</option> is set.
46943 </para>
46944 </section>
46945 <section id="SECID142">
46946 <title>Private options for pipe</title>
46947 <para>
46948 <indexterm role="concept">
46949 <primary>options</primary>
46950 <secondary><command>pipe</command> transport</secondary>
46951 </indexterm>
46952 </para>
46953 <para>
46954 <indexterm role="option">
46955 <primary><option>allow_commands</option></primary>
46956 </indexterm>
46957 </para>
46958 <informaltable frame="all">
46959 <tgroup cols="4" colsep="0" rowsep="0">
46960 <colspec colwidth="8*" align="left"/>
46961 <colspec colwidth="6*" align="center"/>
46962 <colspec colwidth="6*" align="center"/>
46963 <colspec colwidth="6*" align="right"/>
46964 <tbody>
46965 <row>
46966 <entry><option>allow_commands</option></entry>
46967 <entry>Use: <emphasis>pipe</emphasis></entry>
46968 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46969 <entry>Default: <emphasis>unset</emphasis></entry>
46970 </row>
46971 </tbody>
46972 </tgroup>
46973 </informaltable>
46974 <para>
46975 <indexterm role="concept">
46976 <primary><command>pipe</command> transport</primary>
46977 <secondary>permitted commands</secondary>
46978 </indexterm>
46979 The string is expanded, and is then interpreted as a colon-separated list of
46980 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
46981 permitted are those in the <option>allow_commands</option> list. They need not be absolute
46982 paths; the <option>path</option> option is still used for relative paths. If
46983 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
46984 in the <option>allow_commands</option> list, or a name without any slashes that is found on
46985 the path. In other words, if neither <option>allow_commands</option> nor
46986 <option>restrict_to_path</option> is set, there is no restriction on the command, but
46987 otherwise only commands that are permitted by one or the other are allowed. For
46988 example, if
46989 </para>
46990 <literallayout class="monospaced">
46991 allow_commands = /usr/bin/vacation
46992 </literallayout>
46993 <para>
46994 and <option>restrict_to_path</option> is not set, the only permitted command is
46995 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
46996 <option>use_shell</option> is set.
46997 </para>
46998 <para>
46999 <indexterm role="option">
47000 <primary><option>batch_id</option></primary>
47001 </indexterm>
47002 </para>
47003 <informaltable frame="all">
47004 <tgroup cols="4" colsep="0" rowsep="0">
47005 <colspec colwidth="8*" align="left"/>
47006 <colspec colwidth="6*" align="center"/>
47007 <colspec colwidth="6*" align="center"/>
47008 <colspec colwidth="6*" align="right"/>
47009 <tbody>
47010 <row>
47011 <entry><option>batch_id</option></entry>
47012 <entry>Use: <emphasis>pipe</emphasis></entry>
47013 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47014 <entry>Default: <emphasis>unset</emphasis></entry>
47015 </row>
47016 </tbody>
47017 </tgroup>
47018 </informaltable>
47019 <para>
47020 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47021 </para>
47022 <para>
47023 <indexterm role="option">
47024 <primary><option>batch_max</option></primary>
47025 </indexterm>
47026 </para>
47027 <informaltable frame="all">
47028 <tgroup cols="4" colsep="0" rowsep="0">
47029 <colspec colwidth="8*" align="left"/>
47030 <colspec colwidth="6*" align="center"/>
47031 <colspec colwidth="6*" align="center"/>
47032 <colspec colwidth="6*" align="right"/>
47033 <tbody>
47034 <row>
47035 <entry><option>batch_max</option></entry>
47036 <entry>Use: <emphasis>pipe</emphasis></entry>
47037 <entry>Type: <emphasis>integer</emphasis></entry>
47038 <entry>Default: <emphasis>1</emphasis></entry>
47039 </row>
47040 </tbody>
47041 </tgroup>
47042 </informaltable>
47043 <para>
47044 This limits the number of addresses that can be handled in a single delivery.
47045 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47046 </para>
47047 <para>
47048 <indexterm role="option">
47049 <primary><option>check_string</option></primary>
47050 </indexterm>
47051 </para>
47052 <informaltable frame="all">
47053 <tgroup cols="4" colsep="0" rowsep="0">
47054 <colspec colwidth="8*" align="left"/>
47055 <colspec colwidth="6*" align="center"/>
47056 <colspec colwidth="6*" align="center"/>
47057 <colspec colwidth="6*" align="right"/>
47058 <tbody>
47059 <row>
47060 <entry><option>check_string</option></entry>
47061 <entry>Use: <emphasis>pipe</emphasis></entry>
47062 <entry>Type: <emphasis>string</emphasis></entry>
47063 <entry>Default: <emphasis>unset</emphasis></entry>
47064 </row>
47065 </tbody>
47066 </tgroup>
47067 </informaltable>
47068 <para>
47069 As <command>pipe</command> writes the message, the start of each line is tested for matching
47070 <option>check_string</option>, and if it does, the initial matching characters are replaced
47071 by the contents of <option>escape_string</option>, provided both are set. The value of
47072 <option>check_string</option> is a literal string, not a regular expression, and the case of
47073 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
47074 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
47075 the SMTP escaping protocol. Any settings made in the configuration file are
47076 ignored.
47077 </para>
47078 <para>
47079 <indexterm role="option">
47080 <primary><option>command</option></primary>
47081 </indexterm>
47082 </para>
47083 <informaltable frame="all">
47084 <tgroup cols="4" colsep="0" rowsep="0">
47085 <colspec colwidth="8*" align="left"/>
47086 <colspec colwidth="6*" align="center"/>
47087 <colspec colwidth="6*" align="center"/>
47088 <colspec colwidth="6*" align="right"/>
47089 <tbody>
47090 <row>
47091 <entry><option>command</option></entry>
47092 <entry>Use: <emphasis>pipe</emphasis></entry>
47093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47094 <entry>Default: <emphasis>unset</emphasis></entry>
47095 </row>
47096 </tbody>
47097 </tgroup>
47098 </informaltable>
47099 <para>
47100 This option need not be set when <command>pipe</command> is being used to deliver to pipes
47101 obtained directly from address redirections. In other cases, the option must be
47102 set, to provide a command to be run. It need not yield an absolute path (see
47103 the <option>path</option> option below). The command is split up into separate arguments by
47104 Exim, and each argument is separately expanded, as described in section
47105 <xref linkend="SECThowcommandrun"/> above.
47106 </para>
47107 <para>
47108 <indexterm role="option">
47109 <primary><option>environment</option></primary>
47110 </indexterm>
47111 </para>
47112 <informaltable frame="all">
47113 <tgroup cols="4" colsep="0" rowsep="0">
47114 <colspec colwidth="8*" align="left"/>
47115 <colspec colwidth="6*" align="center"/>
47116 <colspec colwidth="6*" align="center"/>
47117 <colspec colwidth="6*" align="right"/>
47118 <tbody>
47119 <row>
47120 <entry><option>environment</option></entry>
47121 <entry>Use: <emphasis>pipe</emphasis></entry>
47122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47123 <entry>Default: <emphasis>unset</emphasis></entry>
47124 </row>
47125 </tbody>
47126 </tgroup>
47127 </informaltable>
47128 <para>
47129 <indexterm role="concept">
47130 <primary><command>pipe</command> transport</primary>
47131 <secondary>environment for command</secondary>
47132 </indexterm>
47133 <indexterm role="concept">
47134 <primary>environment</primary>
47135 <secondary><command>pipe</command> transport</secondary>
47136 </indexterm>
47137 This option is used to add additional variables to the environment in which the
47138 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
47139 a string which is expanded, and then interpreted as a colon-separated list of
47140 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
47141 </para>
47142 <para>
47143 <indexterm role="option">
47144 <primary><option>escape_string</option></primary>
47145 </indexterm>
47146 </para>
47147 <informaltable frame="all">
47148 <tgroup cols="4" colsep="0" rowsep="0">
47149 <colspec colwidth="8*" align="left"/>
47150 <colspec colwidth="6*" align="center"/>
47151 <colspec colwidth="6*" align="center"/>
47152 <colspec colwidth="6*" align="right"/>
47153 <tbody>
47154 <row>
47155 <entry><option>escape_string</option></entry>
47156 <entry>Use: <emphasis>pipe</emphasis></entry>
47157 <entry>Type: <emphasis>string</emphasis></entry>
47158 <entry>Default: <emphasis>unset</emphasis></entry>
47159 </row>
47160 </tbody>
47161 </tgroup>
47162 </informaltable>
47163 <para>
47164 See <option>check_string</option> above.
47165 </para>
47166 <para>
47167 <indexterm role="option">
47168 <primary><option>freeze_exec_fail</option></primary>
47169 </indexterm>
47170 </para>
47171 <informaltable frame="all">
47172 <tgroup cols="4" colsep="0" rowsep="0">
47173 <colspec colwidth="8*" align="left"/>
47174 <colspec colwidth="6*" align="center"/>
47175 <colspec colwidth="6*" align="center"/>
47176 <colspec colwidth="6*" align="right"/>
47177 <tbody>
47178 <row>
47179 <entry><option>freeze_exec_fail</option></entry>
47180 <entry>Use: <emphasis>pipe</emphasis></entry>
47181 <entry>Type: <emphasis>boolean</emphasis></entry>
47182 <entry>Default: <emphasis>false</emphasis></entry>
47183 </row>
47184 </tbody>
47185 </tgroup>
47186 </informaltable>
47187 <para>
47188 <indexterm role="concept">
47189 <primary>exec failure</primary>
47190 </indexterm>
47191 <indexterm role="concept">
47192 <primary>failure of exec</primary>
47193 </indexterm>
47194 <indexterm role="concept">
47195 <primary><command>pipe</command> transport</primary>
47196 <secondary>failure of exec</secondary>
47197 </indexterm>
47198 Failure to exec the command in a pipe transport is by default treated like
47199 any other failure while running the command. However, if <option>freeze_exec_fail</option>
47200 is set, failure to exec is treated specially, and causes the message to be
47201 frozen, whatever the setting of <option>ignore_status</option>.
47202 </para>
47203 <para>
47204 <indexterm role="option">
47205 <primary><option>freeze_signal</option></primary>
47206 </indexterm>
47207 </para>
47208 <informaltable frame="all">
47209 <tgroup cols="4" colsep="0" rowsep="0">
47210 <colspec colwidth="8*" align="left"/>
47211 <colspec colwidth="6*" align="center"/>
47212 <colspec colwidth="6*" align="center"/>
47213 <colspec colwidth="6*" align="right"/>
47214 <tbody>
47215 <row>
47216 <entry><option>freeze_signal</option></entry>
47217 <entry>Use: <emphasis>pipe</emphasis></entry>
47218 <entry>Type: <emphasis>boolean</emphasis></entry>
47219 <entry>Default: <emphasis>false</emphasis></entry>
47220 </row>
47221 </tbody>
47222 </tgroup>
47223 </informaltable>
47224 <para>
47225 <indexterm role="concept">
47226 <primary>signal exit</primary>
47227 </indexterm>
47228 <indexterm role="concept">
47229 <primary><command>pipe</command> transport</primary>
47230 <secondary>,</secondary>
47231 </indexterm>
47232 Normally if the process run by a command in a pipe transport exits on a signal,
47233 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
47234 frozen in Exim&#x2019;s queue instead.
47235 </para>
47236 <para>
47237 <indexterm role="option">
47238 <primary><option>force_command</option></primary>
47239 </indexterm>
47240 </para>
47241 <informaltable frame="all">
47242 <tgroup cols="4" colsep="0" rowsep="0">
47243 <colspec colwidth="8*" align="left"/>
47244 <colspec colwidth="6*" align="center"/>
47245 <colspec colwidth="6*" align="center"/>
47246 <colspec colwidth="6*" align="right"/>
47247 <tbody>
47248 <row>
47249 <entry><option>force_command</option></entry>
47250 <entry>Use: <emphasis>pipe</emphasis></entry>
47251 <entry>Type: <emphasis>boolean</emphasis></entry>
47252 <entry>Default: <emphasis>false</emphasis></entry>
47253 </row>
47254 </tbody>
47255 </tgroup>
47256 </informaltable>
47257 <para>
47258 <indexterm role="concept">
47259 <primary>force command</primary>
47260 </indexterm>
47261 <indexterm role="concept">
47262 <primary><command>pipe</command> transport</primary>
47263 <secondary>,</secondary>
47264 </indexterm>
47265 Normally when a router redirects an address directly to a pipe command
47266 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
47267 is set, the <option>command</option> option will used. This is especially
47268 useful for forcing a wrapper or additional argument to be added to the
47269 command. For example:
47270 </para>
47271 <literallayout class="monospaced">
47272 command = /usr/bin/remote_exec myhost -- $address_pipe
47273 force_command
47274 </literallayout>
47275 <para>
47276 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
47277 <option>force_command</option> is set, expanding out to the original argument vector as
47278 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
47279 </para>
47280 <para>
47281 <indexterm role="option">
47282 <primary><option>ignore_status</option></primary>
47283 </indexterm>
47284 </para>
47285 <informaltable frame="all">
47286 <tgroup cols="4" colsep="0" rowsep="0">
47287 <colspec colwidth="8*" align="left"/>
47288 <colspec colwidth="6*" align="center"/>
47289 <colspec colwidth="6*" align="center"/>
47290 <colspec colwidth="6*" align="right"/>
47291 <tbody>
47292 <row>
47293 <entry><option>ignore_status</option></entry>
47294 <entry>Use: <emphasis>pipe</emphasis></entry>
47295 <entry>Type: <emphasis>boolean</emphasis></entry>
47296 <entry>Default: <emphasis>false</emphasis></entry>
47297 </row>
47298 </tbody>
47299 </tgroup>
47300 </informaltable>
47301 <para>
47302 If this option is true, the status returned by the subprocess that is set up to
47303 run the command is ignored, and Exim behaves as if zero had been returned.
47304 Otherwise, a non-zero status or termination by signal causes an error return
47305 from the transport unless the status value is one of those listed in
47306 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
47307 </para>
47308 <para>
47309 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
47310 See the <option>timeout_defer</option> option for how timeouts are handled.
47311 </para>
47312 <para>
47313 <indexterm role="option">
47314 <primary><option>log_defer_output</option></primary>
47315 </indexterm>
47316 </para>
47317 <informaltable frame="all">
47318 <tgroup cols="4" colsep="0" rowsep="0">
47319 <colspec colwidth="8*" align="left"/>
47320 <colspec colwidth="6*" align="center"/>
47321 <colspec colwidth="6*" align="center"/>
47322 <colspec colwidth="6*" align="right"/>
47323 <tbody>
47324 <row>
47325 <entry><option>log_defer_output</option></entry>
47326 <entry>Use: <emphasis>pipe</emphasis></entry>
47327 <entry>Type: <emphasis>boolean</emphasis></entry>
47328 <entry>Default: <emphasis>false</emphasis></entry>
47329 </row>
47330 </tbody>
47331 </tgroup>
47332 </informaltable>
47333 <para>
47334 <indexterm role="concept">
47335 <primary><command>pipe</command> transport</primary>
47336 <secondary>logging output</secondary>
47337 </indexterm>
47338 If this option is set, and the status returned by the command is
47339 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
47340 and any output was produced on stdout or stderr, the first line of it is
47341 written to the main log.
47342 </para>
47343 <para>
47344 <indexterm role="option">
47345 <primary><option>log_fail_output</option></primary>
47346 </indexterm>
47347 </para>
47348 <informaltable frame="all">
47349 <tgroup cols="4" colsep="0" rowsep="0">
47350 <colspec colwidth="8*" align="left"/>
47351 <colspec colwidth="6*" align="center"/>
47352 <colspec colwidth="6*" align="center"/>
47353 <colspec colwidth="6*" align="right"/>
47354 <tbody>
47355 <row>
47356 <entry><option>log_fail_output</option></entry>
47357 <entry>Use: <emphasis>pipe</emphasis></entry>
47358 <entry>Type: <emphasis>boolean</emphasis></entry>
47359 <entry>Default: <emphasis>false</emphasis></entry>
47360 </row>
47361 </tbody>
47362 </tgroup>
47363 </informaltable>
47364 <para>
47365 If this option is set, and the command returns any output on stdout or
47366 stderr, and also ends with a return code that is neither zero nor one of
47367 the return codes listed in <option>temp_errors</option> (that is, the delivery
47368 failed), the first line of output is written to the main log. This
47369 option and <option>log_output</option> are mutually exclusive.  Only one of them may
47370 be set.
47371 </para>
47372 <para>
47373 <indexterm role="option">
47374 <primary><option>log_output</option></primary>
47375 </indexterm>
47376 </para>
47377 <informaltable frame="all">
47378 <tgroup cols="4" colsep="0" rowsep="0">
47379 <colspec colwidth="8*" align="left"/>
47380 <colspec colwidth="6*" align="center"/>
47381 <colspec colwidth="6*" align="center"/>
47382 <colspec colwidth="6*" align="right"/>
47383 <tbody>
47384 <row>
47385 <entry><option>log_output</option></entry>
47386 <entry>Use: <emphasis>pipe</emphasis></entry>
47387 <entry>Type: <emphasis>boolean</emphasis></entry>
47388 <entry>Default: <emphasis>false</emphasis></entry>
47389 </row>
47390 </tbody>
47391 </tgroup>
47392 </informaltable>
47393 <para>
47394 If this option is set and the command returns any output on stdout or
47395 stderr, the first line of output is written to the main log, whatever
47396 the return code. This option and <option>log_fail_output</option> are mutually
47397 exclusive. Only one of them may be set.
47398 </para>
47399 <para>
47400 <indexterm role="option">
47401 <primary><option>max_output</option></primary>
47402 </indexterm>
47403 </para>
47404 <informaltable frame="all">
47405 <tgroup cols="4" colsep="0" rowsep="0">
47406 <colspec colwidth="8*" align="left"/>
47407 <colspec colwidth="6*" align="center"/>
47408 <colspec colwidth="6*" align="center"/>
47409 <colspec colwidth="6*" align="right"/>
47410 <tbody>
47411 <row>
47412 <entry><option>max_output</option></entry>
47413 <entry>Use: <emphasis>pipe</emphasis></entry>
47414 <entry>Type: <emphasis>integer</emphasis></entry>
47415 <entry>Default: <emphasis>20K</emphasis></entry>
47416 </row>
47417 </tbody>
47418 </tgroup>
47419 </informaltable>
47420 <para>
47421 This specifies the maximum amount of output that the command may produce on its
47422 standard output and standard error file combined. If the limit is exceeded, the
47423 process running the command is killed. This is intended as a safety measure to
47424 catch runaway processes. The limit is applied independently of the settings of
47425 the options that control what is done with such output (for example,
47426 <option>return_output</option>). Because of buffering effects, the amount of output may
47427 exceed the limit by a small amount before Exim notices.
47428 </para>
47429 <para>
47430 <indexterm role="option">
47431 <primary><option>message_prefix</option></primary>
47432 </indexterm>
47433 </para>
47434 <informaltable frame="all">
47435 <tgroup cols="4" colsep="0" rowsep="0">
47436 <colspec colwidth="8*" align="left"/>
47437 <colspec colwidth="6*" align="center"/>
47438 <colspec colwidth="6*" align="center"/>
47439 <colspec colwidth="6*" align="right"/>
47440 <tbody>
47441 <row>
47442 <entry><option>message_prefix</option></entry>
47443 <entry>Use: <emphasis>pipe</emphasis></entry>
47444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47445 <entry>Default: <emphasis>see below</emphasis></entry>
47446 </row>
47447 </tbody>
47448 </tgroup>
47449 </informaltable>
47450 <para>
47451 The string specified here is expanded and output at the start of every message.
47452 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
47453 </para>
47454 <literallayout class="monospaced">
47455 message_prefix = \
47456   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
47457   ${tod_bsdinbox}\n
47458 </literallayout>
47459 <para>
47460 <indexterm role="concept">
47461 <primary>Cyrus</primary>
47462 </indexterm>
47463 <indexterm role="concept">
47464 <primary><option>tmail</option></primary>
47465 </indexterm>
47466 <indexterm role="concept">
47467 <primary><quote>From</quote> line</primary>
47468 </indexterm>
47469 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
47470 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
47471 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
47472 setting
47473 </para>
47474 <literallayout class="monospaced">
47475 message_prefix =
47476 </literallayout>
47477 <para>
47478 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
47479 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
47480 </para>
47481 <para>
47482 <indexterm role="option">
47483 <primary><option>message_suffix</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_suffix</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 end of every message.
47504 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
47505 The suffix can be suppressed by setting
47506 </para>
47507 <literallayout class="monospaced">
47508 message_suffix =
47509 </literallayout>
47510 <para>
47511 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
47512 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
47513 </para>
47514 <para>
47515 <indexterm role="option">
47516 <primary><option>path</option></primary>
47517 </indexterm>
47518 </para>
47519 <informaltable frame="all">
47520 <tgroup cols="4" colsep="0" rowsep="0">
47521 <colspec colwidth="8*" align="left"/>
47522 <colspec colwidth="6*" align="center"/>
47523 <colspec colwidth="6*" align="center"/>
47524 <colspec colwidth="6*" align="right"/>
47525 <tbody>
47526 <row>
47527 <entry><option>path</option></entry>
47528 <entry>Use: <emphasis>pipe</emphasis></entry>
47529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47530 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
47531 </row>
47532 </tbody>
47533 </tgroup>
47534 </informaltable>
47535 <para>
47536 This option is expanded and
47537 specifies the string that is set up in the PATH environment
47538 variable of the subprocess.
47539 If the <option>command</option> option does not yield an absolute path name, the command is
47540 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
47541 apply to a command specified as a transport filter.
47542 </para>
47543 <para>
47544 <indexterm role="option">
47545 <primary><option>permit_coredump</option></primary>
47546 </indexterm>
47547 </para>
47548 <informaltable frame="all">
47549 <tgroup cols="4" colsep="0" rowsep="0">
47550 <colspec colwidth="8*" align="left"/>
47551 <colspec colwidth="6*" align="center"/>
47552 <colspec colwidth="6*" align="center"/>
47553 <colspec colwidth="6*" align="right"/>
47554 <tbody>
47555 <row>
47556 <entry><option>permit_coredump</option></entry>
47557 <entry>Use: <emphasis>pipe</emphasis></entry>
47558 <entry>Type: <emphasis>boolean</emphasis></entry>
47559 <entry>Default: <emphasis>false</emphasis></entry>
47560 </row>
47561 </tbody>
47562 </tgroup>
47563 </informaltable>
47564 <para>
47565 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
47566 a core-dump of a pipe command, enable this command.  This enables core-dumps
47567 during delivery and affects both the Exim binary and the pipe command run.
47568 It is recommended that this option remain off unless and until you have a need
47569 for it and that this only be enabled when needed, as the risk of excessive
47570 resource consumption can be quite high.  Note also that Exim is typically
47571 installed as a setuid binary and most operating systems will inhibit coredumps
47572 of these by default, so further OS-specific action may be required.
47573 </para>
47574 <para>
47575 <indexterm role="option">
47576 <primary><option>pipe_as_creator</option></primary>
47577 </indexterm>
47578 </para>
47579 <informaltable frame="all">
47580 <tgroup cols="4" colsep="0" rowsep="0">
47581 <colspec colwidth="8*" align="left"/>
47582 <colspec colwidth="6*" align="center"/>
47583 <colspec colwidth="6*" align="center"/>
47584 <colspec colwidth="6*" align="right"/>
47585 <tbody>
47586 <row>
47587 <entry><option>pipe_as_creator</option></entry>
47588 <entry>Use: <emphasis>pipe</emphasis></entry>
47589 <entry>Type: <emphasis>boolean</emphasis></entry>
47590 <entry>Default: <emphasis>false</emphasis></entry>
47591 </row>
47592 </tbody>
47593 </tgroup>
47594 </informaltable>
47595 <para>
47596 <indexterm role="concept">
47597 <primary>uid (user id)</primary>
47598 <secondary>local delivery</secondary>
47599 </indexterm>
47600 If the generic <option>user</option> option is not set and this option is true, the delivery
47601 process is run under the uid that was in force when Exim was originally called
47602 to accept the message. If the group id is not otherwise set (via the generic
47603 <option>group</option> option), the gid that was in force when Exim was originally called to
47604 accept the message is used.
47605 </para>
47606 <para>
47607 <indexterm role="option">
47608 <primary><option>restrict_to_path</option></primary>
47609 </indexterm>
47610 </para>
47611 <informaltable frame="all">
47612 <tgroup cols="4" colsep="0" rowsep="0">
47613 <colspec colwidth="8*" align="left"/>
47614 <colspec colwidth="6*" align="center"/>
47615 <colspec colwidth="6*" align="center"/>
47616 <colspec colwidth="6*" align="right"/>
47617 <tbody>
47618 <row>
47619 <entry><option>restrict_to_path</option></entry>
47620 <entry>Use: <emphasis>pipe</emphasis></entry>
47621 <entry>Type: <emphasis>boolean</emphasis></entry>
47622 <entry>Default: <emphasis>false</emphasis></entry>
47623 </row>
47624 </tbody>
47625 </tgroup>
47626 </informaltable>
47627 <para>
47628 When this option is set, any command name not listed in <option>allow_commands</option> must
47629 contain no slashes. The command is searched for only in the directories listed
47630 in the <option>path</option> option. This option is intended for use in the case when a pipe
47631 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
47632 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
47633 </para>
47634 <para>
47635 <indexterm role="option">
47636 <primary><option>return_fail_output</option></primary>
47637 </indexterm>
47638 </para>
47639 <informaltable frame="all">
47640 <tgroup cols="4" colsep="0" rowsep="0">
47641 <colspec colwidth="8*" align="left"/>
47642 <colspec colwidth="6*" align="center"/>
47643 <colspec colwidth="6*" align="center"/>
47644 <colspec colwidth="6*" align="right"/>
47645 <tbody>
47646 <row>
47647 <entry><option>return_fail_output</option></entry>
47648 <entry>Use: <emphasis>pipe</emphasis></entry>
47649 <entry>Type: <emphasis>boolean</emphasis></entry>
47650 <entry>Default: <emphasis>false</emphasis></entry>
47651 </row>
47652 </tbody>
47653 </tgroup>
47654 </informaltable>
47655 <para>
47656 If this option is true, and the command produced any output and ended with a
47657 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
47658 is, the delivery failed), the output is returned in the bounce message.
47659 However, if the message has a null sender (that is, it is itself a bounce
47660 message), output from the command is discarded. This option and
47661 <option>return_output</option> are mutually exclusive. Only one of them may be set.
47662 </para>
47663 <para>
47664 <indexterm role="option">
47665 <primary><option>return_output</option></primary>
47666 </indexterm>
47667 </para>
47668 <informaltable frame="all">
47669 <tgroup cols="4" colsep="0" rowsep="0">
47670 <colspec colwidth="8*" align="left"/>
47671 <colspec colwidth="6*" align="center"/>
47672 <colspec colwidth="6*" align="center"/>
47673 <colspec colwidth="6*" align="right"/>
47674 <tbody>
47675 <row>
47676 <entry><option>return_output</option></entry>
47677 <entry>Use: <emphasis>pipe</emphasis></entry>
47678 <entry>Type: <emphasis>boolean</emphasis></entry>
47679 <entry>Default: <emphasis>false</emphasis></entry>
47680 </row>
47681 </tbody>
47682 </tgroup>
47683 </informaltable>
47684 <para>
47685 If this option is true, and the command produced any output, the delivery is
47686 deemed to have failed whatever the return code from the command, and the output
47687 is returned in the bounce message. Otherwise, the output is just discarded.
47688 However, if the message has a null sender (that is, it is a bounce message),
47689 output from the command is always discarded, whatever the setting of this
47690 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
47691 of them may be set.
47692 </para>
47693 <para>
47694 <indexterm role="option">
47695 <primary><option>temp_errors</option></primary>
47696 </indexterm>
47697 </para>
47698 <informaltable frame="all">
47699 <tgroup cols="4" colsep="0" rowsep="0">
47700 <colspec colwidth="8*" align="left"/>
47701 <colspec colwidth="6*" align="center"/>
47702 <colspec colwidth="6*" align="center"/>
47703 <colspec colwidth="6*" align="right"/>
47704 <tbody>
47705 <row>
47706 <entry><option>temp_errors</option></entry>
47707 <entry>Use: <emphasis>pipe</emphasis></entry>
47708 <entry>Type: <emphasis>string list</emphasis></entry>
47709 <entry>Default: <emphasis>see below</emphasis></entry>
47710 </row>
47711 </tbody>
47712 </tgroup>
47713 </informaltable>
47714 <para>
47715 <indexterm role="concept">
47716 <primary><command>pipe</command> transport</primary>
47717 <secondary>temporary failure</secondary>
47718 </indexterm>
47719 This option contains either a colon-separated list of numbers, or a single
47720 asterisk. If <option>ignore_status</option> is false
47721 and <option>return_output</option> is not set,
47722 and the command exits with a non-zero return code, the failure is treated as
47723 temporary and the delivery is deferred if the return code matches one of the
47724 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
47725 codes are treated as permanent errors. The default setting contains the codes
47726 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
47727 compiled on a system that does not define these macros, it assumes values of 75
47728 and 73, respectively.
47729 </para>
47730 <para>
47731 <indexterm role="option">
47732 <primary><option>timeout</option></primary>
47733 </indexterm>
47734 </para>
47735 <informaltable frame="all">
47736 <tgroup cols="4" colsep="0" rowsep="0">
47737 <colspec colwidth="8*" align="left"/>
47738 <colspec colwidth="6*" align="center"/>
47739 <colspec colwidth="6*" align="center"/>
47740 <colspec colwidth="6*" align="right"/>
47741 <tbody>
47742 <row>
47743 <entry><option>timeout</option></entry>
47744 <entry>Use: <emphasis>pipe</emphasis></entry>
47745 <entry>Type: <emphasis>time</emphasis></entry>
47746 <entry>Default: <emphasis>1h</emphasis></entry>
47747 </row>
47748 </tbody>
47749 </tgroup>
47750 </informaltable>
47751 <para>
47752 If the command fails to complete within this time, it is killed. This normally
47753 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
47754 specifies no timeout. In order to ensure that any subprocesses created by the
47755 command are also killed, Exim makes the initial process a process group leader,
47756 and kills the whole process group on a timeout. However, this can be defeated
47757 if one of the processes starts a new process group.
47758 </para>
47759 <para>
47760 <indexterm role="option">
47761 <primary><option>timeout_defer</option></primary>
47762 </indexterm>
47763 </para>
47764 <informaltable frame="all">
47765 <tgroup cols="4" colsep="0" rowsep="0">
47766 <colspec colwidth="8*" align="left"/>
47767 <colspec colwidth="6*" align="center"/>
47768 <colspec colwidth="6*" align="center"/>
47769 <colspec colwidth="6*" align="right"/>
47770 <tbody>
47771 <row>
47772 <entry><option>timeout_defer</option></entry>
47773 <entry>Use: <emphasis>pipe</emphasis></entry>
47774 <entry>Type: <emphasis>boolean</emphasis></entry>
47775 <entry>Default: <emphasis>false</emphasis></entry>
47776 </row>
47777 </tbody>
47778 </tgroup>
47779 </informaltable>
47780 <para>
47781 A timeout in a <command>pipe</command> transport, either in the command that the transport
47782 runs, or in a transport filter that is associated with it, is by default
47783 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
47784 is set true, both kinds of timeout become temporary errors, causing the
47785 delivery to be deferred.
47786 </para>
47787 <para>
47788 <indexterm role="option">
47789 <primary><option>umask</option></primary>
47790 </indexterm>
47791 </para>
47792 <informaltable frame="all">
47793 <tgroup cols="4" colsep="0" rowsep="0">
47794 <colspec colwidth="8*" align="left"/>
47795 <colspec colwidth="6*" align="center"/>
47796 <colspec colwidth="6*" align="center"/>
47797 <colspec colwidth="6*" align="right"/>
47798 <tbody>
47799 <row>
47800 <entry><option>umask</option></entry>
47801 <entry>Use: <emphasis>pipe</emphasis></entry>
47802 <entry>Type: <emphasis>octal integer</emphasis></entry>
47803 <entry>Default: <emphasis>022</emphasis></entry>
47804 </row>
47805 </tbody>
47806 </tgroup>
47807 </informaltable>
47808 <para>
47809 This specifies the umask setting for the subprocess that runs the command.
47810 </para>
47811 <para>
47812 <indexterm role="option">
47813 <primary><option>use_bsmtp</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>use_bsmtp</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 <indexterm role="concept">
47834 <primary>envelope sender</primary>
47835 </indexterm>
47836 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
47837 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
47838 commands. If you want to include a leading HELO command with such messages,
47839 you can do so by setting the <option>message_prefix</option> option. See section
47840 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
47841 </para>
47842 <para>
47843 <indexterm role="option">
47844 <primary><option>use_classresources</option></primary>
47845 </indexterm>
47846 </para>
47847 <informaltable frame="all">
47848 <tgroup cols="4" colsep="0" rowsep="0">
47849 <colspec colwidth="8*" align="left"/>
47850 <colspec colwidth="6*" align="center"/>
47851 <colspec colwidth="6*" align="center"/>
47852 <colspec colwidth="6*" align="right"/>
47853 <tbody>
47854 <row>
47855 <entry><option>use_classresources</option></entry>
47856 <entry>Use: <emphasis>pipe</emphasis></entry>
47857 <entry>Type: <emphasis>boolean</emphasis></entry>
47858 <entry>Default: <emphasis>false</emphasis></entry>
47859 </row>
47860 </tbody>
47861 </tgroup>
47862 </informaltable>
47863 <para>
47864 <indexterm role="concept">
47865 <primary>class resources (BSD)</primary>
47866 </indexterm>
47867 This option is available only when Exim is running on FreeBSD, NetBSD, or
47868 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
47869 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
47870 limits for the uid under which the pipe is to run are obtained from the login
47871 class database.
47872 </para>
47873 <para>
47874 <indexterm role="option">
47875 <primary><option>use_crlf</option></primary>
47876 </indexterm>
47877 </para>
47878 <informaltable frame="all">
47879 <tgroup cols="4" colsep="0" rowsep="0">
47880 <colspec colwidth="8*" align="left"/>
47881 <colspec colwidth="6*" align="center"/>
47882 <colspec colwidth="6*" align="center"/>
47883 <colspec colwidth="6*" align="right"/>
47884 <tbody>
47885 <row>
47886 <entry><option>use_crlf</option></entry>
47887 <entry>Use: <emphasis>pipe</emphasis></entry>
47888 <entry>Type: <emphasis>boolean</emphasis></entry>
47889 <entry>Default: <emphasis>false</emphasis></entry>
47890 </row>
47891 </tbody>
47892 </tgroup>
47893 </informaltable>
47894 <para>
47895 <indexterm role="concept">
47896 <primary>carriage return</primary>
47897 </indexterm>
47898 <indexterm role="concept">
47899 <primary>linefeed</primary>
47900 </indexterm>
47901 This option causes lines to be terminated with the two-character CRLF sequence
47902 (carriage return, linefeed) instead of just a linefeed character. In the case
47903 of batched SMTP, the byte sequence written to the pipe is then an exact image
47904 of what would be sent down a real SMTP connection.
47905 </para>
47906 <para>
47907 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
47908 written verbatim, so must contain their own carriage return characters if these
47909 are needed. When <option>use_bsmtp</option> is not set, the default values for both
47910 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
47911 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
47912 </para>
47913 <para>
47914 <indexterm role="option">
47915 <primary><option>use_shell</option></primary>
47916 </indexterm>
47917 </para>
47918 <informaltable frame="all">
47919 <tgroup cols="4" colsep="0" rowsep="0">
47920 <colspec colwidth="8*" align="left"/>
47921 <colspec colwidth="6*" align="center"/>
47922 <colspec colwidth="6*" align="center"/>
47923 <colspec colwidth="6*" align="right"/>
47924 <tbody>
47925 <row>
47926 <entry><option>use_shell</option></entry>
47927 <entry>Use: <emphasis>pipe</emphasis></entry>
47928 <entry>Type: <emphasis>boolean</emphasis></entry>
47929 <entry>Default: <emphasis>false</emphasis></entry>
47930 </row>
47931 </tbody>
47932 </tgroup>
47933 </informaltable>
47934 <para>
47935 <indexterm role="variable">
47936 <primary><varname>$pipe_addresses</varname></primary>
47937 </indexterm>
47938 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
47939 instead of being run directly from the transport, as described in section
47940 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
47941 where the command is expected to be run under a shell and cannot easily be
47942 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
47943 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
47944 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
47945 its <option>-c</option> option.
47946 </para>
47947 </section>
47948 <section id="SECID143">
47949 <title>Using an external local delivery agent</title>
47950 <para>
47951 <indexterm role="concept">
47952 <primary>local delivery</primary>
47953 <secondary>using an external agent</secondary>
47954 </indexterm>
47955 <indexterm role="concept">
47956 <primary><emphasis>procmail</emphasis></primary>
47957 </indexterm>
47958 <indexterm role="concept">
47959 <primary>external local delivery</primary>
47960 </indexterm>
47961 <indexterm role="concept">
47962 <primary>delivery</primary>
47963 <secondary><emphasis>procmail</emphasis></secondary>
47964 </indexterm>
47965 <indexterm role="concept">
47966 <primary>delivery</primary>
47967 <secondary>by external agent</secondary>
47968 </indexterm>
47969 The <command>pipe</command> transport can be used to pass all messages that require local
47970 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
47971 this, care must be taken to ensure that the pipe is run under an appropriate
47972 uid and gid. In some configurations one wants this to be a uid that is trusted
47973 by the delivery agent to supply the correct sender of the message. It may be
47974 necessary to recompile or reconfigure the delivery agent so that it trusts an
47975 appropriate user. The following is an example transport and router
47976 configuration for <option>procmail</option>:
47977 </para>
47978 <literallayout class="monospaced">
47979 # transport
47980 procmail_pipe:
47981   driver = pipe
47982   command = /usr/local/bin/procmail -d $local_part_data
47983   return_path_add
47984   delivery_date_add
47985   envelope_to_add
47986   check_string = "From "
47987   escape_string = "&gt;From "
47988   umask = 077
47989   user = $local_part_data
47990   group = mail
47991
47992 # router
47993 procmail:
47994   driver = accept
47995   check_local_user
47996   transport = procmail_pipe
47997 </literallayout>
47998 <para>
47999 In this example, the pipe is run as the local user, but with the group set to
48000 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
48001 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
48002 user to supply a correct sender address. If you do not specify either a
48003 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
48004 home directory is the user&#x2019;s home directory by default.
48005 </para>
48006 <para>
48007 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
48008 </para>
48009 <literallayout class="monospaced">
48010 IFS=" "
48011 </literallayout>
48012 <para>
48013 as shown in some <option>procmail</option> documentation, because Exim does not by default
48014 use a shell to run pipe commands.
48015 </para>
48016 <para>
48017 <indexterm role="concept">
48018 <primary>Cyrus</primary>
48019 </indexterm>
48020 The next example shows a transport and a router for a system where local
48021 deliveries are handled by the Cyrus IMAP server.
48022 </para>
48023 <literallayout class="monospaced">
48024 # transport
48025 local_delivery_cyrus:
48026   driver = pipe
48027   command = /usr/cyrus/bin/deliver \
48028             -m ${substr_1:$local_part_suffix} -- $local_part
48029   user = cyrus
48030   group = mail
48031   return_output
48032   log_output
48033   message_prefix =
48034   message_suffix =
48035
48036 # router
48037 local_user_cyrus:
48038   driver = accept
48039   check_local_user
48040   local_part_suffix = .*
48041   transport = local_delivery_cyrus
48042 </literallayout>
48043 <para>
48044 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
48045 <option>return_output</option> to cause any text written by Cyrus to be returned to the
48046 sender.
48047 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
48048 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
48049 </para>
48050 </section>
48051 </chapter>
48052
48053 <chapter id="CHAPsmtptrans">
48054 <title>The smtp transport</title>
48055 <para>
48056 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
48057 <primary>transports</primary>
48058 <secondary><command>smtp</command></secondary>
48059 </indexterm>
48060 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
48061 <primary><command>smtp</command> transport</primary>
48062 </indexterm>
48063 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
48064 or LMTP protocol. The list of hosts to try can either be taken from the address
48065 that is being processed (having been set up by the router), or specified
48066 explicitly for the transport. Timeout and retry processing (see chapter
48067 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
48068 </para>
48069 <section id="SECID144">
48070 <title>Multiple messages on a single connection</title>
48071 <para>
48072 The sending of multiple messages over a single TCP/IP connection can arise in
48073 two ways:
48074 </para>
48075 <itemizedlist>
48076 <listitem>
48077 <para>
48078 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
48079 routed to the same host, more than one copy of the message has to be sent to
48080 that host. In this situation, multiple copies may be sent in a single run of
48081 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
48082 does when it has too many addresses to send in one message also depends on the
48083 value of the global <option>remote_max_parallel</option> option. Details are given in
48084 section <xref linkend="SECToutSMTPTCP"/>.)
48085 </para>
48086 </listitem>
48087 <listitem>
48088 <para>
48089 <indexterm role="concept">
48090 <primary>hints database</primary>
48091 <secondary>remembering routing</secondary>
48092 </indexterm>
48093 When a message has been successfully delivered over a TCP/IP connection, Exim
48094 looks in its hints database to see if there are any other messages awaiting a
48095 connection to the same host. If there are, a new delivery process is started
48096 for one of them, and the current TCP/IP connection is passed on to it. The new
48097 process may in turn send multiple copies and possibly create yet another
48098 process.
48099 </para>
48100 </listitem>
48101 </itemizedlist>
48102 <para>
48103 For each copy sent over the same TCP/IP connection, a sequence counter is
48104 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
48105 no further messages are sent over that connection.
48106 </para>
48107 </section>
48108 <section id="SECID145">
48109 <title>Use of the $host and $host_address variables</title>
48110 <para>
48111 <indexterm role="variable">
48112 <primary><varname>$host</varname></primary>
48113 </indexterm>
48114 <indexterm role="variable">
48115 <primary><varname>$host_address</varname></primary>
48116 </indexterm>
48117 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
48118 <varname>$host_address</varname> are the name and IP address of the first host on the host list
48119 passed by the router. However, when the transport is about to connect to a
48120 specific host, and while it is connected to that host, <varname>$host</varname> and
48121 <varname>$host_address</varname> are set to the values for that host. These are the values
48122 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
48123 <option>serialize_hosts</option>, and the various TLS options are expanded.
48124 </para>
48125 </section>
48126 <section id="usecippeer">
48127 <title>Use of $tls_cipher and $tls_peerdn</title>
48128 <para>
48129 <indexterm role="variable">
48130 <primary><varname>$tls_bits</varname></primary>
48131 </indexterm>
48132 <indexterm role="variable">
48133 <primary><varname>$tls_cipher</varname></primary>
48134 </indexterm>
48135 <indexterm role="variable">
48136 <primary><varname>$tls_peerdn</varname></primary>
48137 </indexterm>
48138 <indexterm role="variable">
48139 <primary><varname>$tls_sni</varname></primary>
48140 </indexterm>
48141 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
48142 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
48143 are the values that were set when the message was received.
48144 These are the values that are used for options that are expanded before any
48145 SMTP connections are made. Just before each connection is made, these four
48146 variables are emptied. If TLS is subsequently started, they are set to the
48147 appropriate values for the outgoing connection, and these are the values that
48148 are in force when any authenticators are run and when the
48149 <option>authenticated_sender</option> option is expanded.
48150 </para>
48151 <para>
48152 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
48153 and will be removed in a future release.
48154 </para>
48155 </section>
48156 <section id="SECID146">
48157 <title>Private options for smtp</title>
48158 <para>
48159 <indexterm role="concept">
48160 <primary>options</primary>
48161 <secondary><command>smtp</command> transport</secondary>
48162 </indexterm>
48163 The private options of the <command>smtp</command> transport are as follows:
48164 </para>
48165 <para>
48166 <indexterm role="option">
48167 <primary><option>address_retry_include_sender</option></primary>
48168 </indexterm>
48169 </para>
48170 <informaltable frame="all">
48171 <tgroup cols="4" colsep="0" rowsep="0">
48172 <colspec colwidth="8*" align="left"/>
48173 <colspec colwidth="6*" align="center"/>
48174 <colspec colwidth="6*" align="center"/>
48175 <colspec colwidth="6*" align="right"/>
48176 <tbody>
48177 <row>
48178 <entry><option>address_retry_include_sender</option></entry>
48179 <entry>Use: <emphasis>smtp</emphasis></entry>
48180 <entry>Type: <emphasis>boolean</emphasis></entry>
48181 <entry>Default: <emphasis>true</emphasis></entry>
48182 </row>
48183 </tbody>
48184 </tgroup>
48185 </informaltable>
48186 <para>
48187 <indexterm role="concept">
48188 <primary>4<emphasis>xx</emphasis> responses</primary>
48189 <secondary>retrying after</secondary>
48190 </indexterm>
48191 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
48192 is the combination of sender and recipient that is delayed in subsequent queue
48193 runs until the retry time is reached. You can delay the recipient without
48194 reference to the sender (which is what earlier versions of Exim did), by
48195 setting <option>address_retry_include_sender</option> false. However, this can lead to
48196 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
48197 </para>
48198 <para>
48199 <indexterm role="option">
48200 <primary><option>allow_localhost</option></primary>
48201 </indexterm>
48202 </para>
48203 <informaltable frame="all">
48204 <tgroup cols="4" colsep="0" rowsep="0">
48205 <colspec colwidth="8*" align="left"/>
48206 <colspec colwidth="6*" align="center"/>
48207 <colspec colwidth="6*" align="center"/>
48208 <colspec colwidth="6*" align="right"/>
48209 <tbody>
48210 <row>
48211 <entry><option>allow_localhost</option></entry>
48212 <entry>Use: <emphasis>smtp</emphasis></entry>
48213 <entry>Type: <emphasis>boolean</emphasis></entry>
48214 <entry>Default: <emphasis>false</emphasis></entry>
48215 </row>
48216 </tbody>
48217 </tgroup>
48218 </informaltable>
48219 <para>
48220 <indexterm role="concept">
48221 <primary>local host</primary>
48222 <secondary>sending to</secondary>
48223 </indexterm>
48224 <indexterm role="concept">
48225 <primary>fallback</primary>
48226 <secondary>hosts specified on transport</secondary>
48227 </indexterm>
48228 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
48229 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
48230 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
48231 the delivery anyway. This should be used only in special cases when the
48232 configuration ensures that no looping will result (for example, a differently
48233 configured Exim is listening on the port to which the message is sent).
48234 </para>
48235 <para>
48236 <indexterm role="option">
48237 <primary><option>authenticated_sender</option></primary>
48238 </indexterm>
48239 </para>
48240 <informaltable frame="all">
48241 <tgroup cols="4" colsep="0" rowsep="0">
48242 <colspec colwidth="8*" align="left"/>
48243 <colspec colwidth="6*" align="center"/>
48244 <colspec colwidth="6*" align="center"/>
48245 <colspec colwidth="6*" align="right"/>
48246 <tbody>
48247 <row>
48248 <entry><option>authenticated_sender</option></entry>
48249 <entry>Use: <emphasis>smtp</emphasis></entry>
48250 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48251 <entry>Default: <emphasis>unset</emphasis></entry>
48252 </row>
48253 </tbody>
48254 </tgroup>
48255 </informaltable>
48256 <para>
48257 <indexterm role="concept">
48258 <primary>Cyrus</primary>
48259 </indexterm>
48260 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
48261 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
48262 overriding any existing authenticated sender value. If the string expansion is
48263 forced to fail, the option is ignored. Other expansion failures cause delivery
48264 to be deferred. If the result of expansion is an empty string, that is also
48265 ignored.
48266 </para>
48267 <para>
48268 The expansion happens after the outgoing connection has been made and TLS
48269 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
48270 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
48271 particular connection.
48272 </para>
48273 <para>
48274 If the SMTP session is not authenticated, the expansion of
48275 <option>authenticated_sender</option> still happens (and can cause the delivery to be
48276 deferred if it fails), but no AUTH= item is added to MAIL commands
48277 unless <option>authenticated_sender_force</option> is true.
48278 </para>
48279 <para>
48280 This option allows you to use the <command>smtp</command> transport in LMTP mode to
48281 deliver mail to Cyrus IMAP and provide the proper local part as the
48282 <quote>authenticated sender</quote>, via a setting such as:
48283 </para>
48284 <literallayout class="monospaced">
48285 authenticated_sender = $local_part
48286 </literallayout>
48287 <para>
48288 This removes the need for IMAP subfolders to be assigned special ACLs to
48289 allow direct delivery to those subfolders.
48290 </para>
48291 <para>
48292 Because of expected uses such as that just described for Cyrus (when no
48293 domain is involved), there is no checking on the syntax of the provided
48294 value.
48295 </para>
48296 <para>
48297 <indexterm role="option">
48298 <primary><option>authenticated_sender_force</option></primary>
48299 </indexterm>
48300 </para>
48301 <informaltable frame="all">
48302 <tgroup cols="4" colsep="0" rowsep="0">
48303 <colspec colwidth="8*" align="left"/>
48304 <colspec colwidth="6*" align="center"/>
48305 <colspec colwidth="6*" align="center"/>
48306 <colspec colwidth="6*" align="right"/>
48307 <tbody>
48308 <row>
48309 <entry><option>authenticated_sender_force</option></entry>
48310 <entry>Use: <emphasis>smtp</emphasis></entry>
48311 <entry>Type: <emphasis>boolean</emphasis></entry>
48312 <entry>Default: <emphasis>false</emphasis></entry>
48313 </row>
48314 </tbody>
48315 </tgroup>
48316 </informaltable>
48317 <para>
48318 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
48319 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
48320 authenticated as a client.
48321 </para>
48322 <para>
48323 <indexterm role="option">
48324 <primary><option>command_timeout</option></primary>
48325 </indexterm>
48326 </para>
48327 <informaltable frame="all">
48328 <tgroup cols="4" colsep="0" rowsep="0">
48329 <colspec colwidth="8*" align="left"/>
48330 <colspec colwidth="6*" align="center"/>
48331 <colspec colwidth="6*" align="center"/>
48332 <colspec colwidth="6*" align="right"/>
48333 <tbody>
48334 <row>
48335 <entry><option>command_timeout</option></entry>
48336 <entry>Use: <emphasis>smtp</emphasis></entry>
48337 <entry>Type: <emphasis>time</emphasis></entry>
48338 <entry>Default: <emphasis>5m</emphasis></entry>
48339 </row>
48340 </tbody>
48341 </tgroup>
48342 </informaltable>
48343 <para>
48344 This sets a timeout for receiving a response to an SMTP command that has been
48345 sent out. It is also used when waiting for the initial banner line from the
48346 remote host. Its value must not be zero.
48347 </para>
48348 <para>
48349 <indexterm role="option">
48350 <primary><option>connect_timeout</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>connect_timeout</option></entry>
48362 <entry>Use: <emphasis>smtp</emphasis></entry>
48363 <entry>Type: <emphasis>time</emphasis></entry>
48364 <entry>Default: <emphasis>5m</emphasis></entry>
48365 </row>
48366 </tbody>
48367 </tgroup>
48368 </informaltable>
48369 <para>
48370 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
48371 to a remote host. A setting of zero allows the system timeout (typically
48372 several minutes) to act. To have any effect, the value of this option must be
48373 less than the system timeout. However, it has been observed that on some
48374 systems there is no system timeout, which is why the default value for this
48375 option is 5 minutes, a value recommended by RFC 1123.
48376 </para>
48377 <para>
48378 <indexterm role="option">
48379 <primary><option>connection_max_messages</option></primary>
48380 </indexterm>
48381 </para>
48382 <informaltable frame="all">
48383 <tgroup cols="4" colsep="0" rowsep="0">
48384 <colspec colwidth="8*" align="left"/>
48385 <colspec colwidth="6*" align="center"/>
48386 <colspec colwidth="6*" align="center"/>
48387 <colspec colwidth="6*" align="right"/>
48388 <tbody>
48389 <row>
48390 <entry><option>connection_max_messages</option></entry>
48391 <entry>Use: <emphasis>smtp</emphasis></entry>
48392 <entry>Type: <emphasis>integer</emphasis></entry>
48393 <entry>Default: <emphasis>500</emphasis></entry>
48394 </row>
48395 </tbody>
48396 </tgroup>
48397 </informaltable>
48398 <para>
48399 <indexterm role="concept">
48400 <primary>SMTP</primary>
48401 <secondary>passed connection</secondary>
48402 </indexterm>
48403 <indexterm role="concept">
48404 <primary>SMTP</primary>
48405 <secondary>multiple deliveries</secondary>
48406 </indexterm>
48407 <indexterm role="concept">
48408 <primary>multiple SMTP deliveries</primary>
48409 </indexterm>
48410 This controls the maximum number of separate message deliveries that are sent
48411 over a single TCP/IP connection. If the value is zero, there is no limit.
48412 For testing purposes, this value can be overridden by the <option>-oB</option> command line
48413 option.
48414 </para>
48415 <para>
48416 <indexterm role="option">
48417 <primary><option>dane_require_tls_ciphers</option></primary>
48418 </indexterm>
48419 </para>
48420 <informaltable frame="all">
48421 <tgroup cols="4" colsep="0" rowsep="0">
48422 <colspec colwidth="8*" align="left"/>
48423 <colspec colwidth="6*" align="center"/>
48424 <colspec colwidth="6*" align="center"/>
48425 <colspec colwidth="6*" align="right"/>
48426 <tbody>
48427 <row>
48428 <entry><option>dane_require_tls_ciphers</option></entry>
48429 <entry>Use: <emphasis>smtp</emphasis></entry>
48430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48431 <entry>Default: <emphasis>unset</emphasis></entry>
48432 </row>
48433 </tbody>
48434 </tgroup>
48435 </informaltable>
48436 <para>
48437 <indexterm role="concept">
48438 <primary>TLS</primary>
48439 <secondary>requiring specific ciphers for DANE</secondary>
48440 </indexterm>
48441 <indexterm role="concept">
48442 <primary>cipher</primary>
48443 <secondary>requiring specific</secondary>
48444 </indexterm>
48445 <indexterm role="concept">
48446 <primary>DANE</primary>
48447 <secondary>TLS ciphers</secondary>
48448 </indexterm>
48449 This option may be used to override <option>tls_require_ciphers</option> for connections
48450 where DANE has been determined to be in effect.
48451 If not set, then <option>tls_require_ciphers</option> will be used.
48452 Normal SMTP delivery is not able to make strong demands of TLS cipher
48453 configuration, because delivery will fall back to plaintext.  Once DANE has
48454 been determined to be in effect, there is no plaintext fallback and making the
48455 TLS cipherlist configuration stronger will increase security, rather than
48456 counter-intuitively decreasing it.
48457 If the option expands to be empty or is forced to fail, then it will
48458 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
48459 </para>
48460 <para>
48461 <indexterm role="option">
48462 <primary><option>data_timeout</option></primary>
48463 </indexterm>
48464 </para>
48465 <informaltable frame="all">
48466 <tgroup cols="4" colsep="0" rowsep="0">
48467 <colspec colwidth="8*" align="left"/>
48468 <colspec colwidth="6*" align="center"/>
48469 <colspec colwidth="6*" align="center"/>
48470 <colspec colwidth="6*" align="right"/>
48471 <tbody>
48472 <row>
48473 <entry><option>data_timeout</option></entry>
48474 <entry>Use: <emphasis>smtp</emphasis></entry>
48475 <entry>Type: <emphasis>time</emphasis></entry>
48476 <entry>Default: <emphasis>5m</emphasis></entry>
48477 </row>
48478 </tbody>
48479 </tgroup>
48480 </informaltable>
48481 <para>
48482 This sets a timeout for the transmission of each block in the data portion of
48483 the message. As a result, the overall timeout for a message depends on the size
48484 of the message. Its value must not be zero. See also <option>final_timeout</option>.
48485 </para>
48486 <para>
48487 <indexterm role="option">
48488 <primary><option>dkim_canon</option></primary>
48489 </indexterm>
48490 </para>
48491 <informaltable frame="all">
48492 <tgroup cols="4" colsep="0" rowsep="0">
48493 <colspec colwidth="8*" align="left"/>
48494 <colspec colwidth="6*" align="center"/>
48495 <colspec colwidth="6*" align="center"/>
48496 <colspec colwidth="6*" align="right"/>
48497 <tbody>
48498 <row>
48499 <entry><option>dkim_canon</option></entry>
48500 <entry>Use: <emphasis>smtp</emphasis></entry>
48501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48502 <entry>Default: <emphasis>unset</emphasis></entry>
48503 </row>
48504 </tbody>
48505 </tgroup>
48506 </informaltable>
48507 <para>
48508 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48509 <indexterm role="option">
48510 <primary><option>unset</option></primary>
48511 </indexterm>
48512 </para>
48513 <informaltable frame="all">
48514 <tgroup cols="4" colsep="0" rowsep="0">
48515 <colspec colwidth="8*" align="left"/>
48516 <colspec colwidth="6*" align="center"/>
48517 <colspec colwidth="6*" align="center"/>
48518 <colspec colwidth="6*" align="right"/>
48519 <tbody>
48520 <row>
48521 <entry><option>dkim_domain</option></entry>
48522 <entry>Use: <emphasis>smtp</emphasis></entry>
48523 <entry>Type: <emphasis>string</emphasis></entry>
48524 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
48525 </row>
48526 </tbody>
48527 </tgroup>
48528 </informaltable>
48529 <para>
48530 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48531 <indexterm role="option">
48532 <primary><option>dkim_hash</option></primary>
48533 </indexterm>
48534 </para>
48535 <informaltable frame="all">
48536 <tgroup cols="4" colsep="0" rowsep="0">
48537 <colspec colwidth="8*" align="left"/>
48538 <colspec colwidth="6*" align="center"/>
48539 <colspec colwidth="6*" align="center"/>
48540 <colspec colwidth="6*" align="right"/>
48541 <tbody>
48542 <row>
48543 <entry><option>dkim_hash</option></entry>
48544 <entry>Use: <emphasis>smtp</emphasis></entry>
48545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48546 <entry>Default: <emphasis>sha256</emphasis></entry>
48547 </row>
48548 </tbody>
48549 </tgroup>
48550 </informaltable>
48551 <para>
48552 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48553 <indexterm role="option">
48554 <primary><option>dkim_identity</option></primary>
48555 </indexterm>
48556 </para>
48557 <informaltable frame="all">
48558 <tgroup cols="4" colsep="0" rowsep="0">
48559 <colspec colwidth="8*" align="left"/>
48560 <colspec colwidth="6*" align="center"/>
48561 <colspec colwidth="6*" align="center"/>
48562 <colspec colwidth="6*" align="right"/>
48563 <tbody>
48564 <row>
48565 <entry><option>dkim_identity</option></entry>
48566 <entry>Use: <emphasis>smtp</emphasis></entry>
48567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48568 <entry>Default: <emphasis>unset</emphasis></entry>
48569 </row>
48570 </tbody>
48571 </tgroup>
48572 </informaltable>
48573 <para>
48574 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48575 <indexterm role="option">
48576 <primary><option>dkim_private_key</option></primary>
48577 </indexterm>
48578 </para>
48579 <informaltable frame="all">
48580 <tgroup cols="4" colsep="0" rowsep="0">
48581 <colspec colwidth="8*" align="left"/>
48582 <colspec colwidth="6*" align="center"/>
48583 <colspec colwidth="6*" align="center"/>
48584 <colspec colwidth="6*" align="right"/>
48585 <tbody>
48586 <row>
48587 <entry><option>dkim_private_key</option></entry>
48588 <entry>Use: <emphasis>smtp</emphasis></entry>
48589 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48590 <entry>Default: <emphasis>unset</emphasis></entry>
48591 </row>
48592 </tbody>
48593 </tgroup>
48594 </informaltable>
48595 <para>
48596 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48597 <indexterm role="option">
48598 <primary><option>dkim_selector</option></primary>
48599 </indexterm>
48600 </para>
48601 <informaltable frame="all">
48602 <tgroup cols="4" colsep="0" rowsep="0">
48603 <colspec colwidth="8*" align="left"/>
48604 <colspec colwidth="6*" align="center"/>
48605 <colspec colwidth="6*" align="center"/>
48606 <colspec colwidth="6*" align="right"/>
48607 <tbody>
48608 <row>
48609 <entry><option>dkim_selector</option></entry>
48610 <entry>Use: <emphasis>smtp</emphasis></entry>
48611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48612 <entry>Default: <emphasis>unset</emphasis></entry>
48613 </row>
48614 </tbody>
48615 </tgroup>
48616 </informaltable>
48617 <para>
48618 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48619 <indexterm role="option">
48620 <primary><option>dkim_strict</option></primary>
48621 </indexterm>
48622 </para>
48623 <informaltable frame="all">
48624 <tgroup cols="4" colsep="0" rowsep="0">
48625 <colspec colwidth="8*" align="left"/>
48626 <colspec colwidth="6*" align="center"/>
48627 <colspec colwidth="6*" align="center"/>
48628 <colspec colwidth="6*" align="right"/>
48629 <tbody>
48630 <row>
48631 <entry><option>dkim_strict</option></entry>
48632 <entry>Use: <emphasis>smtp</emphasis></entry>
48633 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48634 <entry>Default: <emphasis>unset</emphasis></entry>
48635 </row>
48636 </tbody>
48637 </tgroup>
48638 </informaltable>
48639 <para>
48640 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48641 <indexterm role="option">
48642 <primary><option>dkim_sign_headers</option></primary>
48643 </indexterm>
48644 </para>
48645 <informaltable frame="all">
48646 <tgroup cols="4" colsep="0" rowsep="0">
48647 <colspec colwidth="8*" align="left"/>
48648 <colspec colwidth="6*" align="center"/>
48649 <colspec colwidth="6*" align="center"/>
48650 <colspec colwidth="6*" align="right"/>
48651 <tbody>
48652 <row>
48653 <entry><option>dkim_sign_headers</option></entry>
48654 <entry>Use: <emphasis>smtp</emphasis></entry>
48655 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48656 <entry>Default: <emphasis>per RFC</emphasis></entry>
48657 </row>
48658 </tbody>
48659 </tgroup>
48660 </informaltable>
48661 <para>
48662 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48663 <indexterm role="option">
48664 <primary><option>dkim_timestamps</option></primary>
48665 </indexterm>
48666 </para>
48667 <informaltable frame="all">
48668 <tgroup cols="4" colsep="0" rowsep="0">
48669 <colspec colwidth="8*" align="left"/>
48670 <colspec colwidth="6*" align="center"/>
48671 <colspec colwidth="6*" align="center"/>
48672 <colspec colwidth="6*" align="right"/>
48673 <tbody>
48674 <row>
48675 <entry><option>dkim_timestamps</option></entry>
48676 <entry>Use: <emphasis>smtp</emphasis></entry>
48677 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48678 <entry>Default: <emphasis>unset</emphasis></entry>
48679 </row>
48680 </tbody>
48681 </tgroup>
48682 </informaltable>
48683 <para>
48684 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48685 </para>
48686 <para>
48687 <indexterm role="option">
48688 <primary><option>delay_after_cutoff</option></primary>
48689 </indexterm>
48690 </para>
48691 <informaltable frame="all">
48692 <tgroup cols="4" colsep="0" rowsep="0">
48693 <colspec colwidth="8*" align="left"/>
48694 <colspec colwidth="6*" align="center"/>
48695 <colspec colwidth="6*" align="center"/>
48696 <colspec colwidth="6*" align="right"/>
48697 <tbody>
48698 <row>
48699 <entry><option>delay_after_cutoff</option></entry>
48700 <entry>Use: <emphasis>smtp</emphasis></entry>
48701 <entry>Type: <emphasis>boolean</emphasis></entry>
48702 <entry>Default: <emphasis>true</emphasis></entry>
48703 </row>
48704 </tbody>
48705 </tgroup>
48706 </informaltable>
48707 <para>
48708 <indexterm role="concept">
48709 <primary>final cutoff</primary>
48710 <secondary>retries, controlling</secondary>
48711 </indexterm>
48712 <indexterm role="concept">
48713 <primary>retry</primary>
48714 <secondary>final cutoff</secondary>
48715 </indexterm>
48716 This option controls what happens when all remote IP addresses for a given
48717 domain have been inaccessible for so long that they have passed their retry
48718 cutoff times.
48719 </para>
48720 <para>
48721 In the default state, if the next retry time has not been reached for any of
48722 them, the address is bounced without trying any deliveries. In other words,
48723 Exim delays retrying an IP address after the final cutoff time until a new
48724 retry time is reached, and can therefore bounce an address without ever trying
48725 a delivery, when machines have been down for a long time. Some people are
48726 unhappy at this prospect, so...
48727 </para>
48728 <para>
48729 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
48730 addresses are past their final cutoff time, Exim tries to deliver to those
48731 IP addresses that have not been tried since the message arrived. If there are
48732 none, of if they all fail, the address is bounced. In other words, it does not
48733 delay when a new message arrives, but immediately tries those expired IP
48734 addresses that haven&#x2019;t been tried since the message arrived. If there is a
48735 continuous stream of messages for the dead hosts, unsetting
48736 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
48737 to them.
48738 </para>
48739 <para>
48740 <indexterm role="option">
48741 <primary><option>dns_qualify_single</option></primary>
48742 </indexterm>
48743 </para>
48744 <informaltable frame="all">
48745 <tgroup cols="4" colsep="0" rowsep="0">
48746 <colspec colwidth="8*" align="left"/>
48747 <colspec colwidth="6*" align="center"/>
48748 <colspec colwidth="6*" align="center"/>
48749 <colspec colwidth="6*" align="right"/>
48750 <tbody>
48751 <row>
48752 <entry><option>dns_qualify_single</option></entry>
48753 <entry>Use: <emphasis>smtp</emphasis></entry>
48754 <entry>Type: <emphasis>boolean</emphasis></entry>
48755 <entry>Default: <emphasis>true</emphasis></entry>
48756 </row>
48757 </tbody>
48758 </tgroup>
48759 </informaltable>
48760 <para>
48761 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
48762 and the <option>gethostbyname</option> option is false,
48763 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
48764 in chapter <xref linkend="CHAPdnslookup"/> for more details.
48765 </para>
48766 <para>
48767 <indexterm role="option">
48768 <primary><option>dns_search_parents</option></primary>
48769 </indexterm>
48770 </para>
48771 <informaltable frame="all">
48772 <tgroup cols="4" colsep="0" rowsep="0">
48773 <colspec colwidth="8*" align="left"/>
48774 <colspec colwidth="6*" align="center"/>
48775 <colspec colwidth="6*" align="center"/>
48776 <colspec colwidth="6*" align="right"/>
48777 <tbody>
48778 <row>
48779 <entry><option>dns_search_parents</option></entry>
48780 <entry>Use: <emphasis>smtp</emphasis></entry>
48781 <entry>Type: <emphasis>boolean</emphasis></entry>
48782 <entry>Default: <emphasis>false</emphasis></entry>
48783 </row>
48784 </tbody>
48785 </tgroup>
48786 </informaltable>
48787 <para>
48788 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
48789 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
48790 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
48791 details.
48792 </para>
48793 <para>
48794 <indexterm role="option">
48795 <primary><option>dnssec_request_domains</option></primary>
48796 </indexterm>
48797 </para>
48798 <informaltable frame="all">
48799 <tgroup cols="4" colsep="0" rowsep="0">
48800 <colspec colwidth="8*" align="left"/>
48801 <colspec colwidth="6*" align="center"/>
48802 <colspec colwidth="6*" align="center"/>
48803 <colspec colwidth="6*" align="right"/>
48804 <tbody>
48805 <row>
48806 <entry><option>dnssec_request_domains</option></entry>
48807 <entry>Use: <emphasis>smtp</emphasis></entry>
48808 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
48809 <entry>Default: <emphasis>*</emphasis></entry>
48810 </row>
48811 </tbody>
48812 </tgroup>
48813 </informaltable>
48814 <para>
48815 <indexterm role="concept">
48816 <primary>MX record</primary>
48817 <secondary>security</secondary>
48818 </indexterm>
48819 <indexterm role="concept">
48820 <primary>DNSSEC</primary>
48821 <secondary>MX lookup</secondary>
48822 </indexterm>
48823 <indexterm role="concept">
48824 <primary>security</primary>
48825 <secondary>MX lookup</secondary>
48826 </indexterm>
48827 <indexterm role="concept">
48828 <primary>DNS</primary>
48829 <secondary>DNSSEC</secondary>
48830 </indexterm>
48831 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
48832 the dnssec request bit set. Setting this transport option is only useful if the
48833 transport overrides or sets the host names. See the <option>dnssec_request_domains</option>
48834 router option.
48835 </para>
48836 <para>
48837 <indexterm role="option">
48838 <primary><option>dnssec_require_domains</option></primary>
48839 </indexterm>
48840 </para>
48841 <informaltable frame="all">
48842 <tgroup cols="4" colsep="0" rowsep="0">
48843 <colspec colwidth="8*" align="left"/>
48844 <colspec colwidth="6*" align="center"/>
48845 <colspec colwidth="6*" align="center"/>
48846 <colspec colwidth="6*" align="right"/>
48847 <tbody>
48848 <row>
48849 <entry><option>dnssec_require_domains</option></entry>
48850 <entry>Use: <emphasis>smtp</emphasis></entry>
48851 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
48852 <entry>Default: <emphasis>unset</emphasis></entry>
48853 </row>
48854 </tbody>
48855 </tgroup>
48856 </informaltable>
48857 <para>
48858 <indexterm role="concept">
48859 <primary>MX record</primary>
48860 <secondary>security</secondary>
48861 </indexterm>
48862 <indexterm role="concept">
48863 <primary>DNSSEC</primary>
48864 <secondary>MX lookup</secondary>
48865 </indexterm>
48866 <indexterm role="concept">
48867 <primary>security</primary>
48868 <secondary>MX lookup</secondary>
48869 </indexterm>
48870 <indexterm role="concept">
48871 <primary>DNS</primary>
48872 <secondary>DNSSEC</secondary>
48873 </indexterm>
48874 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
48875 the dnssec request bit set.  Setting this transport option is only
48876 useful if the transport overrides or sets the host names. See the
48877 <option>dnssec_require_domains</option> router option.
48878 </para>
48879 <para>
48880 <indexterm role="option">
48881 <primary><option>dscp</option></primary>
48882 </indexterm>
48883 </para>
48884 <informaltable frame="all">
48885 <tgroup cols="4" colsep="0" rowsep="0">
48886 <colspec colwidth="8*" align="left"/>
48887 <colspec colwidth="6*" align="center"/>
48888 <colspec colwidth="6*" align="center"/>
48889 <colspec colwidth="6*" align="right"/>
48890 <tbody>
48891 <row>
48892 <entry><option>dscp</option></entry>
48893 <entry>Use: <emphasis>smtp</emphasis></entry>
48894 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48895 <entry>Default: <emphasis>unset</emphasis></entry>
48896 </row>
48897 </tbody>
48898 </tgroup>
48899 </informaltable>
48900 <para>
48901 <indexterm role="concept">
48902 <primary>DCSP</primary>
48903 <secondary>outbound</secondary>
48904 </indexterm>
48905 This option causes the DSCP value associated with a socket to be set to one
48906 of a number of fixed strings or to numeric value.
48907 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
48908 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
48909 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
48910 </para>
48911 <para>
48912 The outbound packets from Exim will be marked with this value in the header
48913 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
48914 that these values will have any effect, not be stripped by networking
48915 equipment, or do much of anything without cooperation with your Network
48916 Engineer and those of all network operators between the source and destination.
48917 </para>
48918 <para>
48919 <indexterm role="option">
48920 <primary><option>fallback_hosts</option></primary>
48921 </indexterm>
48922 </para>
48923 <informaltable frame="all">
48924 <tgroup cols="4" colsep="0" rowsep="0">
48925 <colspec colwidth="8*" align="left"/>
48926 <colspec colwidth="6*" align="center"/>
48927 <colspec colwidth="6*" align="center"/>
48928 <colspec colwidth="6*" align="right"/>
48929 <tbody>
48930 <row>
48931 <entry><option>fallback_hosts</option></entry>
48932 <entry>Use: <emphasis>smtp</emphasis></entry>
48933 <entry>Type: <emphasis>string list</emphasis></entry>
48934 <entry>Default: <emphasis>unset</emphasis></entry>
48935 </row>
48936 </tbody>
48937 </tgroup>
48938 </informaltable>
48939 <para>
48940 <indexterm role="concept">
48941 <primary>fallback</primary>
48942 <secondary>hosts specified on transport</secondary>
48943 </indexterm>
48944 String expansion is not applied to this option. The argument must be a
48945 colon-separated list of host names or IP addresses, optionally also including
48946 port numbers, though the separator can be changed, as described in section
48947 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
48948 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
48949 in section <xref linkend="SECTformatonehostitem"/>.
48950 </para>
48951 <para>
48952 Fallback hosts can also be specified on routers, which associate them with the
48953 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
48954 <option>fallback_hosts</option> specified on the transport is used only if the address does
48955 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
48956 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
48957 However, <option>hosts_randomize</option> does apply to fallback host lists.
48958 </para>
48959 <para>
48960 If Exim is unable to deliver to any of the hosts for a particular address, and
48961 the errors are not permanent rejections, the address is put on a separate
48962 transport queue with its host list replaced by the fallback hosts, unless the
48963 address was routed via MX records and the current host was in the original MX
48964 list. In that situation, the fallback host list is not used.
48965 </para>
48966 <para>
48967 Once normal deliveries are complete, the fallback queue is delivered by
48968 re-running the same transports with the new host lists. If several failing
48969 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
48970 copy of the message is sent.
48971 </para>
48972 <para>
48973 The resolution of the host names on the fallback list is controlled by the
48974 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
48975 both to cases when the host list comes with the address and when it is taken
48976 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
48977 fails</quote> facility.
48978 </para>
48979 <para>
48980 <indexterm role="option">
48981 <primary><option>final_timeout</option></primary>
48982 </indexterm>
48983 </para>
48984 <informaltable frame="all">
48985 <tgroup cols="4" colsep="0" rowsep="0">
48986 <colspec colwidth="8*" align="left"/>
48987 <colspec colwidth="6*" align="center"/>
48988 <colspec colwidth="6*" align="center"/>
48989 <colspec colwidth="6*" align="right"/>
48990 <tbody>
48991 <row>
48992 <entry><option>final_timeout</option></entry>
48993 <entry>Use: <emphasis>smtp</emphasis></entry>
48994 <entry>Type: <emphasis>time</emphasis></entry>
48995 <entry>Default: <emphasis>10m</emphasis></entry>
48996 </row>
48997 </tbody>
48998 </tgroup>
48999 </informaltable>
49000 <para>
49001 This is the timeout that applies while waiting for the response to the final
49002 line containing just <quote>.</quote> that terminates a message. Its value must not be
49003 zero.
49004 </para>
49005 <para>
49006 <indexterm role="option">
49007 <primary><option>gethostbyname</option></primary>
49008 </indexterm>
49009 </para>
49010 <informaltable frame="all">
49011 <tgroup cols="4" colsep="0" rowsep="0">
49012 <colspec colwidth="8*" align="left"/>
49013 <colspec colwidth="6*" align="center"/>
49014 <colspec colwidth="6*" align="center"/>
49015 <colspec colwidth="6*" align="right"/>
49016 <tbody>
49017 <row>
49018 <entry><option>gethostbyname</option></entry>
49019 <entry>Use: <emphasis>smtp</emphasis></entry>
49020 <entry>Type: <emphasis>boolean</emphasis></entry>
49021 <entry>Default: <emphasis>false</emphasis></entry>
49022 </row>
49023 </tbody>
49024 </tgroup>
49025 </informaltable>
49026 <para>
49027 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
49028 being used, names are looked up using <function>gethostbyname()</function>
49029 (or <function>getipnodebyname()</function> when available)
49030 instead of using the DNS. Of course, that function may in fact use the DNS, but
49031 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
49032 </para>
49033 <para>
49034 <indexterm role="option">
49035 <primary><option>gnutls_compat_mode</option></primary>
49036 </indexterm>
49037 </para>
49038 <informaltable frame="all">
49039 <tgroup cols="4" colsep="0" rowsep="0">
49040 <colspec colwidth="8*" align="left"/>
49041 <colspec colwidth="6*" align="center"/>
49042 <colspec colwidth="6*" align="center"/>
49043 <colspec colwidth="6*" align="right"/>
49044 <tbody>
49045 <row>
49046 <entry><option>gnutls_compat_mode</option></entry>
49047 <entry>Use: <emphasis>smtp</emphasis></entry>
49048 <entry>Type: <emphasis>boolean</emphasis></entry>
49049 <entry>Default: <emphasis>unset</emphasis></entry>
49050 </row>
49051 </tbody>
49052 </tgroup>
49053 </informaltable>
49054 <para>
49055 This option controls whether GnuTLS is used in compatibility mode in an Exim
49056 server. This reduces security slightly, but improves interworking with older
49057 implementations of TLS.
49058 </para>
49059 <para>
49060 <indexterm role="option">
49061 <primary><option>helo_data</option></primary>
49062 </indexterm>
49063 </para>
49064 <informaltable frame="all">
49065 <tgroup cols="4" colsep="0" rowsep="0">
49066 <colspec colwidth="8*" align="left"/>
49067 <colspec colwidth="6*" align="center"/>
49068 <colspec colwidth="6*" align="center"/>
49069 <colspec colwidth="6*" align="right"/>
49070 <tbody>
49071 <row>
49072 <entry><option>helo_data</option></entry>
49073 <entry>Use: <emphasis>smtp</emphasis></entry>
49074 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49075 <entry>Default: <emphasis>see below</emphasis></entry>
49076 </row>
49077 </tbody>
49078 </tgroup>
49079 </informaltable>
49080 <para>
49081 <indexterm role="concept">
49082 <primary>HELO</primary>
49083 <secondary>argument, setting</secondary>
49084 </indexterm>
49085 <indexterm role="concept">
49086 <primary>EHLO</primary>
49087 <secondary>argument, setting</secondary>
49088 </indexterm>
49089 <indexterm role="concept">
49090 <primary>LHLO argument setting</primary>
49091 </indexterm>
49092 The value of this option is expanded after a connection to a another host has
49093 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
49094 command that starts the outgoing SMTP or LMTP session. The default value of the
49095 option is:
49096 </para>
49097 <literallayout class="monospaced">
49098 $primary_hostname
49099 </literallayout>
49100 <para>
49101 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
49102 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
49103 <varname>$sending_port</varname> are set to the local IP address and port number that are being
49104 used. These variables can be used to generate different values for different
49105 servers or different local IP addresses. For example, if you want the string
49106 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
49107 interface address, you could use this:
49108 </para>
49109 <literallayout class="monospaced">
49110 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
49111   {$primary_hostname}}
49112 </literallayout>
49113 <para>
49114 The use of <option>helo_data</option> applies both to sending messages and when doing
49115 callouts.
49116 </para>
49117 <para>
49118 <indexterm role="option">
49119 <primary><option>hosts</option></primary>
49120 </indexterm>
49121 </para>
49122 <informaltable frame="all">
49123 <tgroup cols="4" colsep="0" rowsep="0">
49124 <colspec colwidth="8*" align="left"/>
49125 <colspec colwidth="6*" align="center"/>
49126 <colspec colwidth="6*" align="center"/>
49127 <colspec colwidth="6*" align="right"/>
49128 <tbody>
49129 <row>
49130 <entry><option>hosts</option></entry>
49131 <entry>Use: <emphasis>smtp</emphasis></entry>
49132 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
49133 <entry>Default: <emphasis>unset</emphasis></entry>
49134 </row>
49135 </tbody>
49136 </tgroup>
49137 </informaltable>
49138 <para>
49139 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
49140 finds the hosts by looking up the address domain in the DNS, or by
49141 <command>manualroute</command>, which has lists of hosts in its configuration. However,
49142 email addresses can be passed to the <command>smtp</command> transport by any router, and not
49143 all of them can provide an associated list of hosts.
49144 </para>
49145 <para>
49146 The <option>hosts</option> option specifies a list of hosts to be used if the address being
49147 processed does not have any hosts associated with it. The hosts specified by
49148 <option>hosts</option> are also used, whether or not the address has its own hosts, if
49149 <option>hosts_override</option> is set.
49150 </para>
49151 <para>
49152 The string is first expanded, before being interpreted as a colon-separated
49153 list of host names or IP addresses, possibly including port numbers. The
49154 separator may be changed to something other than colon, as described in section
49155 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
49156 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
49157 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
49158 of the <command>manualroute</command> router is not available here.
49159 </para>
49160 <para>
49161 If the expansion fails, delivery is deferred. Unless the failure was caused by
49162 the inability to complete a lookup, the error is logged to the panic log as
49163 well as the main log. Host names are looked up either by searching directly for
49164 address records in the DNS or by calling <function>gethostbyname()</function> (or
49165 <function>getipnodebyname()</function> when available), depending on the setting of the
49166 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
49167 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
49168 address are used.
49169 </para>
49170 <para>
49171 During delivery, the hosts are tried in order, subject to their retry status,
49172 unless <option>hosts_randomize</option> is set.
49173 </para>
49174 <para>
49175 <indexterm role="option">
49176 <primary><option>hosts_avoid_esmtp</option></primary>
49177 </indexterm>
49178 </para>
49179 <informaltable frame="all">
49180 <tgroup cols="4" colsep="0" rowsep="0">
49181 <colspec colwidth="8*" align="left"/>
49182 <colspec colwidth="6*" align="center"/>
49183 <colspec colwidth="6*" align="center"/>
49184 <colspec colwidth="6*" align="right"/>
49185 <tbody>
49186 <row>
49187 <entry><option>hosts_avoid_esmtp</option></entry>
49188 <entry>Use: <emphasis>smtp</emphasis></entry>
49189 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49190 <entry>Default: <emphasis>unset</emphasis></entry>
49191 </row>
49192 </tbody>
49193 </tgroup>
49194 </informaltable>
49195 <para>
49196 <indexterm role="concept">
49197 <primary>ESMTP, avoiding use of</primary>
49198 </indexterm>
49199 <indexterm role="concept">
49200 <primary>HELO</primary>
49201 <secondary>forcing use of</secondary>
49202 </indexterm>
49203 <indexterm role="concept">
49204 <primary>EHLO</primary>
49205 <secondary>avoiding use of</secondary>
49206 </indexterm>
49207 <indexterm role="concept">
49208 <primary>PIPELINING</primary>
49209 <secondary>avoiding the use of</secondary>
49210 </indexterm>
49211 This option is for use with broken hosts that announce ESMTP facilities (for
49212 example, PIPELINING) and then fail to implement them properly. When a host
49213 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
49214 start of the SMTP session. This means that it cannot use any of the ESMTP
49215 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
49216 </para>
49217 <para>
49218 <indexterm role="option">
49219 <primary><option>hosts_avoid_pipelining</option></primary>
49220 </indexterm>
49221 </para>
49222 <informaltable frame="all">
49223 <tgroup cols="4" colsep="0" rowsep="0">
49224 <colspec colwidth="8*" align="left"/>
49225 <colspec colwidth="6*" align="center"/>
49226 <colspec colwidth="6*" align="center"/>
49227 <colspec colwidth="6*" align="right"/>
49228 <tbody>
49229 <row>
49230 <entry><option>hosts_avoid_pipelining</option></entry>
49231 <entry>Use: <emphasis>smtp</emphasis></entry>
49232 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49233 <entry>Default: <emphasis>unset</emphasis></entry>
49234 </row>
49235 </tbody>
49236 </tgroup>
49237 </informaltable>
49238 <para>
49239 <indexterm role="concept">
49240 <primary>PIPELINING</primary>
49241 <secondary>avoiding the use of</secondary>
49242 </indexterm>
49243 <indexterm role="concept">
49244 <primary>ESMTP extensions</primary>
49245 <secondary>PIPELINING</secondary>
49246 </indexterm>
49247 Exim will not use the ESMTP PIPELINING extension when delivering to any host
49248 that matches this list, even if the server host advertises PIPELINING support.
49249 </para>
49250 <para>
49251 <indexterm role="option">
49252 <primary><option>hosts_pipe_connect</option></primary>
49253 </indexterm>
49254 </para>
49255 <informaltable frame="all">
49256 <tgroup cols="4" colsep="0" rowsep="0">
49257 <colspec colwidth="8*" align="left"/>
49258 <colspec colwidth="6*" align="center"/>
49259 <colspec colwidth="6*" align="center"/>
49260 <colspec colwidth="6*" align="right"/>
49261 <tbody>
49262 <row>
49263 <entry><option>hosts_pipe_connect</option></entry>
49264 <entry>Use: <emphasis>smtp</emphasis></entry>
49265 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49266 <entry>Default: <emphasis>unset</emphasis></entry>
49267 </row>
49268 </tbody>
49269 </tgroup>
49270 </informaltable>
49271 <para>
49272 <indexterm role="concept">
49273 <primary>pipelining</primary>
49274 <secondary>early connection</secondary>
49275 </indexterm>
49276 <indexterm role="concept">
49277 <primary>pipelining</primary>
49278 <secondary>PIPE_CONNECT</secondary>
49279 </indexterm>
49280 If Exim is built with the SUPPORT_PIPE_CONNECT build option
49281 this option controls which to hosts the facility watched for
49282 and recorded, and used for subsequent connections.
49283 </para>
49284 <para>
49285 The retry hints database is used for the record,
49286 and records are subject to the <option>retry_data_expire</option> option.
49287 When used, the pipelining saves on roundtrip times.
49288 It also turns SMTP into a client-first protocol
49289 so combines well with TCP Fast Open.
49290 </para>
49291 <para>
49292 See also the <option>pipelining_connect_advertise_hosts</option> main option.
49293 </para>
49294 <para>
49295 Note:
49296 When the facility is used, the transport <option>helo_data</option> option
49297 will be expanded before the <varname>$sending_ip_address</varname> variable
49298 is filled in.
49299 A check is made for the use of that variable, without the
49300 presence of a <quote>def:</quote> test on it, but suitably complex coding
49301 can avoid the check and produce unexpected results.
49302 You have been warned.
49303 </para>
49304 <para>
49305 <indexterm role="option">
49306 <primary><option>hosts_avoid_tls</option></primary>
49307 </indexterm>
49308 </para>
49309 <informaltable frame="all">
49310 <tgroup cols="4" colsep="0" rowsep="0">
49311 <colspec colwidth="8*" align="left"/>
49312 <colspec colwidth="6*" align="center"/>
49313 <colspec colwidth="6*" align="center"/>
49314 <colspec colwidth="6*" align="right"/>
49315 <tbody>
49316 <row>
49317 <entry><option>hosts_avoid_tls</option></entry>
49318 <entry>Use: <emphasis>smtp</emphasis></entry>
49319 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49320 <entry>Default: <emphasis>unset</emphasis></entry>
49321 </row>
49322 </tbody>
49323 </tgroup>
49324 </informaltable>
49325 <para>
49326 <indexterm role="concept">
49327 <primary>TLS</primary>
49328 <secondary>avoiding for certain hosts</secondary>
49329 </indexterm>
49330 Exim will not try to start a TLS session when delivering to any host that
49331 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49332 </para>
49333 <para>
49334 <indexterm role="option">
49335 <primary><option>hosts_verify_avoid_tls</option></primary>
49336 </indexterm>
49337 </para>
49338 <informaltable frame="all">
49339 <tgroup cols="4" colsep="0" rowsep="0">
49340 <colspec colwidth="8*" align="left"/>
49341 <colspec colwidth="6*" align="center"/>
49342 <colspec colwidth="6*" align="center"/>
49343 <colspec colwidth="6*" align="right"/>
49344 <tbody>
49345 <row>
49346 <entry><option>hosts_verify_avoid_tls</option></entry>
49347 <entry>Use: <emphasis>smtp</emphasis></entry>
49348 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49349 <entry>Default: <emphasis>unset</emphasis></entry>
49350 </row>
49351 </tbody>
49352 </tgroup>
49353 </informaltable>
49354 <para>
49355 <indexterm role="concept">
49356 <primary>TLS</primary>
49357 <secondary>avoiding for certain hosts</secondary>
49358 </indexterm>
49359 Exim will not try to start a TLS session for a verify callout,
49360 or when delivering in cutthrough mode,
49361 to any host that matches this list.
49362 </para>
49363 <para>
49364 <indexterm role="option">
49365 <primary><option>hosts_max_try</option></primary>
49366 </indexterm>
49367 </para>
49368 <informaltable frame="all">
49369 <tgroup cols="4" colsep="0" rowsep="0">
49370 <colspec colwidth="8*" align="left"/>
49371 <colspec colwidth="6*" align="center"/>
49372 <colspec colwidth="6*" align="center"/>
49373 <colspec colwidth="6*" align="right"/>
49374 <tbody>
49375 <row>
49376 <entry><option>hosts_max_try</option></entry>
49377 <entry>Use: <emphasis>smtp</emphasis></entry>
49378 <entry>Type: <emphasis>integer</emphasis></entry>
49379 <entry>Default: <emphasis>5</emphasis></entry>
49380 </row>
49381 </tbody>
49382 </tgroup>
49383 </informaltable>
49384 <para>
49385 <indexterm role="concept">
49386 <primary>host</primary>
49387 <secondary>maximum number to try</secondary>
49388 </indexterm>
49389 <indexterm role="concept">
49390 <primary>limit</primary>
49391 <secondary>number of hosts tried</secondary>
49392 </indexterm>
49393 <indexterm role="concept">
49394 <primary>limit</primary>
49395 <secondary>number of MX tried</secondary>
49396 </indexterm>
49397 <indexterm role="concept">
49398 <primary>MX record</primary>
49399 <secondary>maximum tried</secondary>
49400 </indexterm>
49401 This option limits the number of IP addresses that are tried for any one
49402 delivery in cases where there are temporary delivery errors. Section
49403 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
49404 </para>
49405 <para>
49406 <indexterm role="option">
49407 <primary><option>hosts_max_try_hardlimit</option></primary>
49408 </indexterm>
49409 </para>
49410 <informaltable frame="all">
49411 <tgroup cols="4" colsep="0" rowsep="0">
49412 <colspec colwidth="8*" align="left"/>
49413 <colspec colwidth="6*" align="center"/>
49414 <colspec colwidth="6*" align="center"/>
49415 <colspec colwidth="6*" align="right"/>
49416 <tbody>
49417 <row>
49418 <entry><option>hosts_max_try_hardlimit</option></entry>
49419 <entry>Use: <emphasis>smtp</emphasis></entry>
49420 <entry>Type: <emphasis>integer</emphasis></entry>
49421 <entry>Default: <emphasis>50</emphasis></entry>
49422 </row>
49423 </tbody>
49424 </tgroup>
49425 </informaltable>
49426 <para>
49427 This is an additional check on the maximum number of IP addresses that Exim
49428 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
49429 why it exists.
49430 </para>
49431 <para>
49432 <indexterm role="option">
49433 <primary><option>hosts_nopass_tls</option></primary>
49434 </indexterm>
49435 </para>
49436 <informaltable frame="all">
49437 <tgroup cols="4" colsep="0" rowsep="0">
49438 <colspec colwidth="8*" align="left"/>
49439 <colspec colwidth="6*" align="center"/>
49440 <colspec colwidth="6*" align="center"/>
49441 <colspec colwidth="6*" align="right"/>
49442 <tbody>
49443 <row>
49444 <entry><option>hosts_nopass_tls</option></entry>
49445 <entry>Use: <emphasis>smtp</emphasis></entry>
49446 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49447 <entry>Default: <emphasis>unset</emphasis></entry>
49448 </row>
49449 </tbody>
49450 </tgroup>
49451 </informaltable>
49452 <para>
49453 <indexterm role="concept">
49454 <primary>TLS</primary>
49455 <secondary>passing connection</secondary>
49456 </indexterm>
49457 <indexterm role="concept">
49458 <primary>multiple SMTP deliveries</primary>
49459 </indexterm>
49460 <indexterm role="concept">
49461 <primary>TLS</primary>
49462 <secondary>multiple message deliveries</secondary>
49463 </indexterm>
49464 For any host that matches this list, a connection on which a TLS session has
49465 been started will not be passed to a new delivery process for sending another
49466 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
49467 explanation of when this might be needed.
49468 </para>
49469 <para>
49470 <indexterm role="option">
49471 <primary><option>hosts_noproxy_tls</option></primary>
49472 </indexterm>
49473 </para>
49474 <informaltable frame="all">
49475 <tgroup cols="4" colsep="0" rowsep="0">
49476 <colspec colwidth="8*" align="left"/>
49477 <colspec colwidth="6*" align="center"/>
49478 <colspec colwidth="6*" align="center"/>
49479 <colspec colwidth="6*" align="right"/>
49480 <tbody>
49481 <row>
49482 <entry><option>hosts_noproxy_tls</option></entry>
49483 <entry>Use: <emphasis>smtp</emphasis></entry>
49484 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49485 <entry>Default: <emphasis>unset</emphasis></entry>
49486 </row>
49487 </tbody>
49488 </tgroup>
49489 </informaltable>
49490 <para>
49491 <indexterm role="concept">
49492 <primary>TLS</primary>
49493 <secondary>passing connection</secondary>
49494 </indexterm>
49495 <indexterm role="concept">
49496 <primary>multiple SMTP deliveries</primary>
49497 </indexterm>
49498 <indexterm role="concept">
49499 <primary>TLS</primary>
49500 <secondary>multiple message deliveries</secondary>
49501 </indexterm>
49502 For any host that matches this list, a TLS session which has
49503 been started will not be passed to a new delivery process for sending another
49504 message on the same session.
49505 </para>
49506 <para>
49507 The traditional implementation closes down TLS and re-starts it in the new
49508 process, on the same open TCP connection, for each successive message
49509 sent.  If permitted by this option a pipe to to the new process is set up
49510 instead, and the original process maintains the TLS connection and proxies
49511 the SMTP connection from and to the new process and any subsequents.
49512 The new process has no access to TLS information, so cannot include it in
49513 logging.
49514 </para>
49515 <para>
49516 <indexterm role="option">
49517 <primary><option>hosts_override</option></primary>
49518 </indexterm>
49519 </para>
49520 <informaltable frame="all">
49521 <tgroup cols="4" colsep="0" rowsep="0">
49522 <colspec colwidth="8*" align="left"/>
49523 <colspec colwidth="6*" align="center"/>
49524 <colspec colwidth="6*" align="center"/>
49525 <colspec colwidth="6*" align="right"/>
49526 <tbody>
49527 <row>
49528 <entry><option>hosts_override</option></entry>
49529 <entry>Use: <emphasis>smtp</emphasis></entry>
49530 <entry>Type: <emphasis>boolean</emphasis></entry>
49531 <entry>Default: <emphasis>false</emphasis></entry>
49532 </row>
49533 </tbody>
49534 </tgroup>
49535 </informaltable>
49536 <para>
49537 If this option is set and the <option>hosts</option> option is also set, any hosts that are
49538 attached to the address are ignored, and instead the hosts specified by the
49539 <option>hosts</option> option are always used. This option does not apply to
49540 <option>fallback_hosts</option>.
49541 </para>
49542 <para>
49543 <indexterm role="option">
49544 <primary><option>hosts_randomize</option></primary>
49545 </indexterm>
49546 </para>
49547 <informaltable frame="all">
49548 <tgroup cols="4" colsep="0" rowsep="0">
49549 <colspec colwidth="8*" align="left"/>
49550 <colspec colwidth="6*" align="center"/>
49551 <colspec colwidth="6*" align="center"/>
49552 <colspec colwidth="6*" align="right"/>
49553 <tbody>
49554 <row>
49555 <entry><option>hosts_randomize</option></entry>
49556 <entry>Use: <emphasis>smtp</emphasis></entry>
49557 <entry>Type: <emphasis>boolean</emphasis></entry>
49558 <entry>Default: <emphasis>false</emphasis></entry>
49559 </row>
49560 </tbody>
49561 </tgroup>
49562 </informaltable>
49563 <para>
49564 <indexterm role="concept">
49565 <primary>randomized host list</primary>
49566 </indexterm>
49567 <indexterm role="concept">
49568 <primary>host</primary>
49569 <secondary>list of; randomized</secondary>
49570 </indexterm>
49571 <indexterm role="concept">
49572 <primary>fallback</primary>
49573 <secondary>randomized hosts</secondary>
49574 </indexterm>
49575 If this option is set, and either the list of hosts is taken from the
49576 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
49577 were not obtained from MX records (this includes fallback hosts from the
49578 router), and were not randomized by the router, the order of trying the hosts
49579 is randomized each time the transport runs. Randomizing the order of a host
49580 list can be used to do crude load sharing.
49581 </para>
49582 <para>
49583 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
49584 order is separately randomized. This makes it possible to set up MX-like
49585 behaviour. The boundaries between groups are indicated by an item that is just
49586 <literal>+</literal> in the host list. For example:
49587 </para>
49588 <literallayout class="monospaced">
49589 hosts = host1:host2:host3:+:host4:host5
49590 </literallayout>
49591 <para>
49592 The order of the first three hosts and the order of the last two hosts is
49593 randomized for each use, but the first three always end up before the last two.
49594 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
49595 </para>
49596 <para>
49597 <indexterm role="option">
49598 <primary><option>hosts_require_auth</option></primary>
49599 </indexterm>
49600 </para>
49601 <informaltable frame="all">
49602 <tgroup cols="4" colsep="0" rowsep="0">
49603 <colspec colwidth="8*" align="left"/>
49604 <colspec colwidth="6*" align="center"/>
49605 <colspec colwidth="6*" align="center"/>
49606 <colspec colwidth="6*" align="right"/>
49607 <tbody>
49608 <row>
49609 <entry><option>hosts_require_auth</option></entry>
49610 <entry>Use: <emphasis>smtp</emphasis></entry>
49611 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49612 <entry>Default: <emphasis>unset</emphasis></entry>
49613 </row>
49614 </tbody>
49615 </tgroup>
49616 </informaltable>
49617 <para>
49618 <indexterm role="concept">
49619 <primary>authentication</primary>
49620 <secondary>required by client</secondary>
49621 </indexterm>
49622 This option provides a list of servers for which authentication must succeed
49623 before Exim will try to transfer a message. If authentication fails for
49624 servers which are not in this list, Exim tries to send unauthenticated. If
49625 authentication fails for one of these servers, delivery is deferred. This
49626 temporary error is detectable in the retry rules, so it can be turned into a
49627 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
49628 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
49629 </para>
49630 <para>
49631 <indexterm role="option">
49632 <primary><option>hosts_request_ocsp</option></primary>
49633 </indexterm>
49634 </para>
49635 <informaltable frame="all">
49636 <tgroup cols="4" colsep="0" rowsep="0">
49637 <colspec colwidth="8*" align="left"/>
49638 <colspec colwidth="6*" align="center"/>
49639 <colspec colwidth="6*" align="center"/>
49640 <colspec colwidth="6*" align="right"/>
49641 <tbody>
49642 <row>
49643 <entry><option>hosts_request_ocsp</option></entry>
49644 <entry>Use: <emphasis>smtp</emphasis></entry>
49645 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49646 <entry>Default: <emphasis>*</emphasis></entry>
49647 </row>
49648 </tbody>
49649 </tgroup>
49650 </informaltable>
49651 <para>
49652 <indexterm role="concept">
49653 <primary>TLS</primary>
49654 <secondary>requiring for certain servers</secondary>
49655 </indexterm>
49656 Exim will request a Certificate Status on a
49657 TLS session for any host that matches this list.
49658 <option>tls_verify_certificates</option> should also be set for the transport.
49659 </para>
49660 <para>
49661 <indexterm role="option">
49662 <primary><option>hosts_require_dane</option></primary>
49663 </indexterm>
49664 </para>
49665 <informaltable frame="all">
49666 <tgroup cols="4" colsep="0" rowsep="0">
49667 <colspec colwidth="8*" align="left"/>
49668 <colspec colwidth="6*" align="center"/>
49669 <colspec colwidth="6*" align="center"/>
49670 <colspec colwidth="6*" align="right"/>
49671 <tbody>
49672 <row>
49673 <entry><option>hosts_require_dane</option></entry>
49674 <entry>Use: <emphasis>smtp</emphasis></entry>
49675 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49676 <entry>Default: <emphasis>unset</emphasis></entry>
49677 </row>
49678 </tbody>
49679 </tgroup>
49680 </informaltable>
49681 <para>
49682 <indexterm role="concept">
49683 <primary>DANE</primary>
49684 <secondary>transport options</secondary>
49685 </indexterm>
49686 <indexterm role="concept">
49687 <primary>DANE</primary>
49688 <secondary>requiring for certain servers</secondary>
49689 </indexterm>
49690 If built with DANE support, Exim  will require that a DNSSEC-validated
49691 TLSA record is present for any host matching the list,
49692 and that a DANE-verified TLS connection is made. See
49693 the <option>dnssec_request_domains</option> router and transport options.
49694 There will be no fallback to in-clear communication.
49695 See section <xref linkend="SECDANE"/>.
49696 </para>
49697 <para>
49698 <indexterm role="option">
49699 <primary><option>hosts_require_ocsp</option></primary>
49700 </indexterm>
49701 </para>
49702 <informaltable frame="all">
49703 <tgroup cols="4" colsep="0" rowsep="0">
49704 <colspec colwidth="8*" align="left"/>
49705 <colspec colwidth="6*" align="center"/>
49706 <colspec colwidth="6*" align="center"/>
49707 <colspec colwidth="6*" align="right"/>
49708 <tbody>
49709 <row>
49710 <entry><option>hosts_require_ocsp</option></entry>
49711 <entry>Use: <emphasis>smtp</emphasis></entry>
49712 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49713 <entry>Default: <emphasis>unset</emphasis></entry>
49714 </row>
49715 </tbody>
49716 </tgroup>
49717 </informaltable>
49718 <para>
49719 <indexterm role="concept">
49720 <primary>TLS</primary>
49721 <secondary>requiring for certain servers</secondary>
49722 </indexterm>
49723 Exim will request, and check for a valid Certificate Status being given, on a
49724 TLS session for any host that matches this list.
49725 <option>tls_verify_certificates</option> should also be set for the transport.
49726 </para>
49727 <para>
49728 <indexterm role="option">
49729 <primary><option>hosts_require_tls</option></primary>
49730 </indexterm>
49731 </para>
49732 <informaltable frame="all">
49733 <tgroup cols="4" colsep="0" rowsep="0">
49734 <colspec colwidth="8*" align="left"/>
49735 <colspec colwidth="6*" align="center"/>
49736 <colspec colwidth="6*" align="center"/>
49737 <colspec colwidth="6*" align="right"/>
49738 <tbody>
49739 <row>
49740 <entry><option>hosts_require_tls</option></entry>
49741 <entry>Use: <emphasis>smtp</emphasis></entry>
49742 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49743 <entry>Default: <emphasis>unset</emphasis></entry>
49744 </row>
49745 </tbody>
49746 </tgroup>
49747 </informaltable>
49748 <para>
49749 <indexterm role="concept">
49750 <primary>TLS</primary>
49751 <secondary>requiring for certain servers</secondary>
49752 </indexterm>
49753 Exim will insist on using a TLS session when delivering to any host that
49754 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49755 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
49756 incoming messages, use an appropriate ACL.
49757 </para>
49758 <para>
49759 <indexterm role="option">
49760 <primary><option>hosts_try_auth</option></primary>
49761 </indexterm>
49762 </para>
49763 <informaltable frame="all">
49764 <tgroup cols="4" colsep="0" rowsep="0">
49765 <colspec colwidth="8*" align="left"/>
49766 <colspec colwidth="6*" align="center"/>
49767 <colspec colwidth="6*" align="center"/>
49768 <colspec colwidth="6*" align="right"/>
49769 <tbody>
49770 <row>
49771 <entry><option>hosts_try_auth</option></entry>
49772 <entry>Use: <emphasis>smtp</emphasis></entry>
49773 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49774 <entry>Default: <emphasis>unset</emphasis></entry>
49775 </row>
49776 </tbody>
49777 </tgroup>
49778 </informaltable>
49779 <para>
49780 <indexterm role="concept">
49781 <primary>authentication</primary>
49782 <secondary>optional in client</secondary>
49783 </indexterm>
49784 This option provides a list of servers to which, provided they announce
49785 authentication support, Exim will attempt to authenticate as a client when it
49786 connects. If authentication fails, Exim will try to transfer the message
49787 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
49788 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
49789 </para>
49790 <para>
49791 <indexterm role="option">
49792 <primary><option>hosts_try_chunking</option></primary>
49793 </indexterm>
49794 </para>
49795 <informaltable frame="all">
49796 <tgroup cols="4" colsep="0" rowsep="0">
49797 <colspec colwidth="8*" align="left"/>
49798 <colspec colwidth="6*" align="center"/>
49799 <colspec colwidth="6*" align="center"/>
49800 <colspec colwidth="6*" align="right"/>
49801 <tbody>
49802 <row>
49803 <entry><option>hosts_try_chunking</option></entry>
49804 <entry>Use: <emphasis>smtp</emphasis></entry>
49805 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49806 <entry>Default: <emphasis>*</emphasis></entry>
49807 </row>
49808 </tbody>
49809 </tgroup>
49810 </informaltable>
49811 <para>
49812 <indexterm role="concept">
49813 <primary>CHUNKING</primary>
49814 <secondary>enabling, in client</secondary>
49815 </indexterm>
49816 <indexterm role="concept">
49817 <primary>BDAT</primary>
49818 <secondary>SMTP command</secondary>
49819 </indexterm>
49820 <indexterm role="concept">
49821 <primary>RFC 3030</primary>
49822 <secondary>CHUNKING</secondary>
49823 </indexterm>
49824 This option provides a list of servers to which, provided they announce
49825 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
49826 </para>
49827 <para revisionflag="changed">
49828 Unless DKIM signing is being done,
49829 </para>
49830 <para>
49831 BDAT will not be used in conjunction with a transport filter.
49832 </para>
49833 <para>
49834 <indexterm role="option">
49835 <primary><option>hosts_try_dane</option></primary>
49836 </indexterm>
49837 </para>
49838 <informaltable frame="all">
49839 <tgroup cols="4" colsep="0" rowsep="0">
49840 <colspec colwidth="8*" align="left"/>
49841 <colspec colwidth="6*" align="center"/>
49842 <colspec colwidth="6*" align="center"/>
49843 <colspec colwidth="6*" align="right"/>
49844 <tbody>
49845 <row>
49846 <entry><option>hosts_try_dane</option></entry>
49847 <entry>Use: <emphasis>smtp</emphasis></entry>
49848 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49849 <entry>Default: <emphasis>*</emphasis></entry>
49850 </row>
49851 </tbody>
49852 </tgroup>
49853 </informaltable>
49854 <para>
49855 <indexterm role="concept">
49856 <primary>DANE</primary>
49857 <secondary>transport options</secondary>
49858 </indexterm>
49859 <indexterm role="concept">
49860 <primary>DANE</primary>
49861 <secondary>attempting for certain servers</secondary>
49862 </indexterm>
49863 If built with DANE support, Exim  will require that a DNSSEC-validated
49864 TLSA record is present for any host matching the list,
49865 and that a DANE-verified TLS connection is made. See
49866 the <option>dnssec_request_domains</option> router and transport options.
49867 There will be no fallback to in-clear communication.
49868 See section <xref linkend="SECDANE"/>.
49869 </para>
49870 <para>
49871 <indexterm role="option">
49872 <primary><option>hosts_try_fastopen</option></primary>
49873 </indexterm>
49874 </para>
49875 <informaltable frame="all">
49876 <tgroup cols="4" colsep="0" rowsep="0">
49877 <colspec colwidth="8*" align="left"/>
49878 <colspec colwidth="6*" align="center"/>
49879 <colspec colwidth="6*" align="center"/>
49880 <colspec colwidth="6*" align="right"/>
49881 <tbody>
49882 <row>
49883 <entry><option>hosts_try_fastopen</option></entry>
49884 <entry>Use: <emphasis>smtp</emphasis></entry>
49885 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49886 <entry>Default: <emphasis>*</emphasis></entry>
49887 </row>
49888 </tbody>
49889 </tgroup>
49890 </informaltable>
49891 <para>
49892 <indexterm role="concept">
49893 <primary>fast open, TCP</primary>
49894 <secondary>enabling, in client</secondary>
49895 </indexterm>
49896 <indexterm role="concept">
49897 <primary>TCP Fast Open</primary>
49898 <secondary>enabling, in client</secondary>
49899 </indexterm>
49900 <indexterm role="concept">
49901 <primary>RFC 7413</primary>
49902 <secondary>TCP Fast Open</secondary>
49903 </indexterm>
49904 This option provides a list of servers to which, provided
49905 the facility is supported by this system, Exim will attempt to
49906 perform a TCP Fast Open.
49907 No data is sent on the SYN segment but, if the remote server also
49908 supports the facility, it can send its SMTP banner immediately after
49909 the SYN,ACK segment.  This can save up to one round-trip time.
49910 </para>
49911 <para>
49912 The facility is only active for previously-contacted servers,
49913 as the initiator must present a cookie in the SYN segment.
49914 </para>
49915 <para>
49916 On (at least some) current Linux distributions the facility must be enabled
49917 in the kernel by the sysadmin before the support is usable.
49918 There is no option for control of the server side; if the system supports
49919 it it is always enabled.  Note that lengthy operations in the connect ACL,
49920 such as DNSBL lookups, will still delay the emission of the SMTP banner.
49921 </para>
49922 <para>
49923 <indexterm role="option">
49924 <primary><option>hosts_try_prdr</option></primary>
49925 </indexterm>
49926 </para>
49927 <informaltable frame="all">
49928 <tgroup cols="4" colsep="0" rowsep="0">
49929 <colspec colwidth="8*" align="left"/>
49930 <colspec colwidth="6*" align="center"/>
49931 <colspec colwidth="6*" align="center"/>
49932 <colspec colwidth="6*" align="right"/>
49933 <tbody>
49934 <row>
49935 <entry><option>hosts_try_prdr</option></entry>
49936 <entry>Use: <emphasis>smtp</emphasis></entry>
49937 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49938 <entry>Default: <emphasis>*</emphasis></entry>
49939 </row>
49940 </tbody>
49941 </tgroup>
49942 </informaltable>
49943 <para>
49944 <indexterm role="concept">
49945 <primary>PRDR</primary>
49946 <secondary>enabling, optional in client</secondary>
49947 </indexterm>
49948 <indexterm role="concept">
49949 <primary>ESMTP extensions</primary>
49950 <secondary>PRDR</secondary>
49951 </indexterm>
49952 This option provides a list of servers to which, provided they announce
49953 PRDR support, Exim will attempt to negotiate PRDR
49954 for multi-recipient messages.
49955 The option can usually be left as default.
49956 </para>
49957 <para>
49958 <indexterm role="option">
49959 <primary><option>interface</option></primary>
49960 </indexterm>
49961 </para>
49962 <informaltable frame="all">
49963 <tgroup cols="4" colsep="0" rowsep="0">
49964 <colspec colwidth="8*" align="left"/>
49965 <colspec colwidth="6*" align="center"/>
49966 <colspec colwidth="6*" align="center"/>
49967 <colspec colwidth="6*" align="right"/>
49968 <tbody>
49969 <row>
49970 <entry><option>interface</option></entry>
49971 <entry>Use: <emphasis>smtp</emphasis></entry>
49972 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
49973 <entry>Default: <emphasis>unset</emphasis></entry>
49974 </row>
49975 </tbody>
49976 </tgroup>
49977 </informaltable>
49978 <para>
49979 <indexterm role="concept">
49980 <primary>bind IP address</primary>
49981 </indexterm>
49982 <indexterm role="concept">
49983 <primary>IP address</primary>
49984 <secondary>binding</secondary>
49985 </indexterm>
49986 <indexterm role="variable">
49987 <primary><varname>$host</varname></primary>
49988 </indexterm>
49989 <indexterm role="variable">
49990 <primary><varname>$host_address</varname></primary>
49991 </indexterm>
49992 This option specifies which interface to bind to when making an outgoing SMTP
49993 call. The value is an IP address, not an interface name such as
49994 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
49995 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
49996 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
49997 outgoing interface address. There is no variable that contains an outgoing
49998 interface address because, unless it is set by this option, its value is
49999 unknown.
50000 </para>
50001 <para>
50002 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
50003 <varname>$host_address</varname> refer to the host to which a connection is about to be made
50004 during the expansion of the string. Forced expansion failure, or an empty
50005 string result causes the option to be ignored. Otherwise, after expansion, the
50006 string must be a list of IP addresses, colon-separated by default, but the
50007 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
50008 For example:
50009 </para>
50010 <literallayout class="monospaced">
50011 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
50012 </literallayout>
50013 <para>
50014 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
50015 connection. If none of them are the correct type, the option is ignored. If
50016 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
50017 interface to use if the host has more than one.
50018 </para>
50019 <para>
50020 <indexterm role="option">
50021 <primary><option>keepalive</option></primary>
50022 </indexterm>
50023 </para>
50024 <informaltable frame="all">
50025 <tgroup cols="4" colsep="0" rowsep="0">
50026 <colspec colwidth="8*" align="left"/>
50027 <colspec colwidth="6*" align="center"/>
50028 <colspec colwidth="6*" align="center"/>
50029 <colspec colwidth="6*" align="right"/>
50030 <tbody>
50031 <row>
50032 <entry><option>keepalive</option></entry>
50033 <entry>Use: <emphasis>smtp</emphasis></entry>
50034 <entry>Type: <emphasis>boolean</emphasis></entry>
50035 <entry>Default: <emphasis>true</emphasis></entry>
50036 </row>
50037 </tbody>
50038 </tgroup>
50039 </informaltable>
50040 <para>
50041 <indexterm role="concept">
50042 <primary>keepalive</primary>
50043 <secondary>on outgoing connection</secondary>
50044 </indexterm>
50045 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
50046 connections. When set, it causes the kernel to probe idle connections
50047 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
50048 of the connection should send a acknowledgment if the connection is still okay
50049 or a reset if the connection has been aborted. The reason for doing this is
50050 that it has the beneficial effect of freeing up certain types of connection
50051 that can get stuck when the remote host is disconnected without tidying up the
50052 TCP/IP call properly. The keepalive mechanism takes several hours to detect
50053 unreachable hosts.
50054 </para>
50055 <para>
50056 <indexterm role="option">
50057 <primary><option>lmtp_ignore_quota</option></primary>
50058 </indexterm>
50059 </para>
50060 <informaltable frame="all">
50061 <tgroup cols="4" colsep="0" rowsep="0">
50062 <colspec colwidth="8*" align="left"/>
50063 <colspec colwidth="6*" align="center"/>
50064 <colspec colwidth="6*" align="center"/>
50065 <colspec colwidth="6*" align="right"/>
50066 <tbody>
50067 <row>
50068 <entry><option>lmtp_ignore_quota</option></entry>
50069 <entry>Use: <emphasis>smtp</emphasis></entry>
50070 <entry>Type: <emphasis>boolean</emphasis></entry>
50071 <entry>Default: <emphasis>false</emphasis></entry>
50072 </row>
50073 </tbody>
50074 </tgroup>
50075 </informaltable>
50076 <para>
50077 <indexterm role="concept">
50078 <primary>LMTP</primary>
50079 <secondary>ignoring quota errors</secondary>
50080 </indexterm>
50081 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
50082 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
50083 has advertised support for IGNOREQUOTA in its response to the LHLO command.
50084 </para>
50085 <para>
50086 <indexterm role="option">
50087 <primary><option>max_rcpt</option></primary>
50088 </indexterm>
50089 </para>
50090 <informaltable frame="all">
50091 <tgroup cols="4" colsep="0" rowsep="0">
50092 <colspec colwidth="8*" align="left"/>
50093 <colspec colwidth="6*" align="center"/>
50094 <colspec colwidth="6*" align="center"/>
50095 <colspec colwidth="6*" align="right"/>
50096 <tbody>
50097 <row>
50098 <entry><option>max_rcpt</option></entry>
50099 <entry>Use: <emphasis>smtp</emphasis></entry>
50100 <entry>Type: <emphasis>integer</emphasis></entry>
50101 <entry>Default: <emphasis>100</emphasis></entry>
50102 </row>
50103 </tbody>
50104 </tgroup>
50105 </informaltable>
50106 <para>
50107 <indexterm role="concept">
50108 <primary>RCPT</primary>
50109 <secondary>maximum number of outgoing</secondary>
50110 </indexterm>
50111 This option limits the number of RCPT commands that are sent in a single
50112 SMTP message transaction. Each set of addresses is treated independently, and
50113 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
50114 permits this.
50115 </para>
50116 <para>
50117 <indexterm role="option">
50118 <primary><option>multi_domain</option></primary>
50119 </indexterm>
50120 </para>
50121 <informaltable frame="all">
50122 <tgroup cols="4" colsep="0" rowsep="0">
50123 <colspec colwidth="8*" align="left"/>
50124 <colspec colwidth="6*" align="center"/>
50125 <colspec colwidth="6*" align="center"/>
50126 <colspec colwidth="6*" align="right"/>
50127 <tbody>
50128 <row>
50129 <entry><option>multi_domain</option></entry>
50130 <entry>Use: <emphasis>smtp</emphasis></entry>
50131 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
50132 <entry>Default: <emphasis>true</emphasis></entry>
50133 </row>
50134 </tbody>
50135 </tgroup>
50136 </informaltable>
50137 <para>
50138 <indexterm role="variable">
50139 <primary><varname>$domain</varname></primary>
50140 </indexterm>
50141 When this option is set, the <command>smtp</command> transport can handle a number of
50142 addresses containing a mixture of different domains provided they all resolve
50143 to the same list of hosts. Turning the option off restricts the transport to
50144 handling only one domain at a time. This is useful if you want to use
50145 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
50146 is a single domain involved in a remote delivery.
50147 </para>
50148 <para>
50149 It is expanded per-address and can depend on any of
50150 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
50151 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
50152 </para>
50153 <para>
50154 <indexterm role="option">
50155 <primary><option>port</option></primary>
50156 </indexterm>
50157 </para>
50158 <informaltable frame="all">
50159 <tgroup cols="4" colsep="0" rowsep="0">
50160 <colspec colwidth="8*" align="left"/>
50161 <colspec colwidth="6*" align="center"/>
50162 <colspec colwidth="6*" align="center"/>
50163 <colspec colwidth="6*" align="right"/>
50164 <tbody>
50165 <row>
50166 <entry><option>port</option></entry>
50167 <entry>Use: <emphasis>smtp</emphasis></entry>
50168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50169 <entry>Default: <emphasis>see below</emphasis></entry>
50170 </row>
50171 </tbody>
50172 </tgroup>
50173 </informaltable>
50174 <para>
50175 <indexterm role="concept">
50176 <primary>port</primary>
50177 <secondary>sending TCP/IP</secondary>
50178 </indexterm>
50179 <indexterm role="concept">
50180 <primary>TCP/IP</primary>
50181 <secondary>setting outgoing port</secondary>
50182 </indexterm>
50183 This option specifies the TCP/IP port on the server to which Exim connects.
50184 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
50185 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
50186 The name was changed to minimize confusion with the outgoing port. There is no
50187 variable that contains an outgoing port.
50188 </para>
50189 <para>
50190 If the value of this option begins with a digit it is taken as a port number;
50191 otherwise it is looked up using <function>getservbyname()</function>. The default value is
50192 normally <quote>smtp</quote>,
50193 but if <option>protocol</option> is set to <quote>lmtp</quote> the default is <quote>lmtp</quote>
50194 and if <option>protocol</option> is set to <quote>smtps</quote> the default is <quote>smtps</quote>.
50195 If the expansion fails, or if a port number cannot be found, delivery
50196 is deferred.
50197 </para>
50198 <para>
50199 Note that at least one Linux distribution has been seen failing
50200 to put <quote>smtps</quote> in its <quote>/etc/services</quote> file, resulting is such deferrals.
50201 </para>
50202 <para>
50203 <indexterm role="option">
50204 <primary><option>protocol</option></primary>
50205 </indexterm>
50206 </para>
50207 <informaltable frame="all">
50208 <tgroup cols="4" colsep="0" rowsep="0">
50209 <colspec colwidth="8*" align="left"/>
50210 <colspec colwidth="6*" align="center"/>
50211 <colspec colwidth="6*" align="center"/>
50212 <colspec colwidth="6*" align="right"/>
50213 <tbody>
50214 <row>
50215 <entry><option>protocol</option></entry>
50216 <entry>Use: <emphasis>smtp</emphasis></entry>
50217 <entry>Type: <emphasis>string</emphasis></entry>
50218 <entry>Default: <emphasis>smtp</emphasis></entry>
50219 </row>
50220 </tbody>
50221 </tgroup>
50222 </informaltable>
50223 <para>
50224 <indexterm role="concept">
50225 <primary>LMTP</primary>
50226 <secondary>over TCP/IP</secondary>
50227 </indexterm>
50228 <indexterm role="concept">
50229 <primary>ssmtp protocol</primary>
50230 <secondary>outbound</secondary>
50231 </indexterm>
50232 <indexterm role="concept">
50233 <primary>TLS</primary>
50234 <secondary>SSL-on-connect outbound</secondary>
50235 </indexterm>
50236 <indexterm role="variable">
50237 <primary><varname>$port</varname></primary>
50238 </indexterm>
50239 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
50240 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
50241 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
50242 deliveries into closed message stores. Exim also has support for running LMTP
50243 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
50244 </para>
50245 <para>
50246 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
50247 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
50248 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
50249 The Internet standards bodies used to strongly discourage use of this mode,
50250 but as of RFC 8314 it is perferred over STARTTLS for message submission
50251 (as distinct from MTA-MTA communication).
50252 </para>
50253 <para>
50254 <indexterm role="option">
50255 <primary><option>retry_include_ip_address</option></primary>
50256 </indexterm>
50257 </para>
50258 <informaltable frame="all">
50259 <tgroup cols="4" colsep="0" rowsep="0">
50260 <colspec colwidth="8*" align="left"/>
50261 <colspec colwidth="6*" align="center"/>
50262 <colspec colwidth="6*" align="center"/>
50263 <colspec colwidth="6*" align="right"/>
50264 <tbody>
50265 <row>
50266 <entry><option>retry_include_ip_address</option></entry>
50267 <entry>Use: <emphasis>smtp</emphasis></entry>
50268 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
50269 <entry>Default: <emphasis>true</emphasis></entry>
50270 </row>
50271 </tbody>
50272 </tgroup>
50273 </informaltable>
50274 <para>
50275 Exim normally includes both the host name and the IP address in the key it
50276 constructs for indexing retry data after a temporary delivery failure. This
50277 means that when one of several IP addresses for a host is failing, it gets
50278 tried periodically (controlled by the retry rules), but use of the other IP
50279 addresses is not affected.
50280 </para>
50281 <para>
50282 However, in some dialup environments hosts are assigned a different IP address
50283 each time they connect. In this situation the use of the IP address as part of
50284 the retry key leads to undesirable behaviour. Setting this option false causes
50285 Exim to use only the host name.
50286 Since it is expanded it can be made to depend on the host or domain.
50287 </para>
50288 <para>
50289 <indexterm role="option">
50290 <primary><option>serialize_hosts</option></primary>
50291 </indexterm>
50292 </para>
50293 <informaltable frame="all">
50294 <tgroup cols="4" colsep="0" rowsep="0">
50295 <colspec colwidth="8*" align="left"/>
50296 <colspec colwidth="6*" align="center"/>
50297 <colspec colwidth="6*" align="center"/>
50298 <colspec colwidth="6*" align="right"/>
50299 <tbody>
50300 <row>
50301 <entry><option>serialize_hosts</option></entry>
50302 <entry>Use: <emphasis>smtp</emphasis></entry>
50303 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50304 <entry>Default: <emphasis>unset</emphasis></entry>
50305 </row>
50306 </tbody>
50307 </tgroup>
50308 </informaltable>
50309 <para>
50310 <indexterm role="concept">
50311 <primary>serializing connections</primary>
50312 </indexterm>
50313 <indexterm role="concept">
50314 <primary>host</primary>
50315 <secondary>serializing connections</secondary>
50316 </indexterm>
50317 Because Exim operates in a distributed manner, if several messages for the same
50318 host arrive at around the same time, more than one simultaneous connection to
50319 the remote host can occur. This is not usually a problem except when there is a
50320 slow link between the hosts. In that situation it may be helpful to restrict
50321 Exim to one connection at a time. This can be done by setting
50322 <option>serialize_hosts</option> to match the relevant hosts.
50323 </para>
50324 <para>
50325 <indexterm role="concept">
50326 <primary>hints database</primary>
50327 <secondary>serializing deliveries to a host</secondary>
50328 </indexterm>
50329 Exim implements serialization by means of a hints database in which a record is
50330 written whenever a process connects to one of the restricted hosts. The record
50331 is deleted when the connection is completed. Obviously there is scope for
50332 records to get left lying around if there is a system or program crash. To
50333 guard against this, Exim ignores any records that are more than six hours old.
50334 </para>
50335 <para>
50336 If you set up this kind of serialization, you should also arrange to delete the
50337 relevant hints database whenever your system reboots. The names of the files
50338 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
50339 may be one or two files, depending on the type of DBM in use. The same files
50340 are used for ETRN serialization.
50341 </para>
50342 <para>
50343 See also the <option>max_parallel</option> generic transport option.
50344 </para>
50345 <para>
50346 <indexterm role="option">
50347 <primary><option>size_addition</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>size_addition</option></entry>
50359 <entry>Use: <emphasis>smtp</emphasis></entry>
50360 <entry>Type: <emphasis>integer</emphasis></entry>
50361 <entry>Default: <emphasis>1024</emphasis></entry>
50362 </row>
50363 </tbody>
50364 </tgroup>
50365 </informaltable>
50366 <para>
50367 <indexterm role="concept">
50368 <primary>SIZE</primary>
50369 <secondary>ESMTP extension</secondary>
50370 </indexterm>
50371 <indexterm role="concept">
50372 <primary>message</primary>
50373 <secondary>size issue for transport filter</secondary>
50374 </indexterm>
50375 <indexterm role="concept">
50376 <primary>size</primary>
50377 <secondary>of message</secondary>
50378 </indexterm>
50379 <indexterm role="concept">
50380 <primary>transport</primary>
50381 <secondary>filter</secondary>
50382 </indexterm>
50383 <indexterm role="concept">
50384 <primary>filter</primary>
50385 <secondary>transport filter</secondary>
50386 </indexterm>
50387 If a remote SMTP server indicates that it supports the SIZE option of the
50388 MAIL command, Exim uses this to pass over the message size at the start of
50389 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
50390 sends, to allow for headers and other text that may be added during delivery by
50391 configuration options or in a transport filter. It may be necessary to increase
50392 this if a lot of text is added to messages.
50393 </para>
50394 <para>
50395 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
50396 the use of the SIZE option altogether.
50397 </para>
50398 <para>
50399 <indexterm role="option">
50400 <primary><option>socks_proxy</option></primary>
50401 </indexterm>
50402 </para>
50403 <informaltable frame="all">
50404 <tgroup cols="4" colsep="0" rowsep="0">
50405 <colspec colwidth="8*" align="left"/>
50406 <colspec colwidth="6*" align="center"/>
50407 <colspec colwidth="6*" align="center"/>
50408 <colspec colwidth="6*" align="right"/>
50409 <tbody>
50410 <row>
50411 <entry><option>socks_proxy</option></entry>
50412 <entry>Use: <emphasis>smtp</emphasis></entry>
50413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50414 <entry>Default: <emphasis>unset</emphasis></entry>
50415 </row>
50416 </tbody>
50417 </tgroup>
50418 </informaltable>
50419 <para>
50420 <indexterm role="concept">
50421 <primary>proxy</primary>
50422 <secondary>SOCKS</secondary>
50423 </indexterm>
50424 This option enables use of SOCKS proxies for connections made by the
50425 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
50426 </para>
50427 <para>
50428 <indexterm role="option">
50429 <primary><option>tls_certificate</option></primary>
50430 </indexterm>
50431 </para>
50432 <informaltable frame="all">
50433 <tgroup cols="4" colsep="0" rowsep="0">
50434 <colspec colwidth="8*" align="left"/>
50435 <colspec colwidth="6*" align="center"/>
50436 <colspec colwidth="6*" align="center"/>
50437 <colspec colwidth="6*" align="right"/>
50438 <tbody>
50439 <row>
50440 <entry><option>tls_certificate</option></entry>
50441 <entry>Use: <emphasis>smtp</emphasis></entry>
50442 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50443 <entry>Default: <emphasis>unset</emphasis></entry>
50444 </row>
50445 </tbody>
50446 </tgroup>
50447 </informaltable>
50448 <para>
50449 <indexterm role="concept">
50450 <primary>TLS</primary>
50451 <secondary>client certificate, location of</secondary>
50452 </indexterm>
50453 <indexterm role="concept">
50454 <primary>certificate</primary>
50455 <secondary>client, location of</secondary>
50456 </indexterm>
50457 <indexterm role="variable">
50458 <primary><varname>$host</varname></primary>
50459 </indexterm>
50460 <indexterm role="variable">
50461 <primary><varname>$host_address</varname></primary>
50462 </indexterm>
50463 The value of this option must be the absolute path to a file which contains the
50464 client&#x2019;s certificate, for possible use when sending a message over an encrypted
50465 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
50466 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
50467 details of TLS.
50468 </para>
50469 <para>
50470 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
50471 certificate when sending messages as a client. The global option of the same
50472 name specifies the certificate for Exim as a server; it is not automatically
50473 assumed that the same certificate should be used when Exim is operating as a
50474 client.
50475 </para>
50476 <para>
50477 <indexterm role="option">
50478 <primary><option>tls_crl</option></primary>
50479 </indexterm>
50480 </para>
50481 <informaltable frame="all">
50482 <tgroup cols="4" colsep="0" rowsep="0">
50483 <colspec colwidth="8*" align="left"/>
50484 <colspec colwidth="6*" align="center"/>
50485 <colspec colwidth="6*" align="center"/>
50486 <colspec colwidth="6*" align="right"/>
50487 <tbody>
50488 <row>
50489 <entry><option>tls_crl</option></entry>
50490 <entry>Use: <emphasis>smtp</emphasis></entry>
50491 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50492 <entry>Default: <emphasis>unset</emphasis></entry>
50493 </row>
50494 </tbody>
50495 </tgroup>
50496 </informaltable>
50497 <para>
50498 <indexterm role="concept">
50499 <primary>TLS</primary>
50500 <secondary>client certificate revocation list</secondary>
50501 </indexterm>
50502 <indexterm role="concept">
50503 <primary>certificate</primary>
50504 <secondary>revocation list for client</secondary>
50505 </indexterm>
50506 This option specifies a certificate revocation list. The expanded value must
50507 be the name of a file that contains a CRL in PEM format.
50508 </para>
50509 <para>
50510 <indexterm role="option">
50511 <primary><option>tls_dh_min_bits</option></primary>
50512 </indexterm>
50513 </para>
50514 <informaltable frame="all">
50515 <tgroup cols="4" colsep="0" rowsep="0">
50516 <colspec colwidth="8*" align="left"/>
50517 <colspec colwidth="6*" align="center"/>
50518 <colspec colwidth="6*" align="center"/>
50519 <colspec colwidth="6*" align="right"/>
50520 <tbody>
50521 <row>
50522 <entry><option>tls_dh_min_bits</option></entry>
50523 <entry>Use: <emphasis>smtp</emphasis></entry>
50524 <entry>Type: <emphasis>integer</emphasis></entry>
50525 <entry>Default: <emphasis>1024</emphasis></entry>
50526 </row>
50527 </tbody>
50528 </tgroup>
50529 </informaltable>
50530 <para>
50531 <indexterm role="concept">
50532 <primary>TLS</primary>
50533 <secondary>Diffie-Hellman minimum acceptable size</secondary>
50534 </indexterm>
50535 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
50536 key agreement is negotiated, the server will provide a large prime number
50537 for use.  This option establishes the minimum acceptable size of that number.
50538 If the parameter offered by the server is too small, then the TLS handshake
50539 will fail.
50540 </para>
50541 <para>
50542 Only supported when using GnuTLS.
50543 </para>
50544 <para>
50545 <indexterm role="option">
50546 <primary><option>tls_privatekey</option></primary>
50547 </indexterm>
50548 </para>
50549 <informaltable frame="all">
50550 <tgroup cols="4" colsep="0" rowsep="0">
50551 <colspec colwidth="8*" align="left"/>
50552 <colspec colwidth="6*" align="center"/>
50553 <colspec colwidth="6*" align="center"/>
50554 <colspec colwidth="6*" align="right"/>
50555 <tbody>
50556 <row>
50557 <entry><option>tls_privatekey</option></entry>
50558 <entry>Use: <emphasis>smtp</emphasis></entry>
50559 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50560 <entry>Default: <emphasis>unset</emphasis></entry>
50561 </row>
50562 </tbody>
50563 </tgroup>
50564 </informaltable>
50565 <para>
50566 <indexterm role="concept">
50567 <primary>TLS</primary>
50568 <secondary>client private key, location of</secondary>
50569 </indexterm>
50570 <indexterm role="variable">
50571 <primary><varname>$host</varname></primary>
50572 </indexterm>
50573 <indexterm role="variable">
50574 <primary><varname>$host_address</varname></primary>
50575 </indexterm>
50576 The value of this option must be the absolute path to a file which contains the
50577 client&#x2019;s private key. This is used when sending a message over an encrypted
50578 connection using a client certificate. The values of <varname>$host</varname> and
50579 <varname>$host_address</varname> are set to the name and address of the server during the
50580 expansion. If this option is unset, or the expansion is forced to fail, or the
50581 result is an empty string, the private key is assumed to be in the same file as
50582 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50583 </para>
50584 <para>
50585 <indexterm role="option">
50586 <primary><option>tls_require_ciphers</option></primary>
50587 </indexterm>
50588 </para>
50589 <informaltable frame="all">
50590 <tgroup cols="4" colsep="0" rowsep="0">
50591 <colspec colwidth="8*" align="left"/>
50592 <colspec colwidth="6*" align="center"/>
50593 <colspec colwidth="6*" align="center"/>
50594 <colspec colwidth="6*" align="right"/>
50595 <tbody>
50596 <row>
50597 <entry><option>tls_require_ciphers</option></entry>
50598 <entry>Use: <emphasis>smtp</emphasis></entry>
50599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50600 <entry>Default: <emphasis>unset</emphasis></entry>
50601 </row>
50602 </tbody>
50603 </tgroup>
50604 </informaltable>
50605 <para>
50606 <indexterm role="concept">
50607 <primary>TLS</primary>
50608 <secondary>requiring specific ciphers</secondary>
50609 </indexterm>
50610 <indexterm role="concept">
50611 <primary>cipher</primary>
50612 <secondary>requiring specific</secondary>
50613 </indexterm>
50614 <indexterm role="variable">
50615 <primary><varname>$host</varname></primary>
50616 </indexterm>
50617 <indexterm role="variable">
50618 <primary><varname>$host_address</varname></primary>
50619 </indexterm>
50620 The value of this option must be a list of permitted cipher suites, for use
50621 when setting up an outgoing encrypted connection. (There is a global option of
50622 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
50623 <varname>$host_address</varname> are set to the name and address of the server during the
50624 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
50625 is used in different ways by OpenSSL and GnuTLS (see sections
50626 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
50627 ciphers is a preference order.
50628 </para>
50629 <para>
50630 <indexterm role="option">
50631 <primary><option>tls_sni</option></primary>
50632 </indexterm>
50633 </para>
50634 <informaltable frame="all">
50635 <tgroup cols="4" colsep="0" rowsep="0">
50636 <colspec colwidth="8*" align="left"/>
50637 <colspec colwidth="6*" align="center"/>
50638 <colspec colwidth="6*" align="center"/>
50639 <colspec colwidth="6*" align="right"/>
50640 <tbody>
50641 <row>
50642 <entry><option>tls_sni</option></entry>
50643 <entry>Use: <emphasis>smtp</emphasis></entry>
50644 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50645 <entry>Default: <emphasis>unset</emphasis></entry>
50646 </row>
50647 </tbody>
50648 </tgroup>
50649 </informaltable>
50650 <para>
50651 <indexterm role="concept">
50652 <primary>TLS</primary>
50653 <secondary>Server Name Indication</secondary>
50654 </indexterm>
50655 <indexterm role="variable">
50656 <primary><varname>$tls_sni</varname></primary>
50657 </indexterm>
50658 If this option is set then it sets the $tls_out_sni variable and causes any
50659 TLS session to pass this value as the Server Name Indication extension to
50660 the remote side, which can be used by the remote side to select an appropriate
50661 certificate and private key for the session.
50662 </para>
50663 <para>
50664 See <xref linkend="SECTtlssni"/> for more information.
50665 </para>
50666 <para>
50667 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
50668 TLS extensions.
50669 </para>
50670 <para>
50671 <indexterm role="option">
50672 <primary><option>tls_tempfail_tryclear</option></primary>
50673 </indexterm>
50674 </para>
50675 <informaltable frame="all">
50676 <tgroup cols="4" colsep="0" rowsep="0">
50677 <colspec colwidth="8*" align="left"/>
50678 <colspec colwidth="6*" align="center"/>
50679 <colspec colwidth="6*" align="center"/>
50680 <colspec colwidth="6*" align="right"/>
50681 <tbody>
50682 <row>
50683 <entry><option>tls_tempfail_tryclear</option></entry>
50684 <entry>Use: <emphasis>smtp</emphasis></entry>
50685 <entry>Type: <emphasis>boolean</emphasis></entry>
50686 <entry>Default: <emphasis>true</emphasis></entry>
50687 </row>
50688 </tbody>
50689 </tgroup>
50690 </informaltable>
50691 <para>
50692 <indexterm role="concept">
50693 <primary>4<emphasis>xx</emphasis> responses</primary>
50694 <secondary>to STARTTLS</secondary>
50695 </indexterm>
50696 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
50697 setting up a TLS session, this option determines whether or not Exim should try
50698 to deliver the message unencrypted. If it is set false, delivery to the
50699 current host is deferred; if there are other hosts, they are tried. If this
50700 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
50701 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
50702 TLS negotiation fails, Exim closes the current connection (because it is in an
50703 unknown state), opens a new one to the same host, and then tries the delivery
50704 in clear.
50705 </para>
50706 <para>
50707 <indexterm role="option">
50708 <primary><option>tls_try_verify_hosts</option></primary>
50709 </indexterm>
50710 </para>
50711 <informaltable frame="all">
50712 <tgroup cols="4" colsep="0" rowsep="0">
50713 <colspec colwidth="8*" align="left"/>
50714 <colspec colwidth="6*" align="center"/>
50715 <colspec colwidth="6*" align="center"/>
50716 <colspec colwidth="6*" align="right"/>
50717 <tbody>
50718 <row>
50719 <entry><option>tls_try_verify_hosts</option></entry>
50720 <entry>Use: <emphasis>smtp</emphasis></entry>
50721 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50722 <entry>Default: <emphasis>*</emphasis></entry>
50723 </row>
50724 </tbody>
50725 </tgroup>
50726 </informaltable>
50727 <para>
50728 <indexterm role="concept">
50729 <primary>TLS</primary>
50730 <secondary>server certificate verification</secondary>
50731 </indexterm>
50732 <indexterm role="concept">
50733 <primary>certificate</primary>
50734 <secondary>verification of server</secondary>
50735 </indexterm>
50736 This option gives a list of hosts for which, on encrypted connections,
50737 certificate verification will be tried but need not succeed.
50738 The <option>tls_verify_certificates</option> option must also be set.
50739 Note that unless the host is in this list
50740 TLS connections will be denied to hosts using self-signed certificates
50741 when <option>tls_verify_certificates</option> is matched.
50742 The <varname>$tls_out_certificate_verified</varname> variable is set when
50743 certificate verification succeeds.
50744 </para>
50745 <para>
50746 <indexterm role="option">
50747 <primary><option>tls_verify_cert_hostnames</option></primary>
50748 </indexterm>
50749 </para>
50750 <informaltable frame="all">
50751 <tgroup cols="4" colsep="0" rowsep="0">
50752 <colspec colwidth="8*" align="left"/>
50753 <colspec colwidth="6*" align="center"/>
50754 <colspec colwidth="6*" align="center"/>
50755 <colspec colwidth="6*" align="right"/>
50756 <tbody>
50757 <row>
50758 <entry><option>tls_verify_cert_hostnames</option></entry>
50759 <entry>Use: <emphasis>smtp</emphasis></entry>
50760 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50761 <entry>Default: <emphasis>*</emphasis></entry>
50762 </row>
50763 </tbody>
50764 </tgroup>
50765 </informaltable>
50766 <para>
50767 <indexterm role="concept">
50768 <primary>TLS</primary>
50769 <secondary>server certificate hostname verification</secondary>
50770 </indexterm>
50771 <indexterm role="concept">
50772 <primary>certificate</primary>
50773 <secondary>verification of server</secondary>
50774 </indexterm>
50775 This option give a list of hosts for which,
50776 while verifying the server certificate,
50777 checks will be included on the host name
50778 (note that this will generally be the result of a DNS MX lookup)
50779 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
50780 limited to being the initial component of a 3-or-more component FQDN.
50781 </para>
50782 <para>
50783 There is no equivalent checking on client certificates.
50784 </para>
50785 <para>
50786 <indexterm role="option">
50787 <primary><option>tls_verify_certificates</option></primary>
50788 </indexterm>
50789 </para>
50790 <informaltable frame="all">
50791 <tgroup cols="4" colsep="0" rowsep="0">
50792 <colspec colwidth="8*" align="left"/>
50793 <colspec colwidth="6*" align="center"/>
50794 <colspec colwidth="6*" align="center"/>
50795 <colspec colwidth="6*" align="right"/>
50796 <tbody>
50797 <row>
50798 <entry><option>tls_verify_certificates</option></entry>
50799 <entry>Use: <emphasis>smtp</emphasis></entry>
50800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50801 <entry>Default: <emphasis>system</emphasis></entry>
50802 </row>
50803 </tbody>
50804 </tgroup>
50805 </informaltable>
50806 <para>
50807 <indexterm role="concept">
50808 <primary>TLS</primary>
50809 <secondary>server certificate verification</secondary>
50810 </indexterm>
50811 <indexterm role="concept">
50812 <primary>certificate</primary>
50813 <secondary>verification of server</secondary>
50814 </indexterm>
50815 <indexterm role="variable">
50816 <primary><varname>$host</varname></primary>
50817 </indexterm>
50818 <indexterm role="variable">
50819 <primary><varname>$host_address</varname></primary>
50820 </indexterm>
50821 The value of this option must be either the
50822 word "system"
50823 or the absolute path to
50824 a file or directory containing permitted certificates for servers,
50825 for use when setting up an encrypted connection.
50826 </para>
50827 <para>
50828 The "system" value for the option will use a location compiled into the SSL library.
50829 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
50830 is taken as empty and an explicit location
50831 must be specified.
50832 </para>
50833 <para>
50834 The use of a directory for the option value is not available for GnuTLS versions
50835 preceding 3.3.6 and a single file must be used.
50836 </para>
50837 <para>
50838 With OpenSSL the certificates specified
50839 explicitly
50840 either by file or directory
50841 are added to those given by the system default location.
50842 </para>
50843 <para>
50844 The values of <varname>$host</varname> and
50845 <varname>$host_address</varname> are set to the name and address of the server during the
50846 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50847 </para>
50848 <para>
50849 For back-compatibility,
50850 if neither tls_verify_hosts nor tls_try_verify_hosts are set
50851 (a single-colon empty list counts as being set)
50852 and certificate verification fails the TLS connection is closed.
50853 </para>
50854 <para>
50855 <indexterm role="option">
50856 <primary><option>tls_verify_hosts</option></primary>
50857 </indexterm>
50858 </para>
50859 <informaltable frame="all">
50860 <tgroup cols="4" colsep="0" rowsep="0">
50861 <colspec colwidth="8*" align="left"/>
50862 <colspec colwidth="6*" align="center"/>
50863 <colspec colwidth="6*" align="center"/>
50864 <colspec colwidth="6*" align="right"/>
50865 <tbody>
50866 <row>
50867 <entry><option>tls_verify_hosts</option></entry>
50868 <entry>Use: <emphasis>smtp</emphasis></entry>
50869 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50870 <entry>Default: <emphasis>unset</emphasis></entry>
50871 </row>
50872 </tbody>
50873 </tgroup>
50874 </informaltable>
50875 <para>
50876 <indexterm role="concept">
50877 <primary>TLS</primary>
50878 <secondary>server certificate verification</secondary>
50879 </indexterm>
50880 <indexterm role="concept">
50881 <primary>certificate</primary>
50882 <secondary>verification of server</secondary>
50883 </indexterm>
50884 This option gives a list of hosts for which, on encrypted connections,
50885 certificate verification must succeed.
50886 The <option>tls_verify_certificates</option> option must also be set.
50887 If both this option and <option>tls_try_verify_hosts</option> are unset
50888 operation is as if this option selected all hosts.
50889 </para>
50890 <para>
50891 <indexterm role="option">
50892 <primary><option>utf8_downconvert</option></primary>
50893 </indexterm>
50894 </para>
50895 <informaltable frame="all">
50896 <tgroup cols="4" colsep="0" rowsep="0">
50897 <colspec colwidth="8*" align="left"/>
50898 <colspec colwidth="6*" align="center"/>
50899 <colspec colwidth="6*" align="center"/>
50900 <colspec colwidth="6*" align="right"/>
50901 <tbody>
50902 <row>
50903 <entry><option>utf8_downconvert</option></entry>
50904 <entry>Use: <emphasis>smtp</emphasis></entry>
50905 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
50906 <entry>Default: <emphasis>-1</emphasis></entry>
50907 </row>
50908 </tbody>
50909 </tgroup>
50910 </informaltable>
50911 <para>
50912 <indexterm role="concept">
50913 <primary>utf8</primary>
50914 <secondary>address downconversion</secondary>
50915 </indexterm>
50916 <indexterm role="concept">
50917 <primary>i18n</primary>
50918 <secondary>utf8 address downconversion</secondary>
50919 </indexterm>
50920 If built with internationalization support,
50921 this option controls conversion of UTF-8 in message envelope addresses
50922 to a-label form.
50923 If, after expansion, the value is 1, 0, or -1 then this value overrides
50924 any value previously set for the message.  Otherwise, any previously
50925 set value is used.  To permit use of a previous value,
50926 set this option to an empty string.
50927 For details on the values see section <xref linkend="SECTi18nMTA"/>.
50928 </para>
50929 </section>
50930 <section id="SECTvalhosmax">
50931 <title>How the limits for the number of hosts to try are used</title>
50932 <para>
50933 <indexterm role="concept">
50934 <primary>host</primary>
50935 <secondary>maximum number to try</secondary>
50936 </indexterm>
50937 <indexterm role="concept">
50938 <primary>limit</primary>
50939 <secondary>hosts; maximum number tried</secondary>
50940 </indexterm>
50941 There are two options that are concerned with the number of hosts that are
50942 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
50943 <option>hosts_max_try_hardlimit</option>.
50944 </para>
50945 <para>
50946 The <option>hosts_max_try</option> option limits the number of hosts that are tried
50947 for a single delivery. However, despite the term <quote>host</quote> in its name, the
50948 option actually applies to each IP address independently. In other words, a
50949 multihomed host is treated as several independent hosts, just as it is for
50950 retrying.
50951 </para>
50952 <para>
50953 Many of the larger ISPs have multiple MX records which often point to
50954 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
50955 created as a result of routing one of these domains.
50956 </para>
50957 <para>
50958 Trying every single IP address on such a long list does not seem sensible; if
50959 several at the top of the list fail, it is reasonable to assume there is some
50960 problem that is likely to affect all of them. Roughly speaking, the value of
50961 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
50962 delivery. However, the logic cannot be quite that simple.
50963 </para>
50964 <para>
50965 Firstly, IP addresses that are skipped because their retry times have not
50966 arrived do not count, and in addition, addresses that are past their retry
50967 limits are also not counted, even when they are tried. This means that when
50968 some IP addresses are past their retry limits, more than the value of
50969 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
50970 that all IP addresses are considered before timing out an email address (but
50971 see below for an exception).
50972 </para>
50973 <para>
50974 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
50975 list to see if there is a subsequent host with a different (higher valued) MX.
50976 If there is, that host is considered next, and the current IP address is used
50977 but not counted. This behaviour helps in the case of a domain with a retry rule
50978 that hardly ever delays any hosts, as is now explained:
50979 </para>
50980 <para>
50981 Consider the case of a long list of hosts with one MX value, and a few with a
50982 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
50983 hosts at the top of the list are tried at first. With the default retry rule,
50984 which specifies increasing retry times, the higher MX hosts are eventually
50985 tried when those at the top of the list are skipped because they have not
50986 reached their retry times.
50987 </para>
50988 <para>
50989 However, it is common practice to put a fixed short retry time on domains for
50990 large ISPs, on the grounds that their servers are rarely down for very long.
50991 Unfortunately, these are exactly the domains that tend to resolve to long lists
50992 of hosts. The short retry time means that the lowest MX hosts are tried every
50993 time. The attempts may be in a different order because of random sorting, but
50994 without the special MX check, the higher MX hosts would never be tried until
50995 all the lower MX hosts had timed out (which might be several days), because
50996 there are always some lower MX hosts that have reached their retry times. With
50997 the special check, Exim considers at least one IP address from each MX value at
50998 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
50999 reached.
51000 </para>
51001 <para>
51002 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
51003 particular, Exim normally eventually tries all the IP addresses before timing
51004 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
51005 reasonable thing to do. Recently, however, some lunatic DNS configurations have
51006 been set up with hundreds of IP addresses for some domains. It can
51007 take a very long time indeed for an address to time out in these cases.
51008 </para>
51009 <para>
51010 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
51011 Exim never tries more than this number of IP addresses; if it hits this limit
51012 and they are all timed out, the email address is bounced, even though not all
51013 possible IP addresses have been tried.
51014 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
51015 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
51016 </para>
51017 </section>
51018 </chapter>
51019
51020 <chapter id="CHAPrewrite">
51021 <title>Address rewriting</title>
51022 <para>
51023 <indexterm role="concept" id="IIDaddrew" class="startofrange">
51024 <primary>rewriting</primary>
51025 <secondary>addresses</secondary>
51026 </indexterm>
51027 There are some circumstances in which Exim automatically rewrites domains in
51028 addresses. The two most common are when an address is given without a domain
51029 (referred to as an <quote>unqualified address</quote>) or when an address contains an
51030 abbreviated domain that is expanded by DNS lookup.
51031 </para>
51032 <para>
51033 Unqualified envelope addresses are accepted only for locally submitted
51034 messages, or for messages that are received from hosts matching
51035 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
51036 appropriate. Unqualified addresses in header lines are qualified if they are in
51037 locally submitted messages, or messages from hosts that are permitted to send
51038 unqualified envelope addresses. Otherwise, unqualified addresses in header
51039 lines are neither qualified nor rewritten.
51040 </para>
51041 <para>
51042 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
51043 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
51044 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
51045 do this. The new RFCs do not contain this suggestion.
51046 </para>
51047 <section id="SECID147">
51048 <title>Explicitly configured address rewriting</title>
51049 <para>
51050 This chapter describes the rewriting rules that can be used in the
51051 main rewrite section of the configuration file, and also in the generic
51052 <option>headers_rewrite</option> option that can be set on any transport.
51053 </para>
51054 <para>
51055 Some people believe that configured address rewriting is a Mortal Sin.
51056 Others believe that life is not possible without it. Exim provides the
51057 facility; you do not have to use it.
51058 </para>
51059 <para>
51060 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
51061 configuration file are applied to addresses in incoming messages, both envelope
51062 addresses and addresses in header lines. Each rule specifies the types of
51063 address to which it applies.
51064 </para>
51065 <para>
51066 Whether or not addresses in header lines are rewritten depends on the origin of
51067 the headers and the type of rewriting. Global rewriting, that is, rewriting
51068 rules from the rewrite section of the configuration file, is applied only to
51069 those headers that were received with the message. Header lines that are added
51070 by ACLs or by a system filter or by individual routers or transports (which
51071 are specific to individual recipient addresses) are not rewritten by the global
51072 rules.
51073 </para>
51074 <para>
51075 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
51076 applies all headers except those added by routers and transports. That is, as
51077 well as the headers that were received with the message, it also applies to
51078 headers that were added by an ACL or a system filter.
51079 </para>
51080 <para>
51081 In general, rewriting addresses from your own system or domain has some
51082 legitimacy. Rewriting other addresses should be done only with great care and
51083 in special circumstances. The author of Exim believes that rewriting should be
51084 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
51085 Although it can sometimes be used as a routing tool, this is very strongly
51086 discouraged.
51087 </para>
51088 <para>
51089 There are two commonly encountered circumstances where rewriting is used, as
51090 illustrated by these examples:
51091 </para>
51092 <itemizedlist>
51093 <listitem>
51094 <para>
51095 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
51096 exchange mail with each other behind a firewall, but there is only a single
51097 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
51098 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
51099 </para>
51100 </listitem>
51101 <listitem>
51102 <para>
51103 A host rewrites the local parts of its own users so that, for example,
51104 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
51105 </para>
51106 </listitem>
51107 </itemizedlist>
51108 </section>
51109 <section id="SECID148">
51110 <title>When does rewriting happen?</title>
51111 <para>
51112 <indexterm role="concept">
51113 <primary>rewriting</primary>
51114 <secondary>timing of</secondary>
51115 </indexterm>
51116 <indexterm role="concept">
51117 <primary>access control lists (ACLs)</primary>
51118 <secondary>rewriting addresses in</secondary>
51119 </indexterm>
51120 Configured address rewriting can take place at several different stages of a
51121 message&#x2019;s processing.
51122 </para>
51123 <para>
51124 <indexterm role="variable">
51125 <primary><varname>$sender_address</varname></primary>
51126 </indexterm>
51127 At the start of an ACL for MAIL, the sender address may have been rewritten
51128 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
51129 ordinary rewrite rules have yet been applied. If, however, the sender address
51130 is verified in the ACL, it is rewritten before verification, and remains
51131 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
51132 rewritten address. This also applies if sender verification happens in a
51133 RCPT ACL. Otherwise, when the sender address is not verified, it is
51134 rewritten as soon as a message&#x2019;s header lines have been received.
51135 </para>
51136 <para>
51137 <indexterm role="variable">
51138 <primary><varname>$domain</varname></primary>
51139 </indexterm>
51140 <indexterm role="variable">
51141 <primary><varname>$local_part</varname></primary>
51142 </indexterm>
51143 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
51144 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
51145 rewrite rules have yet been applied to it. However, the behaviour is different
51146 from the sender address when a recipient is verified. The address is rewritten
51147 for the verification, but the rewriting is not remembered at this stage. The
51148 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
51149 as they were before (that is, they contain the unrewritten &ndash; except for
51150 SMTP-time rewriting &ndash; address).
51151 </para>
51152 <para>
51153 As soon as a message&#x2019;s header lines have been received, all the envelope
51154 recipient addresses are permanently rewritten, and rewriting is also applied to
51155 the addresses in the header lines (if configured). This happens before adding
51156 any header lines that were specified in MAIL or RCPT ACLs, and
51157 <indexterm role="concept">
51158 <primary><function>local_scan()</function> function</primary>
51159 <secondary>address rewriting; timing of</secondary>
51160 </indexterm>
51161 before the DATA ACL and <function>local_scan()</function> functions are run.
51162 </para>
51163 <para>
51164 When an address is being routed, either for delivery or for verification,
51165 rewriting is applied immediately to child addresses that are generated by
51166 redirection, unless <option>no_rewrite</option> is set on the router.
51167 </para>
51168 <para>
51169 <indexterm role="concept">
51170 <primary>envelope from</primary>
51171 </indexterm>
51172 <indexterm role="concept">
51173 <primary>envelope sender</primary>
51174 <secondary>rewriting at transport time</secondary>
51175 </indexterm>
51176 <indexterm role="concept">
51177 <primary>rewriting</primary>
51178 <secondary>at transport time</secondary>
51179 </indexterm>
51180 <indexterm role="concept">
51181 <primary>header lines</primary>
51182 <secondary>rewriting at transport time</secondary>
51183 </indexterm>
51184 At transport time, additional rewriting of addresses in header lines can be
51185 specified by setting the generic <option>headers_rewrite</option> option on a transport.
51186 This option contains rules that are identical in form to those in the rewrite
51187 section of the configuration file. They are applied to the original message
51188 header lines and any that were added by ACLs or a system filter. They are not
51189 applied to header lines that are added by routers or the transport.
51190 </para>
51191 <para>
51192 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
51193 transport option. However, it is not possible to rewrite envelope recipients at
51194 transport time.
51195 </para>
51196 </section>
51197 <section id="SECID149">
51198 <title>Testing the rewriting rules that apply on input</title>
51199 <para>
51200 <indexterm role="concept">
51201 <primary>rewriting</primary>
51202 <secondary>testing</secondary>
51203 </indexterm>
51204 <indexterm role="concept">
51205 <primary>testing</primary>
51206 <secondary>rewriting</secondary>
51207 </indexterm>
51208 Exim&#x2019;s input rewriting configuration appears in a part of the runtime
51209 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
51210 <option>-brw</option> command line option. This takes an address (which can be a full RFC
51211 2822 address) as its argument. The output is a list of how the address would be
51212 transformed by the rewriting rules for each of the different places it might
51213 appear in an incoming message, that is, for each different header and for the
51214 envelope sender and recipient fields. For example,
51215 </para>
51216 <literallayout class="monospaced">
51217 exim -brw ph10@exim.workshop.example
51218 </literallayout>
51219 <para>
51220 might produce the output
51221 </para>
51222 <literallayout class="monospaced">
51223 sender: Philip.Hazel@exim.workshop.example
51224 from: Philip.Hazel@exim.workshop.example
51225 to: ph10@exim.workshop.example
51226 cc: ph10@exim.workshop.example
51227 bcc: ph10@exim.workshop.example
51228 reply-to: Philip.Hazel@exim.workshop.example
51229 env-from: Philip.Hazel@exim.workshop.example
51230 env-to: ph10@exim.workshop.example
51231 </literallayout>
51232 <para>
51233 which shows that rewriting has been set up for that address when used in any of
51234 the source fields, but not when it appears as a recipient address. At the
51235 present time, there is no equivalent way of testing rewriting rules that are
51236 set for a particular transport.
51237 </para>
51238 </section>
51239 <section id="SECID150">
51240 <title>Rewriting rules</title>
51241 <para>
51242 <indexterm role="concept">
51243 <primary>rewriting</primary>
51244 <secondary>rules</secondary>
51245 </indexterm>
51246 The rewrite section of the configuration file consists of lines of rewriting
51247 rules in the form
51248 </para>
51249 <literallayout>
51250 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
51251 </literallayout>
51252 <para>
51253 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
51254 transport option are given as a colon-separated list. Each item in the list
51255 takes the same form as a line in the main rewriting configuration (except that
51256 any colons must be doubled, of course).
51257 </para>
51258 <para>
51259 The formats of source patterns and replacement strings are described below.
51260 Each is terminated by white space, unless enclosed in double quotes, in which
51261 case normal quoting conventions apply inside the quotes. The flags are single
51262 characters which may appear in any order. Spaces and tabs between them are
51263 ignored.
51264 </para>
51265 <para>
51266 For each address that could potentially be rewritten, the rules are scanned in
51267 order, and replacements for the address from earlier rules can themselves be
51268 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
51269 </para>
51270 <para>
51271 The order in which addresses are rewritten is undefined, may change between
51272 releases, and must not be relied on, with one exception: when a message is
51273 received, the envelope sender is always rewritten first, before any header
51274 lines are rewritten. For example, the replacement string for a rewrite of an
51275 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
51276 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
51277 that the envelope sender has already been rewritten.
51278 </para>
51279 <para>
51280 <indexterm role="variable">
51281 <primary><varname>$domain</varname></primary>
51282 </indexterm>
51283 <indexterm role="variable">
51284 <primary><varname>$local_part</varname></primary>
51285 </indexterm>
51286 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
51287 string to refer to the address that is being rewritten. Note that lookup-driven
51288 rewriting can be done by a rule of the form
51289 </para>
51290 <literallayout class="monospaced">
51291 *@*   ${lookup ...
51292 </literallayout>
51293 <para>
51294 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
51295 refer to the address that is being rewritten.
51296 </para>
51297 </section>
51298 <section id="SECID151">
51299 <title>Rewriting patterns</title>
51300 <para>
51301 <indexterm role="concept">
51302 <primary>rewriting</primary>
51303 <secondary>patterns</secondary>
51304 </indexterm>
51305 <indexterm role="concept">
51306 <primary>address list</primary>
51307 <secondary>in a rewriting pattern</secondary>
51308 </indexterm>
51309 The source pattern in a rewriting rule is any item which may appear in an
51310 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
51311 single-item address list, which means that it is expanded before being tested
51312 against the address. As always, if you use a regular expression as a pattern,
51313 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
51314 facility to suppress string expansion within the regular expression.
51315 </para>
51316 <para>
51317 Domains in patterns should be given in lower case. Local parts in patterns are
51318 case-sensitive. If you want to do case-insensitive matching of local parts, you
51319 can use a regular expression that starts with <literal>^(?i)</literal>.
51320 </para>
51321 <para>
51322 <indexterm role="concept">
51323 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51324 <secondary>in rewriting rules</secondary>
51325 </indexterm>
51326 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
51327 depending on the type of match which occurred. These can be used in the
51328 replacement string to insert portions of the incoming address. <varname>$0</varname> always
51329 refers to the complete incoming address. When a regular expression is used, the
51330 numerical variables are set from its capturing subexpressions. For other types
51331 of pattern they are set as follows:
51332 </para>
51333 <itemizedlist>
51334 <listitem>
51335 <para>
51336 If a local part or domain starts with an asterisk, the numerical variables
51337 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
51338 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
51339 pattern
51340 </para>
51341 <literallayout class="monospaced">
51342 *queen@*.fict.example
51343 </literallayout>
51344 <para>
51345 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
51346 </para>
51347 <literallayout class="monospaced">
51348 $0 = hearts-queen@wonderland.fict.example
51349 $1 = hearts-
51350 $2 = wonderland
51351 </literallayout>
51352 <para>
51353 Note that if the local part does not start with an asterisk, but the domain
51354 does, it is <varname>$1</varname> that contains the wild part of the domain.
51355 </para>
51356 </listitem>
51357 <listitem>
51358 <para>
51359 If the domain part of the pattern is a partial lookup, the wild and fixed parts
51360 of the domain are placed in the next available numerical variables. Suppose,
51361 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
51362 rewriting rule of the form
51363 </para>
51364 <literallayout>
51365 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
51366 </literallayout>
51367 <para>
51368 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
51369 </para>
51370 <literallayout class="monospaced">
51371 $1 = foo
51372 $2 = bar
51373 $3 = baz.example
51374 </literallayout>
51375 <para>
51376 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
51377 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
51378 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
51379 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
51380 whole domain. For non-partial domain lookups, no numerical variables are set.
51381 </para>
51382 </listitem>
51383 </itemizedlist>
51384 </section>
51385 <section id="SECID152">
51386 <title>Rewriting replacements</title>
51387 <para>
51388 <indexterm role="concept">
51389 <primary>rewriting</primary>
51390 <secondary>replacements</secondary>
51391 </indexterm>
51392 If the replacement string for a rule is a single asterisk, addresses that
51393 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
51394 rewriting rules are scanned. For example,
51395 </para>
51396 <literallayout class="monospaced">
51397 hatta@lookingglass.fict.example  *  f
51398 </literallayout>
51399 <para>
51400 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
51401 <emphasis>From:</emphasis> headers.
51402 </para>
51403 <para>
51404 <indexterm role="variable">
51405 <primary><varname>$domain</varname></primary>
51406 </indexterm>
51407 <indexterm role="variable">
51408 <primary><varname>$local_part</varname></primary>
51409 </indexterm>
51410 If the replacement string is not a single asterisk, it is expanded, and must
51411 yield a fully qualified address. Within the expansion, the variables
51412 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
51413 Any letters they contain retain their original case &ndash; they are not lower
51414 cased. The numerical variables are set up according to the type of pattern that
51415 matched the address, as described above. If the expansion is forced to fail by
51416 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
51417 current rule is abandoned, but subsequent rules may take effect. Any other
51418 expansion failure causes the entire rewriting operation to be abandoned, and an
51419 entry written to the panic log.
51420 </para>
51421 </section>
51422 <section id="SECID153">
51423 <title>Rewriting flags</title>
51424 <para>
51425 There are three different kinds of flag that may appear on rewriting rules:
51426 </para>
51427 <itemizedlist>
51428 <listitem>
51429 <para>
51430 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
51431 c, f, h, r, s, t.
51432 </para>
51433 </listitem>
51434 <listitem>
51435 <para>
51436 A flag that specifies rewriting at SMTP time: S.
51437 </para>
51438 </listitem>
51439 <listitem>
51440 <para>
51441 Flags that control the rewriting process: Q, q, R, w.
51442 </para>
51443 </listitem>
51444 </itemizedlist>
51445 <para>
51446 For rules that are part of the <option>headers_rewrite</option> generic transport option,
51447 E, F, T, and S are not permitted.
51448 </para>
51449 </section>
51450 <section id="SECID154">
51451 <title>Flags specifying which headers and envelope addresses to rewrite</title>
51452 <para>
51453 <indexterm role="concept">
51454 <primary>rewriting</primary>
51455 <secondary>flags</secondary>
51456 </indexterm>
51457 If none of the following flag letters, nor the <quote>S</quote> flag (see section
51458 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
51459 and to both the sender and recipient fields of the envelope, whereas a
51460 transport-time rewriting rule just applies to all headers. Otherwise, the
51461 rewriting rule is skipped unless the relevant addresses are being processed.
51462 </para>
51463 <literallayout>
51464 <literal>E</literal>       rewrite all envelope fields
51465 <literal>F</literal>       rewrite the envelope From field
51466 <literal>T</literal>       rewrite the envelope To field
51467 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
51468 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
51469 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
51470 <literal>h</literal>       rewrite all headers
51471 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
51472 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
51473 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
51474 </literallayout>
51475 <para>
51476 "All headers" means all of the headers listed above that can be selected
51477 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
51478 other headers such as <emphasis>Subject:</emphasis> etc.
51479 </para>
51480 <para>
51481 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
51482 restrict this to special known cases in your own domains.
51483 </para>
51484 </section>
51485 <section id="SECTrewriteS">
51486 <title>The SMTP-time rewriting flag</title>
51487 <para>
51488 <indexterm role="concept">
51489 <primary>SMTP</primary>
51490 <secondary>rewriting malformed addresses</secondary>
51491 </indexterm>
51492 <indexterm role="concept">
51493 <primary>RCPT</primary>
51494 <secondary>rewriting argument of</secondary>
51495 </indexterm>
51496 <indexterm role="concept">
51497 <primary>MAIL</primary>
51498 <secondary>rewriting argument of</secondary>
51499 </indexterm>
51500 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
51501 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
51502 before any other processing; even before syntax checking. The pattern is
51503 required to be a regular expression, and it is matched against the whole of the
51504 data for the command, including any surrounding angle brackets.
51505 </para>
51506 <para>
51507 <indexterm role="variable">
51508 <primary><varname>$domain</varname></primary>
51509 </indexterm>
51510 <indexterm role="variable">
51511 <primary><varname>$local_part</varname></primary>
51512 </indexterm>
51513 This form of rewrite rule allows for the handling of addresses that are not
51514 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
51515 input). Because the input is not required to be a syntactically valid address,
51516 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
51517 expansion of the replacement string. The result of rewriting replaces the
51518 original address in the MAIL or RCPT command.
51519 </para>
51520 </section>
51521 <section id="SECID155">
51522 <title>Flags controlling the rewriting process</title>
51523 <para>
51524 There are four flags which control the way the rewriting process works. These
51525 take effect only when a rule is invoked, that is, when the address is of the
51526 correct type (matches the flags) and matches the pattern:
51527 </para>
51528 <itemizedlist>
51529 <listitem>
51530 <para>
51531 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
51532 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
51533 absence of <quote>Q</quote> the rewritten address must always include a domain.
51534 </para>
51535 </listitem>
51536 <listitem>
51537 <para>
51538 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
51539 even if no rewriting actually takes place because of a <quote>fail</quote> in the
51540 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
51541 (does not match the flags) or does not match the pattern.
51542 </para>
51543 </listitem>
51544 <listitem>
51545 <para>
51546 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
51547 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
51548 rewriting once it fails to match (after at least one successful rewrite).
51549 </para>
51550 </listitem>
51551 <listitem>
51552 <para>
51553 <indexterm role="concept">
51554 <primary>rewriting</primary>
51555 <secondary>whole addresses</secondary>
51556 </indexterm>
51557 When an address in a header is rewritten, the rewriting normally applies only
51558 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
51559 left unchanged. For example, rewriting might change
51560 </para>
51561 <literallayout class="monospaced">
51562 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
51563 </literallayout>
51564 <para>
51565 into
51566 </para>
51567 <literallayout class="monospaced">
51568 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
51569 </literallayout>
51570 <para>
51571 <indexterm role="concept">
51572 <primary>RFC 2047</primary>
51573 </indexterm>
51574 Sometimes there is a need to replace the whole address item, and this can be
51575 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
51576 causes an address in a header line to be rewritten, the entire address is
51577 replaced, not just the working part. The replacement must be a complete RFC
51578 2822 address, including the angle brackets if necessary. If text outside angle
51579 brackets contains a character whose value is greater than 126 or less than 32
51580 (except for tab), the text is encoded according to RFC 2047. The character set
51581 is taken from <option>headers_charset</option>, which gets its default at build time.
51582 </para>
51583 <para>
51584 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
51585 rewritten, all but the working part of the replacement address is discarded.
51586 </para>
51587 </listitem>
51588 </itemizedlist>
51589 </section>
51590 <section id="SECID156">
51591 <title>Rewriting examples</title>
51592 <para>
51593 Here is an example of the two common rewriting paradigms:
51594 </para>
51595 <literallayout class="monospaced">
51596 *@*.hitch.fict.example  $1@hitch.fict.example
51597 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
51598                      {$value}fail}@hitch.fict.example bctfrF
51599 </literallayout>
51600 <para>
51601 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
51602 the string expansion to fail if the lookup does not succeed. In this context it
51603 has the effect of leaving the original address unchanged, but Exim goes on to
51604 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
51605 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
51606 explicitly, which would cause the rewritten address to be the same as before,
51607 at the cost of a small bit of processing. Not supplying either of these is an
51608 error, since the rewritten address would then contain no local part.
51609 </para>
51610 <para>
51611 The first example above replaces the domain with a superior, more general
51612 domain. This may not be desirable for certain local parts. If the rule
51613 </para>
51614 <literallayout class="monospaced">
51615 root@*.hitch.fict.example  *
51616 </literallayout>
51617 <para>
51618 were inserted before the first rule, rewriting would be suppressed for the
51619 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
51620 </para>
51621 <para>
51622 Rewriting can be made conditional on a number of tests, by making use of
51623 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
51624 messages that originate outside the local host:
51625 </para>
51626 <literallayout class="monospaced">
51627 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
51628                          {$1@hitch.fict.example}fail}"
51629 </literallayout>
51630 <para>
51631 The replacement string is quoted in this example because it contains white
51632 space.
51633 </para>
51634 <para>
51635 <indexterm role="concept">
51636 <primary>rewriting</primary>
51637 <secondary>bang paths</secondary>
51638 </indexterm>
51639 <indexterm role="concept">
51640 <primary>bang paths</primary>
51641 <secondary>rewriting</secondary>
51642 </indexterm>
51643 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
51644 an address it treats it as an unqualified local part which it qualifies with
51645 the local qualification domain (if the source of the message is local or if the
51646 remote host is permitted to send unqualified addresses). Rewriting can
51647 sometimes be used to handle simple bang paths with a fixed number of
51648 components. For example, the rule
51649 </para>
51650 <literallayout class="monospaced">
51651 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
51652 </literallayout>
51653 <para>
51654 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
51655 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
51656 a global rewriting rule for envelope addresses. It can provide a backdoor
51657 method for using your system as a relay, because the incoming addresses appear
51658 to be local. If the bang path addresses are received via SMTP, it is safer to
51659 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
51660 can be done on the rewritten addresses.
51661 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
51662 </para>
51663 </section>
51664 </chapter>
51665
51666 <chapter id="CHAPretry">
51667 <title>Retry configuration</title>
51668 <para>
51669 <indexterm role="concept" id="IIDretconf1" class="startofrange">
51670 <primary>retry</primary>
51671 <secondary>configuration, description of</secondary>
51672 </indexterm>
51673 <indexterm role="concept" id="IIDregconf2" class="startofrange">
51674 <primary>configuration file</primary>
51675 <secondary>retry section</secondary>
51676 </indexterm>
51677 The <quote>retry</quote> section of the runtime configuration file contains a list of
51678 retry rules that control how often Exim tries to deliver messages that cannot
51679 be delivered at the first attempt. If there are no retry rules (the section is
51680 empty or not present), there are no retries. In this situation, temporary
51681 errors are treated as permanent. The default configuration contains a single,
51682 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
51683 line option can be used to test which retry rule will be used for a given
51684 address, domain and error.
51685 </para>
51686 <para>
51687 The most common cause of retries is temporary failure to deliver to a remote
51688 host because the host is down, or inaccessible because of a network problem.
51689 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
51690 address) basis, not on a per-message basis. Thus, if one message has recently
51691 been delayed, delivery of a new message to the same host is not immediately
51692 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
51693 log selector is set, the message
51694 <indexterm role="concept">
51695 <primary>retry</primary>
51696 <secondary>time not reached</secondary>
51697 </indexterm>
51698 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
51699 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
51700 the handling of errors during remote deliveries.
51701 </para>
51702 <para>
51703 Retry processing applies to routing as well as to delivering, except as covered
51704 in the next paragraph. The retry rules do not distinguish between these
51705 actions. It is not possible, for example, to specify different behaviour for
51706 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
51707 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
51708 added complication, so did not implement it. However, although they share the
51709 same retry rule, the actual retry times for routing and transporting a given
51710 domain are maintained independently.
51711 </para>
51712 <para>
51713 When a delivery is not part of a queue run (typically an immediate delivery on
51714 receipt of a message), the routers are always run, and local deliveries are
51715 always attempted, even if retry times are set for them. This makes for better
51716 behaviour if one particular message is causing problems (for example, causing
51717 quota overflow, or provoking an error in a filter file). If such a delivery
51718 suffers a temporary failure, the retry data is updated as normal, and
51719 subsequent delivery attempts from queue runs occur only when the retry time for
51720 the local address is reached.
51721 </para>
51722 <section id="SECID157">
51723 <title>Changing retry rules</title>
51724 <para>
51725 If you change the retry rules in your configuration, you should consider
51726 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
51727 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
51728 always safe; that is why they are called <quote>hints</quote>.
51729 </para>
51730 <para>
51731 The hints retry data contains suggested retry times based on the previous
51732 rules. In the case of a long-running problem with a remote host, it might
51733 record the fact that the host has timed out. If your new rules increase the
51734 timeout time for such a host, you should definitely remove the old retry data
51735 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
51736 messages that it should now be retaining.
51737 </para>
51738 </section>
51739 <section id="SECID158">
51740 <title>Format of retry rules</title>
51741 <para>
51742 <indexterm role="concept">
51743 <primary>retry</primary>
51744 <secondary>rules</secondary>
51745 </indexterm>
51746 Each retry rule occupies one line and consists of three or four parts,
51747 separated by white space: a pattern, an error name, an optional list of sender
51748 addresses, and a list of retry parameters. The pattern and sender lists must be
51749 enclosed in double quotes if they contain white space. The rules are searched
51750 in order until one is found where the pattern, error name, and sender list (if
51751 present) match the failing host or address, the error that occurred, and the
51752 message&#x2019;s sender, respectively.
51753 </para>
51754 <para>
51755 The pattern is any single item that may appear in an address list (see section
51756 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
51757 which means that it is expanded before being tested against the address that
51758 has been delayed. A negated address list item is permitted. Address
51759 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
51760 which makes it possible for many retry rules to start with just a domain. For
51761 example,
51762 </para>
51763 <literallayout class="monospaced">
51764 lookingglass.fict.example        *  F,24h,30m;
51765 </literallayout>
51766 <para>
51767 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
51768 whereas
51769 </para>
51770 <literallayout class="monospaced">
51771 alice@lookingglass.fict.example  *  F,24h,30m;
51772 </literallayout>
51773 <para>
51774 applies only to temporary failures involving the local part <option>alice</option>.
51775 In practice, almost all rules start with a domain name pattern without a local
51776 part.
51777 </para>
51778 <para>
51779 <indexterm role="concept">
51780 <primary>regular expressions</primary>
51781 <secondary>in retry rules</secondary>
51782 </indexterm>
51783 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
51784 must match a complete address, not just a domain, because that is how regular
51785 expressions work in address lists.
51786 </para>
51787 <literallayout>
51788 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
51789 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
51790 </literallayout>
51791 </section>
51792 <section id="SECID159">
51793 <title>Choosing which retry rule to use for address errors</title>
51794 <para>
51795 When Exim is looking for a retry rule after a routing attempt has failed (for
51796 example, after a DNS timeout), each line in the retry configuration is tested
51797 against the complete address only if <option>retry_use_local_part</option> is set for the
51798 router. Otherwise, only the domain is used, except when matching against a
51799 regular expression, when the local part of the address is replaced with <quote>*</quote>.
51800 A domain on its own can match a domain pattern, or a pattern that starts with
51801 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
51802 <option>check_local_user</option> is true, and false for other routers.
51803 </para>
51804 <para>
51805 Similarly, when Exim is looking for a retry rule after a local delivery has
51806 failed (for example, after a mailbox full error), each line in the retry
51807 configuration is tested against the complete address only if
51808 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
51809 local transports).
51810 </para>
51811 <para>
51812 <indexterm role="concept">
51813 <primary>4<emphasis>xx</emphasis> responses</primary>
51814 <secondary>retry rules for</secondary>
51815 </indexterm>
51816 However, when Exim is looking for a retry rule after a remote delivery attempt
51817 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
51818 whole address is always used as the key when searching the retry rules. The
51819 rule that is found is used to create a retry time for the combination of the
51820 failing address and the message&#x2019;s sender. It is the combination of sender and
51821 recipient that is delayed in subsequent queue runs until its retry time is
51822 reached. You can delay the recipient without regard to the sender by setting
51823 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
51824 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
51825 commands.
51826 </para>
51827 </section>
51828 <section id="SECID160">
51829 <title>Choosing which retry rule to use for host and message errors</title>
51830 <para>
51831 For a temporary error that is not related to an individual address (for
51832 example, a connection timeout), each line in the retry configuration is checked
51833 twice. First, the name of the remote host is used as a domain name (preceded by
51834 <quote>*@</quote> when matching a regular expression). If this does not match the line,
51835 the domain from the email address is tried in a similar fashion. For example,
51836 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
51837 </para>
51838 <literallayout class="monospaced">
51839 a.b.c.example  MX  5  x.y.z.example
51840                MX  6  p.q.r.example
51841                MX  7  m.n.o.example
51842 </literallayout>
51843 <para>
51844 and the retry rules are
51845 </para>
51846 <literallayout class="monospaced">
51847 p.q.r.example    *      F,24h,30m;
51848 a.b.c.example    *      F,4d,45m;
51849 </literallayout>
51850 <para>
51851 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
51852 first rule matches neither the host nor the domain, so Exim looks at the second
51853 rule. This does not match the host, but it does match the domain, so it is used
51854 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
51855 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
51856 first retry rule is used, because it matches the host.
51857 </para>
51858 <para>
51859 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
51860 first rule to determine retry times, but for all the other hosts for the domain
51861 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
51862 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
51863 </para>
51864 <para>
51865 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
51866 However, if a message is routed directly to an IP address without the use of a
51867 host name, for example, if a <command>manualroute</command> router contains a setting such as:
51868 </para>
51869 <literallayout class="monospaced">
51870 route_list = *.a.example  192.168.34.23
51871 </literallayout>
51872 <para>
51873 then the <quote>host name</quote> that is used when searching for a retry rule is the
51874 textual form of the IP address.
51875 </para>
51876 </section>
51877 <section id="SECID161">
51878 <title>Retry rules for specific errors</title>
51879 <para>
51880 <indexterm role="concept">
51881 <primary>retry</primary>
51882 <secondary>specific errors; specifying</secondary>
51883 </indexterm>
51884 The second field in a retry rule is the name of a particular error, or an
51885 asterisk, which matches any error. The errors that can be tested for are:
51886 </para>
51887 <variablelist>
51888 <varlistentry>
51889 <term><option>auth_failed</option></term>
51890 <listitem>
51891 <para>
51892 Authentication failed when trying to send to a host in the
51893 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
51894 </para>
51895 </listitem></varlistentry>
51896 <varlistentry>
51897 <term><option>data_4xx</option></term>
51898 <listitem>
51899 <para>
51900 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
51901 after the command, or after sending the message&#x2019;s data.
51902 </para>
51903 </listitem></varlistentry>
51904 <varlistentry>
51905 <term><option>mail_4xx</option></term>
51906 <listitem>
51907 <para>
51908 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
51909 </para>
51910 </listitem></varlistentry>
51911 <varlistentry>
51912 <term><option>rcpt_4xx</option></term>
51913 <listitem>
51914 <para>
51915 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
51916 </para>
51917 </listitem></varlistentry>
51918 </variablelist>
51919 <para>
51920 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
51921 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
51922 recognize 452 errors given to RCPT commands for addresses in a certain domain,
51923 and have retries every ten minutes with a one-hour timeout, you could set up a
51924 retry rule of this form:
51925 </para>
51926 <literallayout class="monospaced">
51927 the.domain.name  rcpt_452   F,1h,10m
51928 </literallayout>
51929 <para>
51930 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
51931 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
51932 </para>
51933 <variablelist>
51934 <varlistentry>
51935 <term><option>lost_connection</option></term>
51936 <listitem>
51937 <para>
51938 A server unexpectedly closed the SMTP connection. There may, of course,
51939 legitimate reasons for this (host died, network died), but if it repeats a lot
51940 for the same host, it indicates something odd.
51941 </para>
51942 </listitem></varlistentry>
51943 <varlistentry>
51944 <term><option>lookup</option></term>
51945 <listitem>
51946 <para>
51947 A DNS lookup for a host failed.
51948 Note that a <option>dnslookup</option> router will need to have matched
51949 its <option>fail_defer_domains</option> option for this retry type to be usable.
51950 Also note that a <option>manualroute</option> router will probably need
51951 its <option>host_find_failed</option> option set to <option>defer</option>.
51952 </para>
51953 </listitem></varlistentry>
51954 <varlistentry>
51955 <term><option>refused_MX</option></term>
51956 <listitem>
51957 <para>
51958 A connection to a host obtained from an MX record was refused.
51959 </para>
51960 </listitem></varlistentry>
51961 <varlistentry>
51962 <term><option>refused_A</option></term>
51963 <listitem>
51964 <para>
51965 A connection to a host not obtained from an MX record was refused.
51966 </para>
51967 </listitem></varlistentry>
51968 <varlistentry>
51969 <term><option>refused</option></term>
51970 <listitem>
51971 <para>
51972 A connection was refused.
51973 </para>
51974 </listitem></varlistentry>
51975 <varlistentry>
51976 <term><option>timeout_connect_MX</option></term>
51977 <listitem>
51978 <para>
51979 A connection attempt to a host obtained from an MX record timed out.
51980 </para>
51981 </listitem></varlistentry>
51982 <varlistentry>
51983 <term><option>timeout_connect_A</option></term>
51984 <listitem>
51985 <para>
51986 A connection attempt to a host not obtained from an MX record timed out.
51987 </para>
51988 </listitem></varlistentry>
51989 <varlistentry>
51990 <term><option>timeout_connect</option></term>
51991 <listitem>
51992 <para>
51993 A connection attempt timed out.
51994 </para>
51995 </listitem></varlistentry>
51996 <varlistentry>
51997 <term><option>timeout_MX</option></term>
51998 <listitem>
51999 <para>
52000 There was a timeout while connecting or during an SMTP session with a host
52001 obtained from an MX record.
52002 </para>
52003 </listitem></varlistentry>
52004 <varlistentry>
52005 <term><option>timeout_A</option></term>
52006 <listitem>
52007 <para>
52008 There was a timeout while connecting or during an SMTP session with a host not
52009 obtained from an MX record.
52010 </para>
52011 </listitem></varlistentry>
52012 <varlistentry>
52013 <term><option>timeout</option></term>
52014 <listitem>
52015 <para>
52016 There was a timeout while connecting or during an SMTP session.
52017 </para>
52018 </listitem></varlistentry>
52019 <varlistentry>
52020 <term><option>tls_required</option></term>
52021 <listitem>
52022 <para>
52023 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
52024 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
52025 to STARTTLS, or there was a problem setting up the TLS connection.
52026 </para>
52027 </listitem></varlistentry>
52028 <varlistentry>
52029 <term><option>quota</option></term>
52030 <listitem>
52031 <para>
52032 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
52033 transport.
52034 </para>
52035 </listitem></varlistentry>
52036 <varlistentry>
52037 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
52038 <listitem>
52039 <para>
52040 <indexterm role="concept">
52041 <primary>quota</primary>
52042 <secondary>error testing in retry rule</secondary>
52043 </indexterm>
52044 <indexterm role="concept">
52045 <primary>retry</primary>
52046 <secondary>quota error testing</secondary>
52047 </indexterm>
52048 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
52049 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
52050 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
52051 for four days.
52052 </para>
52053 </listitem></varlistentry>
52054 </variablelist>
52055 <para>
52056 <indexterm role="concept">
52057 <primary>mailbox</primary>
52058 <secondary>time of last read</secondary>
52059 </indexterm>
52060 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
52061 timeouts when the mailbox is full and is not being read by its owner. Ideally,
52062 it should be based on the last time that the user accessed the mailbox.
52063 However, it is not always possible to determine this. Exim uses the following
52064 heuristic rules:
52065 </para>
52066 <itemizedlist>
52067 <listitem>
52068 <para>
52069 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
52070 used. As no new messages are being delivered (because the mailbox is over
52071 quota), Exim does not access the file, so this is the time of last user access.
52072 </para>
52073 </listitem>
52074 <listitem>
52075 <para>
52076 <indexterm role="concept">
52077 <primary>maildir format</primary>
52078 <secondary>time of last read</secondary>
52079 </indexterm>
52080 For a maildir delivery, the time of last modification of the <filename>new</filename>
52081 subdirectory is used. As the mailbox is over quota, no new files are created in
52082 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
52083 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
52084 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
52085 time that is used is therefore the last time that the user read a new message.
52086 </para>
52087 </listitem>
52088 <listitem>
52089 <para>
52090 For other kinds of multi-file mailbox, the time of last access cannot be
52091 obtained, so a retry rule that uses this type of error field is never matched.
52092 </para>
52093 </listitem>
52094 </itemizedlist>
52095 <para>
52096 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
52097 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
52098 when a local delivery is deferred because a partition is full (the ENOSPC
52099 error).
52100 </para>
52101 </section>
52102 <section id="SECID162">
52103 <title>Retry rules for specified senders</title>
52104 <para>
52105 <indexterm role="concept">
52106 <primary>retry</primary>
52107 <secondary>rules; sender-specific</secondary>
52108 </indexterm>
52109 You can specify retry rules that apply only when the failing message has a
52110 specific sender. In particular, this can be used to define retry rules that
52111 apply only to bounce messages. The third item in a retry rule can be of this
52112 form:
52113 </para>
52114 <literallayout>
52115 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
52116 </literallayout>
52117 <para>
52118 The retry timings themselves are then the fourth item. For example:
52119 </para>
52120 <literallayout class="monospaced">
52121 *   rcpt_4xx   senders=:   F,1h,30m
52122 </literallayout>
52123 <para>
52124 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
52125 host. If the address list contains white space, it must be enclosed in quotes.
52126 For example:
52127 </para>
52128 <literallayout class="monospaced">
52129 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
52130 </literallayout>
52131 <para>
52132 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
52133 (which do not depend on the recipient). The reason is that the sender is used
52134 only to match the retry rule. Once the rule has been found for a host error,
52135 its contents are used to set a retry time for the host, and this will apply to
52136 all messages, not just those with specific senders.
52137 </para>
52138 <para>
52139 When testing retry rules using <option>-brt</option>, you can supply a sender using the
52140 <option>-f</option> command line option, like this:
52141 </para>
52142 <literallayout class="monospaced">
52143 exim -f "" -brt user@dom.ain
52144 </literallayout>
52145 <para>
52146 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
52147 list is never matched.
52148 </para>
52149 </section>
52150 <section id="SECID163">
52151 <title>Retry parameters</title>
52152 <para>
52153 <indexterm role="concept">
52154 <primary>retry</primary>
52155 <secondary>parameters in rules</secondary>
52156 </indexterm>
52157 The third (or fourth, if a senders list is present) field in a retry rule is a
52158 sequence of retry parameter sets, separated by semicolons. Each set consists of
52159 </para>
52160 <literallayout>
52161 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
52162 </literallayout>
52163 <para>
52164 The letter identifies the algorithm for computing a new retry time; the cutoff
52165 time is the time beyond which this algorithm no longer applies, and the
52166 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
52167 time that the first failure for the domain (combined with the local part if
52168 relevant) was detected, not from the time the message was received.
52169 </para>
52170 <para>
52171 <indexterm role="concept">
52172 <primary>retry</primary>
52173 <secondary>algorithms</secondary>
52174 </indexterm>
52175 <indexterm role="concept">
52176 <primary>retry</primary>
52177 <secondary>fixed intervals</secondary>
52178 </indexterm>
52179 <indexterm role="concept">
52180 <primary>retry</primary>
52181 <secondary>increasing intervals</secondary>
52182 </indexterm>
52183 <indexterm role="concept">
52184 <primary>retry</primary>
52185 <secondary>random intervals</secondary>
52186 </indexterm>
52187 The available algorithms are:
52188 </para>
52189 <itemizedlist>
52190 <listitem>
52191 <para>
52192 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
52193 the interval.
52194 </para>
52195 </listitem>
52196 <listitem>
52197 <para>
52198 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
52199 specifies a starting value for the interval, and the second a multiplier, which
52200 is used to increase the size of the interval at each retry.
52201 </para>
52202 </listitem>
52203 <listitem>
52204 <para>
52205 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
52206 retry, the previous interval is multiplied by the factor in order to get a
52207 maximum for the next interval. The minimum interval is the first argument of
52208 the parameter, and an actual interval is chosen randomly between them. Such a
52209 rule has been found to be helpful in cluster configurations when all the
52210 members of the cluster restart at once, and may therefore synchronize their
52211 queue processing times.
52212 </para>
52213 </listitem>
52214 </itemizedlist>
52215 <para>
52216 When computing the next retry time, the algorithm definitions are scanned in
52217 order until one whose cutoff time has not yet passed is reached. This is then
52218 used to compute a new retry time that is later than the current time. In the
52219 case of fixed interval retries, this simply means adding the interval to the
52220 current time. For geometrically increasing intervals, retry intervals are
52221 computed from the rule&#x2019;s parameters until one that is greater than the previous
52222 interval is found. The main configuration variable
52223 <indexterm role="concept">
52224 <primary>limit</primary>
52225 <secondary>retry interval</secondary>
52226 </indexterm>
52227 <indexterm role="concept">
52228 <primary>retry</primary>
52229 <secondary>interval, maximum</secondary>
52230 </indexterm>
52231 <indexterm role="option">
52232 <primary><option>retry_interval_max</option></primary>
52233 </indexterm>
52234 <option>retry_interval_max</option> limits the maximum interval between retries. It
52235 cannot be set greater than <literal>24h</literal>, which is its default value.
52236 </para>
52237 <para>
52238 A single remote domain may have a number of hosts associated with it, and each
52239 host may have more than one IP address. Retry algorithms are selected on the
52240 basis of the domain name, but are applied to each IP address independently. If,
52241 for example, a host has two IP addresses and one is unusable, Exim will
52242 generate retry times for it and will not try to use it until its next retry
52243 time comes. Thus the good IP address is likely to be tried first most of the
52244 time.
52245 </para>
52246 <para>
52247 <indexterm role="concept">
52248 <primary>hints database</primary>
52249 <secondary>use for retrying</secondary>
52250 </indexterm>
52251 Retry times are hints rather than promises. Exim does not make any attempt to
52252 run deliveries exactly at the computed times. Instead, a queue runner process
52253 starts delivery processes for delayed messages periodically, and these attempt
52254 new deliveries only for those addresses that have passed their next retry time.
52255 If a new message arrives for a deferred address, an immediate delivery attempt
52256 occurs only if the address has passed its retry time. In the absence of new
52257 messages, the minimum time between retries is the interval between queue runner
52258 processes. There is not much point in setting retry times of five minutes if
52259 your queue runners happen only once an hour, unless there are a significant
52260 number of incoming messages (which might be the case on a system that is
52261 sending everything to a smart host, for example).
52262 </para>
52263 <para>
52264 The data in the retry hints database can be inspected by using the
52265 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
52266 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
52267 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
52268 are for the hosts associated with a particular mail domain, and also for local
52269 deliveries that have been deferred.
52270 </para>
52271 </section>
52272 <section id="SECID164">
52273 <title>Retry rule examples</title>
52274 <para>
52275 Here are some example retry rules:
52276 </para>
52277 <literallayout class="monospaced">
52278 alice@wonderland.fict.example quota_5d  F,7d,3h
52279 wonderland.fict.example       quota_5d
52280 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
52281 lookingglass.fict.example     *         F,24h,30m;
52282 *                 refused_A   F,2h,20m;
52283 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
52284 </literallayout>
52285 <para>
52286 The first rule sets up special handling for mail to
52287 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
52288 mailbox has not been read for at least 5 days. Retries continue every three
52289 hours for 7 days. The second rule handles over-quota errors for all other local
52290 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
52291 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
52292 fail are bounced immediately if the mailbox has not been read for at least 5
52293 days.
52294 </para>
52295 <para>
52296 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
52297 happen every 15 minutes for an hour, then with geometrically increasing
52298 intervals until two days have passed since a delivery first failed. After the
52299 first hour there is a delay of one hour, then two hours, then four hours, and
52300 so on (this is a rather extreme example).
52301 </para>
52302 <para>
52303 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
52304 They happen every 30 minutes for 24 hours only. The remaining two rules handle
52305 all other domains, with special action for connection refusal from hosts that
52306 were not obtained from an MX record.
52307 </para>
52308 <para>
52309 The final rule in a retry configuration should always have asterisks in the
52310 first two fields so as to provide a general catch-all for any addresses that do
52311 not have their own special handling. This example tries every 15 minutes for 2
52312 hours, then with intervals starting at one hour and increasing by a factor of
52313 1.5 up to 16 hours, then every 8 hours up to 5 days.
52314 </para>
52315 </section>
52316 <section id="SECID165">
52317 <title>Timeout of retry data</title>
52318 <para>
52319 <indexterm role="concept">
52320 <primary>timeout</primary>
52321 <secondary>of retry data</secondary>
52322 </indexterm>
52323 <indexterm role="option">
52324 <primary><option>retry_data_expire</option></primary>
52325 </indexterm>
52326 <indexterm role="concept">
52327 <primary>hints database</primary>
52328 <secondary>data expiry</secondary>
52329 </indexterm>
52330 <indexterm role="concept">
52331 <primary>retry</primary>
52332 <secondary>timeout of data</secondary>
52333 </indexterm>
52334 Exim timestamps the data that it writes to its retry hints database. When it
52335 consults the data during a delivery it ignores any that is older than the value
52336 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
52337 been tried for 7 days, Exim will try to deliver to it immediately a message
52338 arrives, and if that fails, it will calculate a retry time as if it were
52339 failing for the first time.
52340 </para>
52341 <para>
52342 This improves the behaviour for messages routed to rarely-used hosts such as MX
52343 backups. If such a host was down at one time, and happens to be down again when
52344 Exim tries a month later, using the old retry data would imply that it had been
52345 down all the time, which is not a justified assumption.
52346 </para>
52347 <para>
52348 If a host really is permanently dead, this behaviour causes a burst of retries
52349 every now and again, but only if messages routed to it are rare. If there is a
52350 message at least once every 7 days the retry data never expires.
52351 </para>
52352 </section>
52353 <section id="SECID166">
52354 <title>Long-term failures</title>
52355 <para>
52356 <indexterm role="concept">
52357 <primary>delivery failure, long-term</primary>
52358 </indexterm>
52359 <indexterm role="concept">
52360 <primary>retry</primary>
52361 <secondary>after long-term failure</secondary>
52362 </indexterm>
52363 Special processing happens when an email address has been failing for so long
52364 that the cutoff time for the last algorithm is reached. For example, using the
52365 default retry rule:
52366 </para>
52367 <literallayout class="monospaced">
52368 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
52369 </literallayout>
52370 <para>
52371 the cutoff time is four days. Reaching the retry cutoff is independent of how
52372 long any specific message has been failing; it is the length of continuous
52373 failure for the recipient address that counts.
52374 </para>
52375 <para>
52376 When the cutoff time is reached for a local delivery, or for all the IP
52377 addresses associated with a remote delivery, a subsequent delivery failure
52378 causes Exim to give up on the address, and a bounce message is generated.
52379 In order to cater for new messages that use the failing address, a next retry
52380 time is still computed from the final algorithm, and is used as follows:
52381 </para>
52382 <para>
52383 For local deliveries, one delivery attempt is always made for any subsequent
52384 messages. If this delivery fails, the address fails immediately. The
52385 post-cutoff retry time is not used.
52386 </para>
52387 <para>
52388 <indexterm role="concept">
52389 <primary>final cutoff</primary>
52390 <secondary>retries, controlling</secondary>
52391 </indexterm>
52392 <indexterm role="concept">
52393 <primary>retry</primary>
52394 <secondary>final cutoff</secondary>
52395 </indexterm>
52396 If the delivery is remote, there are two possibilities, controlled by the
52397 <indexterm role="option">
52398 <primary><option>delay_after_cutoff</option></primary>
52399 </indexterm>
52400 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
52401 default. Until the post-cutoff retry time for one of the IP addresses,
52402 as set by the <option>retry_data_expire</option> option, is
52403 reached, the failing email address is bounced immediately, without a delivery
52404 attempt taking place. After that time, one new delivery attempt is made to
52405 those IP addresses that are past their retry times, and if that still fails,
52406 the address is bounced and new retry times are computed.
52407 </para>
52408 <para>
52409 In other words, when all the hosts for a given email address have been failing
52410 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
52411 times is reached. Then it tries once, and bounces if that attempt fails. This
52412 behaviour ensures that few resources are wasted in repeatedly trying to deliver
52413 to a broken destination, but if the host does recover, Exim will eventually
52414 notice.
52415 </para>
52416 <para>
52417 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
52418 addresses are past their final cutoff time, Exim tries to deliver to those IP
52419 addresses that have not been tried since the message arrived. If there are
52420 no suitable IP addresses, or if they all fail, the address is bounced. In other
52421 words, it does not delay when a new message arrives, but tries the expired
52422 addresses immediately, unless they have been tried since the message arrived.
52423 If there is a continuous stream of messages for the failing domains, setting
52424 <option>delay_after_cutoff</option> false means that there will be many more attempts to
52425 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
52426 true.
52427 </para>
52428 </section>
52429 <section id="SECID167">
52430 <title>Deliveries that work intermittently</title>
52431 <para>
52432 <indexterm role="concept">
52433 <primary>retry</primary>
52434 <secondary>intermittently working deliveries</secondary>
52435 </indexterm>
52436 Some additional logic is needed to cope with cases where a host is
52437 intermittently available, or when a message has some attribute that prevents
52438 its delivery when others to the same address get through. In this situation,
52439 because some messages are successfully delivered, the <quote>retry clock</quote> for the
52440 host or address keeps getting reset by the successful deliveries, and so
52441 failing messages remain in the queue for ever because the cutoff time is never
52442 reached.
52443 </para>
52444 <para>
52445 Two exceptional actions are applied to prevent this happening. The first
52446 applies to errors that are related to a message rather than a remote host.
52447 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
52448 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
52449 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
52450 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
52451 is used when scanning the retry rules to decide when to try next and when to
52452 time out the address.
52453 </para>
52454 <para>
52455 The exceptional second action applies in all cases. If a message has been on
52456 the queue for longer than the cutoff time of any applicable retry rule for a
52457 given address, a delivery is attempted for that address, even if it is not yet
52458 time, and if this delivery fails, the address is timed out. A new retry time is
52459 not computed in this case, so that other messages for the same address are
52460 considered immediately.
52461 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
52462 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
52463 </para>
52464 </section>
52465 </chapter>
52466
52467 <chapter id="CHAPSMTPAUTH">
52468 <title>SMTP authentication</title>
52469 <para>
52470 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
52471 <primary>SMTP</primary>
52472 <secondary>authentication configuration</secondary>
52473 </indexterm>
52474 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
52475 <primary>authentication</primary>
52476 </indexterm>
52477 The <quote>authenticators</quote> section of Exim&#x2019;s runtime configuration is concerned
52478 with SMTP authentication. This facility is an extension to the SMTP protocol,
52479 described in RFC 2554, which allows a client SMTP host to authenticate itself
52480 to a server. This is a common way for a server to recognize clients that are
52481 permitted to use it as a relay. SMTP authentication is not of relevance to the
52482 transfer of mail between servers that have no managerial connection with each
52483 other.
52484 </para>
52485 <para>
52486 <indexterm role="concept">
52487 <primary>AUTH</primary>
52488 <secondary>description of</secondary>
52489 </indexterm>
52490 <indexterm role="concept">
52491 <primary>ESMTP extensions</primary>
52492 <secondary>AUTH</secondary>
52493 </indexterm>
52494 Very briefly, the way SMTP authentication works is as follows:
52495 </para>
52496 <itemizedlist>
52497 <listitem>
52498 <para>
52499 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
52500 the client&#x2019;s EHLO command.
52501 </para>
52502 </listitem>
52503 <listitem>
52504 <para>
52505 The client issues an AUTH command, naming a specific mechanism. The command
52506 may, optionally, contain some authentication data.
52507 </para>
52508 </listitem>
52509 <listitem>
52510 <para>
52511 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
52512 appropriate responses. In simple authentication mechanisms, the challenges are
52513 just prompts for user names and passwords. The server does not have to issue
52514 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
52515 with the AUTH command.
52516 </para>
52517 </listitem>
52518 <listitem>
52519 <para>
52520 The server either accepts or denies authentication.
52521 </para>
52522 </listitem>
52523 <listitem>
52524 <para>
52525 If authentication succeeds, the client may optionally make use of the AUTH
52526 option on the MAIL command to pass an authenticated sender in subsequent
52527 mail transactions. Authentication lasts for the remainder of the SMTP
52528 connection.
52529 </para>
52530 </listitem>
52531 <listitem>
52532 <para>
52533 If authentication fails, the client may give up, or it may try a different
52534 authentication mechanism, or it may try transferring mail over the
52535 unauthenticated connection.
52536 </para>
52537 </listitem>
52538 </itemizedlist>
52539 <para>
52540 If you are setting up a client, and want to know which authentication
52541 mechanisms the server supports, you can use Telnet to connect to port 25 (the
52542 SMTP port) on the server, and issue an EHLO command. The response to this
52543 includes the list of supported mechanisms. For example:
52544 </para>
52545 <literallayout>
52546 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
52547 <literal>Trying 192.168.34.25...</literal>
52548 <literal>Connected to server.example.</literal>
52549 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
52550 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
52551 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
52552 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
52553 <literal>250-SIZE 52428800</literal>
52554 <literal>250-PIPELINING</literal>
52555 <literal>250-AUTH PLAIN</literal>
52556 <literal>250 HELP</literal>
52557 </literallayout>
52558 <para>
52559 The second-last line of this example output shows that the server supports
52560 authentication using the PLAIN mechanism. In Exim, the different authentication
52561 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
52562 routers and transports, which authenticators are included in the binary is
52563 controlled by build-time definitions. The following are currently available,
52564 included by setting
52565 </para>
52566 <literallayout class="monospaced">
52567 AUTH_CRAM_MD5=yes
52568 AUTH_CYRUS_SASL=yes
52569 AUTH_DOVECOT=yes
52570 AUTH_EXTERNAL=yes
52571 AUTH_GSASL=yes
52572 AUTH_HEIMDAL_GSSAPI=yes
52573 AUTH_PLAINTEXT=yes
52574 AUTH_SPA=yes
52575 AUTH_TLS=yes
52576 </literallayout>
52577 <para>
52578 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
52579 authentication mechanism (RFC 2195), and the second provides an interface to
52580 the Cyrus SASL authentication library.
52581 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
52582 work via a socket interface.
52583 The fourth provides for negotiation of authentication done via non-SMTP means,
52584 as defined by RFC 4422 Appendix A.
52585 The fifth provides an interface to the GNU SASL authentication library, which
52586 provides mechanisms but typically not data sources.
52587 The sixth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
52588 supporting setting a server keytab.
52589 The seventh can be configured to support
52590 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
52591 not formally documented, but used by several MUAs.
52592 The eighth authenticator
52593 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
52594 The last is an Exim authenticator but not an SMTP one;
52595 instead it can use information from a TLS negotiation.
52596 </para>
52597 <para>
52598 The authenticators are configured using the same syntax as other drivers (see
52599 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
52600 authentication section need be present in the configuration file. Each
52601 authenticator can in principle have both server and client functions. When Exim
52602 is receiving SMTP mail, it is acting as a server; when it is sending out
52603 messages over SMTP, it is acting as a client. Authenticator configuration
52604 options are provided for use in both these circumstances.
52605 </para>
52606 <para>
52607 To make it clear which options apply to which situation, the prefixes
52608 <option>server_</option> and <option>client_</option> are used on option names that are specific to
52609 either the server or the client function, respectively. Server and client
52610 functions are disabled if none of their options are set. If an authenticator is
52611 to be used for both server and client functions, a single definition, using
52612 both sets of options, is required. For example:
52613 </para>
52614 <literallayout class="monospaced">
52615 cram:
52616   driver = cram_md5
52617   public_name = CRAM-MD5
52618   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
52619   client_name = ph10
52620   client_secret = secret2
52621 </literallayout>
52622 <para>
52623 The <option>server_</option> option is used when Exim is acting as a server, and the
52624 <option>client_</option> options when it is acting as a client.
52625 </para>
52626 <para>
52627 Descriptions of the individual authenticators are given in subsequent chapters.
52628 The remainder of this chapter covers the generic options for the
52629 authenticators, followed by general discussion of the way authentication works
52630 in Exim.
52631 </para>
52632 <para>
52633 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
52634 per-mechanism basis.  Please read carefully to determine which variables hold
52635 account labels such as usercodes and which hold passwords or other
52636 authenticating data.
52637 </para>
52638 <para>
52639 Note that some mechanisms support two different identifiers for accounts: the
52640 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
52641 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
52642 Conceptually, authentication data such as passwords are tied to the identifier
52643 used to authenticate; servers may have rules to permit one user to act as a
52644 second user, so that after login the session is treated as though that second
52645 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
52646 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
52647 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
52648 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
52649 choose to honour.
52650 </para>
52651 <para>
52652 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
52653 to a client to help it select an account and credentials to use.  In some
52654 mechanisms, the client and server provably agree on the realm, but clients
52655 typically can not treat the realm as secure data to be blindly trusted.
52656 </para>
52657 <section id="SECID168">
52658 <title>Generic options for authenticators</title>
52659 <para>
52660 <indexterm role="concept">
52661 <primary>authentication</primary>
52662 <secondary>generic options</secondary>
52663 </indexterm>
52664 <indexterm role="concept">
52665 <primary>options</primary>
52666 <secondary>generic; for authenticators</secondary>
52667 </indexterm>
52668 </para>
52669 <para>
52670 <indexterm role="option">
52671 <primary><option>client_condition</option></primary>
52672 </indexterm>
52673 </para>
52674 <informaltable frame="all">
52675 <tgroup cols="4" colsep="0" rowsep="0">
52676 <colspec colwidth="8*" align="left"/>
52677 <colspec colwidth="6*" align="center"/>
52678 <colspec colwidth="6*" align="center"/>
52679 <colspec colwidth="6*" align="right"/>
52680 <tbody>
52681 <row>
52682 <entry><option>client_condition</option></entry>
52683 <entry>Use: <emphasis>authenticators</emphasis></entry>
52684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52685 <entry>Default: <emphasis>unset</emphasis></entry>
52686 </row>
52687 </tbody>
52688 </tgroup>
52689 </informaltable>
52690 <para>
52691 When Exim is authenticating as a client, it skips any authenticator whose
52692 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
52693 used, for example, to skip plain text authenticators when the connection is not
52694 encrypted by a setting such as:
52695 </para>
52696 <literallayout class="monospaced">
52697 client_condition = ${if !eq{$tls_out_cipher}{}}
52698 </literallayout>
52699 <para>
52700 <indexterm role="option">
52701 <primary><option>client_set_id</option></primary>
52702 </indexterm>
52703 </para>
52704 <informaltable frame="all">
52705 <tgroup cols="4" colsep="0" rowsep="0">
52706 <colspec colwidth="8*" align="left"/>
52707 <colspec colwidth="6*" align="center"/>
52708 <colspec colwidth="6*" align="center"/>
52709 <colspec colwidth="6*" align="right"/>
52710 <tbody>
52711 <row>
52712 <entry><option>client_set_id</option></entry>
52713 <entry>Use: <emphasis>authenticators</emphasis></entry>
52714 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52715 <entry>Default: <emphasis>unset</emphasis></entry>
52716 </row>
52717 </tbody>
52718 </tgroup>
52719 </informaltable>
52720 <para>
52721 When client authentication succeeds, this condition is expanded; the
52722 result is used in the log lines for outbound messages.
52723 Typically it will be the user name used for authentication.
52724 </para>
52725 <para>
52726 <indexterm role="option">
52727 <primary><option>driver</option></primary>
52728 </indexterm>
52729 </para>
52730 <informaltable frame="all">
52731 <tgroup cols="4" colsep="0" rowsep="0">
52732 <colspec colwidth="8*" align="left"/>
52733 <colspec colwidth="6*" align="center"/>
52734 <colspec colwidth="6*" align="center"/>
52735 <colspec colwidth="6*" align="right"/>
52736 <tbody>
52737 <row>
52738 <entry><option>driver</option></entry>
52739 <entry>Use: <emphasis>authenticators</emphasis></entry>
52740 <entry>Type: <emphasis>string</emphasis></entry>
52741 <entry>Default: <emphasis>unset</emphasis></entry>
52742 </row>
52743 </tbody>
52744 </tgroup>
52745 </informaltable>
52746 <para>
52747 This option must always be set. It specifies which of the available
52748 authenticators is to be used.
52749 </para>
52750 <para>
52751 <indexterm role="option">
52752 <primary><option>public_name</option></primary>
52753 </indexterm>
52754 </para>
52755 <informaltable frame="all">
52756 <tgroup cols="4" colsep="0" rowsep="0">
52757 <colspec colwidth="8*" align="left"/>
52758 <colspec colwidth="6*" align="center"/>
52759 <colspec colwidth="6*" align="center"/>
52760 <colspec colwidth="6*" align="right"/>
52761 <tbody>
52762 <row>
52763 <entry><option>public_name</option></entry>
52764 <entry>Use: <emphasis>authenticators</emphasis></entry>
52765 <entry>Type: <emphasis>string</emphasis></entry>
52766 <entry>Default: <emphasis>unset</emphasis></entry>
52767 </row>
52768 </tbody>
52769 </tgroup>
52770 </informaltable>
52771 <para>
52772 This option specifies the name of the authentication mechanism that the driver
52773 implements, and by which it is known to the outside world. These names should
52774 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
52775 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
52776 defaults to the driver&#x2019;s instance name.
52777 </para>
52778 <para>
52779 <indexterm role="option">
52780 <primary><option>server_advertise_condition</option></primary>
52781 </indexterm>
52782 </para>
52783 <informaltable frame="all">
52784 <tgroup cols="4" colsep="0" rowsep="0">
52785 <colspec colwidth="8*" align="left"/>
52786 <colspec colwidth="6*" align="center"/>
52787 <colspec colwidth="6*" align="center"/>
52788 <colspec colwidth="6*" align="right"/>
52789 <tbody>
52790 <row>
52791 <entry><option>server_advertise_condition</option></entry>
52792 <entry>Use: <emphasis>authenticators</emphasis></entry>
52793 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52794 <entry>Default: <emphasis>unset</emphasis></entry>
52795 </row>
52796 </tbody>
52797 </tgroup>
52798 </informaltable>
52799 <para>
52800 When a server is about to advertise an authentication mechanism, the condition
52801 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
52802 mechanism is not advertised.
52803 If the expansion fails, the mechanism is not advertised. If the failure was not
52804 forced, and was not caused by a lookup defer, the incident is logged.
52805 See section <xref linkend="SECTauthexiser"/> below for further discussion.
52806 </para>
52807 <para>
52808 <indexterm role="option">
52809 <primary><option>server_condition</option></primary>
52810 </indexterm>
52811 </para>
52812 <informaltable frame="all">
52813 <tgroup cols="4" colsep="0" rowsep="0">
52814 <colspec colwidth="8*" align="left"/>
52815 <colspec colwidth="6*" align="center"/>
52816 <colspec colwidth="6*" align="center"/>
52817 <colspec colwidth="6*" align="right"/>
52818 <tbody>
52819 <row>
52820 <entry><option>server_condition</option></entry>
52821 <entry>Use: <emphasis>authenticators</emphasis></entry>
52822 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52823 <entry>Default: <emphasis>unset</emphasis></entry>
52824 </row>
52825 </tbody>
52826 </tgroup>
52827 </informaltable>
52828 <para>
52829 This option must be set for a <option>plaintext</option> server authenticator, where it
52830 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
52831 for details.
52832 </para>
52833 <para>
52834 For the <command>gsasl</command> authenticator, this option is required for various
52835 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
52836 </para>
52837 <para>
52838 For the other authenticators, <option>server_condition</option> can be used as an additional
52839 authentication or authorization mechanism that is applied after the other
52840 authenticator conditions succeed. If it is set, it is expanded when the
52841 authenticator would otherwise return a success code. If the expansion is forced
52842 to fail, authentication fails. Any other expansion failure causes a temporary
52843 error code to be returned. If the result of a successful expansion is an empty
52844 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
52845 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
52846 other result, a temporary error code is returned, with the expanded string as
52847 the error text.
52848 </para>
52849 <para>
52850 <indexterm role="option">
52851 <primary><option>server_debug_print</option></primary>
52852 </indexterm>
52853 </para>
52854 <informaltable frame="all">
52855 <tgroup cols="4" colsep="0" rowsep="0">
52856 <colspec colwidth="8*" align="left"/>
52857 <colspec colwidth="6*" align="center"/>
52858 <colspec colwidth="6*" align="center"/>
52859 <colspec colwidth="6*" align="right"/>
52860 <tbody>
52861 <row>
52862 <entry><option>server_debug_print</option></entry>
52863 <entry>Use: <emphasis>authenticators</emphasis></entry>
52864 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52865 <entry>Default: <emphasis>unset</emphasis></entry>
52866 </row>
52867 </tbody>
52868 </tgroup>
52869 </informaltable>
52870 <para>
52871 If this option is set and authentication debugging is enabled (see the <option>-d</option>
52872 command line option), the string is expanded and included in the debugging
52873 output when the authenticator is run as a server. This can help with checking
52874 out the values of variables.
52875 If expansion of the string fails, the error message is written to the debugging
52876 output, and Exim carries on processing.
52877 </para>
52878 <para>
52879 <indexterm role="option">
52880 <primary><option>server_set_id</option></primary>
52881 </indexterm>
52882 </para>
52883 <informaltable frame="all">
52884 <tgroup cols="4" colsep="0" rowsep="0">
52885 <colspec colwidth="8*" align="left"/>
52886 <colspec colwidth="6*" align="center"/>
52887 <colspec colwidth="6*" align="center"/>
52888 <colspec colwidth="6*" align="right"/>
52889 <tbody>
52890 <row>
52891 <entry><option>server_set_id</option></entry>
52892 <entry>Use: <emphasis>authenticators</emphasis></entry>
52893 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52894 <entry>Default: <emphasis>unset</emphasis></entry>
52895 </row>
52896 </tbody>
52897 </tgroup>
52898 </informaltable>
52899 <para>
52900 <indexterm role="variable">
52901 <primary><varname>$authenticated_id</varname></primary>
52902 </indexterm>
52903 <indexterm role="variable">
52904 <primary><varname>$authenticated_fail_id</varname></primary>
52905 </indexterm>
52906 When an Exim server successfully authenticates a client, this string is
52907 expanded using data from the authentication, and preserved for any incoming
52908 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
52909 lines for incoming messages. For example, a user/password authenticator
52910 configuration might preserve the user name that was used to authenticate, and
52911 refer to it subsequently during delivery of the message.
52912 On a failing authentication the expansion result is instead saved in
52913 the <varname>$authenticated_fail_id</varname> variable.
52914 If expansion fails, the option is ignored.
52915 </para>
52916 <para>
52917 <indexterm role="option">
52918 <primary><option>server_mail_auth_condition</option></primary>
52919 </indexterm>
52920 </para>
52921 <informaltable frame="all">
52922 <tgroup cols="4" colsep="0" rowsep="0">
52923 <colspec colwidth="8*" align="left"/>
52924 <colspec colwidth="6*" align="center"/>
52925 <colspec colwidth="6*" align="center"/>
52926 <colspec colwidth="6*" align="right"/>
52927 <tbody>
52928 <row>
52929 <entry><option>server_mail_auth_condition</option></entry>
52930 <entry>Use: <emphasis>authenticators</emphasis></entry>
52931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52932 <entry>Default: <emphasis>unset</emphasis></entry>
52933 </row>
52934 </tbody>
52935 </tgroup>
52936 </informaltable>
52937 <para>
52938 This option allows a server to discard authenticated sender addresses supplied
52939 as part of MAIL commands in SMTP connections that are authenticated by the
52940 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
52941 as part of the authentication process; instead its (unexpanded) value is
52942 remembered for later use.
52943 How it is used is described in the following section.
52944 </para>
52945 </section>
52946 <section id="SECTauthparamail">
52947 <title>The AUTH parameter on MAIL commands</title>
52948 <para>
52949 <indexterm role="concept">
52950 <primary>authentication</primary>
52951 <secondary>sender; authenticated</secondary>
52952 </indexterm>
52953 <indexterm role="concept">
52954 <primary>AUTH</primary>
52955 <secondary>on MAIL command</secondary>
52956 </indexterm>
52957 When a client supplied an AUTH= item on a MAIL command, Exim applies
52958 the following checks before accepting it as the authenticated sender of the
52959 message:
52960 </para>
52961 <itemizedlist>
52962 <listitem>
52963 <para>
52964 If the connection is not using extended SMTP (that is, HELO was used rather
52965 than EHLO), the use of AUTH= is a syntax error.
52966 </para>
52967 </listitem>
52968 <listitem>
52969 <para>
52970 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
52971 </para>
52972 </listitem>
52973 <listitem>
52974 <para>
52975 <indexterm role="variable">
52976 <primary><varname>$authenticated_sender</varname></primary>
52977 </indexterm>
52978 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
52979 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
52980 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
52981 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
52982 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
52983 given for the MAIL command.
52984 </para>
52985 </listitem>
52986 <listitem>
52987 <para>
52988 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
52989 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
52990 authenticated.
52991 </para>
52992 </listitem>
52993 <listitem>
52994 <para>
52995 If the AUTH= value was accepted by either of the two previous rules, and
52996 the client has authenticated, and the authenticator has a setting for the
52997 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
52998 valued that was saved from the authenticator is expanded. If the expansion
52999 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
53000 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
53001 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
53002 message.
53003 </para>
53004 </listitem>
53005 </itemizedlist>
53006 <para>
53007 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
53008 hosts to which Exim authenticates as a client. Do not confuse this value with
53009 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
53010 process, and which is not usually a complete email address.
53011 </para>
53012 <para>
53013 <indexterm role="variable">
53014 <primary><varname>$sender_address</varname></primary>
53015 </indexterm>
53016 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
53017 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
53018 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
53019 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
53020 ACL is run.
53021 </para>
53022 </section>
53023 <section id="SECTauthexiser">
53024 <title>Authentication on an Exim server</title>
53025 <para>
53026 <indexterm role="concept">
53027 <primary>authentication</primary>
53028 <secondary>on an Exim server</secondary>
53029 </indexterm>
53030 When Exim receives an EHLO command, it advertises the public names of those
53031 authenticators that are configured as servers, subject to the following
53032 conditions:
53033 </para>
53034 <itemizedlist>
53035 <listitem>
53036 <para>
53037 The client host must match <option>auth_advertise_hosts</option> (default *).
53038 </para>
53039 </listitem>
53040 <listitem>
53041 <para>
53042 It the <option>server_advertise_condition</option> option is set, its expansion must not
53043 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
53044 </para>
53045 </listitem>
53046 </itemizedlist>
53047 <para>
53048 The order in which the authenticators are defined controls the order in which
53049 the mechanisms are advertised.
53050 </para>
53051 <para>
53052 Some mail clients (for example, some versions of Netscape) require the user to
53053 provide a name and password for authentication whenever AUTH is advertised,
53054 even though authentication may not in fact be needed (for example, Exim may be
53055 set up to allow unconditional relaying from the client by an IP address check).
53056 You can make such clients more friendly by not advertising AUTH to them.
53057 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
53058 that runs for RCPT) to relay without authentication, you should set
53059 </para>
53060 <literallayout class="monospaced">
53061 auth_advertise_hosts = ! 10.9.8.0/24
53062 </literallayout>
53063 <para>
53064 so that no authentication mechanisms are advertised to them.
53065 </para>
53066 <para>
53067 The <option>server_advertise_condition</option> controls the advertisement of individual
53068 authentication mechanisms. For example, it can be used to restrict the
53069 advertisement of a particular mechanism to encrypted connections, by a setting
53070 such as:
53071 </para>
53072 <literallayout class="monospaced">
53073 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
53074 </literallayout>
53075 <para>
53076 <indexterm role="variable">
53077 <primary><varname>$tls_in_cipher</varname></primary>
53078 </indexterm>
53079 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
53080 yields <quote>yes</quote>, which allows the advertisement to happen.
53081 </para>
53082 <para>
53083 When an Exim server receives an AUTH command from a client, it rejects it
53084 immediately if AUTH was not advertised in response to an earlier EHLO
53085 command. This is the case if
53086 </para>
53087 <itemizedlist>
53088 <listitem>
53089 <para>
53090 The client host does not match <option>auth_advertise_hosts</option>; or
53091 </para>
53092 </listitem>
53093 <listitem>
53094 <para>
53095 No authenticators are configured with server options; or
53096 </para>
53097 </listitem>
53098 <listitem>
53099 <para>
53100 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
53101 server authenticators.
53102 </para>
53103 </listitem>
53104 </itemizedlist>
53105 <para>
53106 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
53107 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
53108 AUTH is accepted from any client host.
53109 </para>
53110 <para>
53111 If AUTH is not rejected by the ACL, Exim searches its configuration for a
53112 server authentication mechanism that was advertised in response to EHLO and
53113 that matches the one named in the AUTH command. If it finds one, it runs
53114 the appropriate authentication protocol, and authentication either succeeds or
53115 fails. If there is no matching advertised mechanism, the AUTH command is
53116 rejected with a 504 error.
53117 </para>
53118 <para>
53119 <indexterm role="variable">
53120 <primary><varname>$received_protocol</varname></primary>
53121 </indexterm>
53122 <indexterm role="variable">
53123 <primary><varname>$sender_host_authenticated</varname></primary>
53124 </indexterm>
53125 When a message is received from an authenticated host, the value of
53126 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
53127 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
53128 public name) of the authenticator driver that successfully authenticated the
53129 client from which the message was received. This variable is empty if there was
53130 no successful authentication.
53131 </para>
53132 <para>
53133 <indexterm role="concept">
53134 <primary>authentication</primary>
53135 <secondary>expansion item</secondary>
53136 </indexterm>
53137 Successful authentication sets up information used by the
53138 <option>authresults</option> expansion item.
53139 </para>
53140 </section>
53141 <section id="SECID169">
53142 <title>Testing server authentication</title>
53143 <para>
53144 <indexterm role="concept">
53145 <primary>authentication</primary>
53146 <secondary>testing a server</secondary>
53147 </indexterm>
53148 <indexterm role="concept">
53149 <primary>AUTH</primary>
53150 <secondary>testing a server</secondary>
53151 </indexterm>
53152 <indexterm role="concept">
53153 <primary>base64 encoding</primary>
53154 <secondary>creating authentication test data</secondary>
53155 </indexterm>
53156 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
53157 configurations. The data for the AUTH command has to be sent using base64
53158 encoding. A quick way to produce such data for testing is the following Perl
53159 script:
53160 </para>
53161 <literallayout class="monospaced">
53162 use MIME::Base64;
53163 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
53164 </literallayout>
53165 <para>
53166 <indexterm role="concept">
53167 <primary>binary zero</primary>
53168 <secondary>in authentication data</secondary>
53169 </indexterm>
53170 This interprets its argument as a Perl string, and then encodes it. The
53171 interpretation as a Perl string allows binary zeros, which are required for
53172 some kinds of authentication, to be included in the data. For example, a
53173 command line to run this script on such data might be
53174 </para>
53175 <literallayout class="monospaced">
53176 encode '\0user\0password'
53177 </literallayout>
53178 <para>
53179 Note the use of single quotes to prevent the shell interpreting the
53180 backslashes, so that they can be interpreted by Perl to specify characters
53181 whose code value is zero.
53182 </para>
53183 <para>
53184 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
53185 digit, you must use three zeros instead of one after the leading backslash. If
53186 you do not, the octal digit that starts your string will be incorrectly
53187 interpreted as part of the code for the first character.
53188 </para>
53189 <para>
53190 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
53191 specially, you must use a Perl escape to prevent them being misinterpreted. For
53192 example, a command such as
53193 </para>
53194 <literallayout class="monospaced">
53195 encode '\0user@domain.com\0pas$$word'
53196 </literallayout>
53197 <para>
53198 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
53199 </para>
53200 <para>
53201 If you have the <option>mimencode</option> command installed, another way to do produce
53202 base64-encoded strings is to run the command
53203 </para>
53204 <literallayout class="monospaced">
53205 echo -e -n `\0user\0password' | mimencode
53206 </literallayout>
53207 <para>
53208 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
53209 in the argument, and the <option>-n</option> option specifies no newline at the end of its
53210 output. However, not all versions of <option>echo</option> recognize these options, so you
53211 should check your version before relying on this suggestion.
53212 </para>
53213 </section>
53214 <section id="SECID170">
53215 <title>Authentication by an Exim client</title>
53216 <para>
53217 <indexterm role="concept">
53218 <primary>authentication</primary>
53219 <secondary>on an Exim client</secondary>
53220 </indexterm>
53221 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
53222 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
53223 announces support for authentication, and the host matches an entry in either
53224 of these options, Exim (as a client) tries to authenticate as follows:
53225 </para>
53226 <itemizedlist>
53227 <listitem>
53228 <para>
53229 For each authenticator that is configured as a client, in the order in which
53230 they are defined in the configuration, it searches the authentication
53231 mechanisms announced by the server for one whose name matches the public name
53232 of the authenticator.
53233 </para>
53234 </listitem>
53235 <listitem>
53236 <para>
53237 <indexterm role="variable">
53238 <primary><varname>$host</varname></primary>
53239 </indexterm>
53240 <indexterm role="variable">
53241 <primary><varname>$host_address</varname></primary>
53242 </indexterm>
53243 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
53244 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
53245 that the client might do. They are set to the server&#x2019;s name and IP address. If
53246 any expansion is forced to fail, the authentication attempt is abandoned, and
53247 Exim moves on to the next authenticator. Otherwise an expansion failure causes
53248 delivery to be deferred.
53249 </para>
53250 </listitem>
53251 <listitem>
53252 <para>
53253 If the result of the authentication attempt is a temporary error or a timeout,
53254 Exim abandons trying to send the message to the host for the moment. It will
53255 try again later. If there are any backup hosts available, they are tried in the
53256 usual way.
53257 </para>
53258 </listitem>
53259 <listitem>
53260 <para>
53261 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
53262 carries on searching the list of authenticators and tries another one if
53263 possible. If all authentication attempts give permanent errors, or if there are
53264 no attempts because no mechanisms match (or option expansions force failure),
53265 what happens depends on whether the host matches <option>hosts_require_auth</option> or
53266 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
53267 delivery is deferred. The error can be detected in the retry rules, and thereby
53268 turned into a permanent error if you wish. In the second case, Exim tries to
53269 deliver the message unauthenticated.
53270 </para>
53271 </listitem>
53272 </itemizedlist>
53273 <para>
53274 Note that the hostlist test for whether to do authentication can be
53275 confused if name-IP lookups change between the time the peer is decided
53276 upon and the time that the transport runs.  For example, with a manualroute
53277 router given a host name, and with DNS "round-robin" used by that name: if
53278 the local resolver cache times out between the router and the transport
53279 running, the transport may get an IP for the name for its authentication
53280 check which does not match the connection peer IP.
53281 No authentication will then be done, despite the names being identical.
53282 </para>
53283 <para>
53284 For such cases use a separate transport which always authenticates.
53285 </para>
53286 <para>
53287 <indexterm role="concept">
53288 <primary>AUTH</primary>
53289 <secondary>on MAIL command</secondary>
53290 </indexterm>
53291 When Exim has authenticated itself to a remote server, it adds the AUTH
53292 parameter to the MAIL commands it sends, if it has an authenticated sender for
53293 the message. If the message came from a remote host, the authenticated sender
53294 is the one that was receiving on an incoming MAIL command, provided that the
53295 incoming connection was authenticated and the <option>server_mail_auth</option> condition
53296 allowed the authenticated sender to be retained. If a local process calls Exim
53297 to send a message, the sender address that is built from the login name and
53298 <option>qualify_domain</option> is treated as authenticated. However, if the
53299 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
53300 the authenticated sender that was received with the message.
53301 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
53302 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
53303 </para>
53304 </section>
53305 </chapter>
53306
53307 <chapter id="CHAPplaintext">
53308 <title>The plaintext authenticator</title>
53309 <para>
53310 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
53311 <primary><command>plaintext</command> authenticator</primary>
53312 </indexterm>
53313 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
53314 <primary>authenticators</primary>
53315 <secondary><command>plaintext</command></secondary>
53316 </indexterm>
53317 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
53318 LOGIN authentication mechanisms, both of which transfer authentication data as
53319 plain (unencrypted) text (though base64 encoded). The use of plain text is a
53320 security risk; you are strongly advised to insist on the use of SMTP encryption
53321 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
53322 use unencrypted plain text, you should not use the same passwords for SMTP
53323 connections as you do for login accounts.
53324 </para>
53325 <section id="SECTplain_TLS">
53326 <title>Avoiding cleartext use</title>
53327 <para>
53328 The following generic option settings will disable <command>plaintext</command> authenticators when
53329 TLS is not being used:
53330 </para>
53331 <literallayout class="monospaced">
53332   server_advertise_condition = ${if def:tls_in_cipher }
53333   client_condition =           ${if def:tls_out_cipher}
53334 </literallayout>
53335 <para>
53336 <emphasis role="bold">Note</emphasis>: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping,
53337 but is still vulnerable to a Man In The Middle attack unless certificates
53338 (including their names) have been properly verified.
53339 </para>
53340 </section>
53341 <section id="SECID171">
53342 <title>Plaintext server options</title>
53343 <para>
53344 <indexterm role="concept">
53345 <primary>options</primary>
53346 <secondary><command>plaintext</command> authenticator (server)</secondary>
53347 </indexterm>
53348 When configured as a server, <command>plaintext</command> uses the following options:
53349 </para>
53350 <para>
53351 <indexterm role="option">
53352 <primary><option>server_condition</option></primary>
53353 </indexterm>
53354 </para>
53355 <informaltable frame="all">
53356 <tgroup cols="4" colsep="0" rowsep="0">
53357 <colspec colwidth="8*" align="left"/>
53358 <colspec colwidth="6*" align="center"/>
53359 <colspec colwidth="6*" align="center"/>
53360 <colspec colwidth="6*" align="right"/>
53361 <tbody>
53362 <row>
53363 <entry><option>server_condition</option></entry>
53364 <entry>Use: <emphasis>authenticators</emphasis></entry>
53365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53366 <entry>Default: <emphasis>unset</emphasis></entry>
53367 </row>
53368 </tbody>
53369 </tgroup>
53370 </informaltable>
53371 <para>
53372 This is actually a global authentication option, but it must be set in order to
53373 configure the <command>plaintext</command> driver as a server. Its use is described below.
53374 </para>
53375 <para>
53376 <indexterm role="option">
53377 <primary><option>server_prompts</option></primary>
53378 </indexterm>
53379 </para>
53380 <informaltable frame="all">
53381 <tgroup cols="4" colsep="0" rowsep="0">
53382 <colspec colwidth="8*" align="left"/>
53383 <colspec colwidth="6*" align="center"/>
53384 <colspec colwidth="6*" align="center"/>
53385 <colspec colwidth="6*" align="right"/>
53386 <tbody>
53387 <row>
53388 <entry><option>server_prompts</option></entry>
53389 <entry>Use: <emphasis>plaintext</emphasis></entry>
53390 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
53391 <entry>Default: <emphasis>unset</emphasis></entry>
53392 </row>
53393 </tbody>
53394 </tgroup>
53395 </informaltable>
53396 <para>
53397 The contents of this option, after expansion, must be a colon-separated list of
53398 prompt strings. If expansion fails, a temporary authentication rejection is
53399 given.
53400 </para>
53401 </section>
53402 <section id="SECTplainserver">
53403 <title>Using plaintext in a server</title>
53404 <para>
53405 <indexterm role="concept">
53406 <primary>AUTH</primary>
53407 <secondary>in <command>plaintext</command> authenticator</secondary>
53408 </indexterm>
53409 <indexterm role="concept">
53410 <primary>binary zero</primary>
53411 <secondary>in <command>plaintext</command> authenticator</secondary>
53412 </indexterm>
53413 <indexterm role="concept">
53414 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53415 <secondary>in <command>plaintext</command> authenticator</secondary>
53416 </indexterm>
53417 <indexterm role="variable">
53418 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
53419 </indexterm>
53420 <indexterm role="concept">
53421 <primary>base64 encoding</primary>
53422 <secondary>in <command>plaintext</command> authenticator</secondary>
53423 </indexterm>
53424 </para>
53425 <para>
53426 When running as a server, <command>plaintext</command> performs the authentication test by
53427 expanding a string. The data sent by the client with the AUTH command, or in
53428 response to subsequent prompts, is base64 encoded, and so may contain any byte
53429 values when decoded. If any data is supplied with the command, it is treated as
53430 a list of strings, separated by NULs (binary zeros), the first three of which
53431 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
53432 (neither LOGIN nor PLAIN uses more than three strings).
53433 </para>
53434 <para>
53435 For compatibility with previous releases of Exim, the values are also placed in
53436 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
53437 variables for this purpose is now deprecated, as it can lead to confusion in
53438 string expansions that also use them for other things.
53439 </para>
53440 <para>
53441 If there are more strings in <option>server_prompts</option> than the number of strings
53442 supplied with the AUTH command, the remaining prompts are used to obtain more
53443 data. Each response from the client may be a list of NUL-separated strings.
53444 </para>
53445 <para>
53446 <indexterm role="variable">
53447 <primary><varname>$authenticated_id</varname></primary>
53448 </indexterm>
53449 Once a sufficient number of data strings have been received,
53450 <option>server_condition</option> is expanded. If the expansion is forced to fail,
53451 authentication fails. Any other expansion failure causes a temporary error code
53452 to be returned. If the result of a successful expansion is an empty string,
53453 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
53454 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
53455 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
53456 For any other result, a temporary error code is returned, with the expanded
53457 string as the error text.
53458 </para>
53459 <para>
53460 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
53461 password, be sure to make the authentication fail if the user is unknown.
53462 There are good and bad examples at the end of the next section.
53463 </para>
53464 </section>
53465 <section id="SECID172">
53466 <title>The PLAIN authentication mechanism</title>
53467 <para>
53468 <indexterm role="concept">
53469 <primary>PLAIN authentication mechanism</primary>
53470 </indexterm>
53471 <indexterm role="concept">
53472 <primary>authentication</primary>
53473 <secondary>PLAIN</secondary>
53474 </indexterm>
53475 <indexterm role="concept">
53476 <primary>binary zero</primary>
53477 <secondary>in <command>plaintext</command> authenticator</secondary>
53478 </indexterm>
53479 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
53480 sent as one item of data (that is, one combined string containing two NUL
53481 separators). The data is sent either as part of the AUTH command, or
53482 subsequently in response to an empty prompt from the server.
53483 </para>
53484 <para>
53485 The second and third strings are a user name and a corresponding password.
53486 Using a single fixed user name and password as an example, this could be
53487 configured as follows:
53488 </para>
53489 <literallayout class="monospaced">
53490 fixed_plain:
53491   driver = plaintext
53492   public_name = PLAIN
53493   server_prompts = :
53494   server_condition = \
53495     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
53496   server_set_id = $auth2
53497 </literallayout>
53498 <para>
53499 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
53500 are exactly what we want here, so they need not be specified. Obviously, if the
53501 password contains expansion-significant characters such as dollar, backslash,
53502 or closing brace, they have to be escaped.
53503 </para>
53504 <para>
53505 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
53506 the end of a string list are ignored). If all the data comes as part of the
53507 AUTH command, as is commonly the case, the prompt is not used. This
53508 authenticator is advertised in the response to EHLO as
53509 </para>
53510 <literallayout class="monospaced">
53511 250-AUTH PLAIN
53512 </literallayout>
53513 <para>
53514 and a client host can authenticate itself by sending the command
53515 </para>
53516 <literallayout class="monospaced">
53517 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
53518 </literallayout>
53519 <para>
53520 As this contains three strings (more than the number of prompts), no further
53521 data is required from the client. Alternatively, the client may just send
53522 </para>
53523 <literallayout class="monospaced">
53524 AUTH PLAIN
53525 </literallayout>
53526 <para>
53527 to initiate authentication, in which case the server replies with an empty
53528 prompt. The client must respond with the combined data string.
53529 </para>
53530 <para>
53531 The data string is base64 encoded, as required by the RFC. This example,
53532 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;
53533 represents a zero byte. This is split up into three strings, the first of which
53534 is empty. The <option>server_condition</option> option in the authenticator checks that the
53535 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
53536 </para>
53537 <para>
53538 Having just one fixed user name and password, as in this example, is not very
53539 realistic, though for a small organization with only a handful of
53540 authenticating clients it could make sense.
53541 </para>
53542 <para>
53543 A more sophisticated instance of this authenticator could use the user name in
53544 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
53545 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
53546 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
53547 This is an incorrect example:
53548 </para>
53549 <literallayout class="monospaced">
53550 server_condition = \
53551   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
53552 </literallayout>
53553 <para>
53554 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
53555 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
53556 incorrect? It works fine for existing users, but consider what happens if a
53557 non-existent user name is given. The lookup fails, but as no success/failure
53558 strings are given for the lookup, it yields an empty string. Thus, to defeat
53559 the authentication, all a client has to do is to supply a non-existent user
53560 name and an empty password. The correct way of writing this test is:
53561 </para>
53562 <literallayout class="monospaced">
53563 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
53564   {${if eq{$value}{$auth3}}} {false}}
53565 </literallayout>
53566 <para>
53567 In this case, if the lookup succeeds, the result is checked; if the lookup
53568 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
53569 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
53570 always fails if its second argument is empty. However, the second way of
53571 writing the test makes the logic clearer.
53572 </para>
53573 </section>
53574 <section id="SECID173">
53575 <title>The LOGIN authentication mechanism</title>
53576 <para>
53577 <indexterm role="concept">
53578 <primary>LOGIN authentication mechanism</primary>
53579 </indexterm>
53580 <indexterm role="concept">
53581 <primary>authentication</primary>
53582 <secondary>LOGIN</secondary>
53583 </indexterm>
53584 The LOGIN authentication mechanism is not documented in any RFC, but is in use
53585 in a number of programs. No data is sent with the AUTH command. Instead, a
53586 user name and password are supplied separately, in response to prompts. The
53587 plaintext authenticator can be configured to support this as in this example:
53588 </para>
53589 <literallayout class="monospaced">
53590 fixed_login:
53591   driver = plaintext
53592   public_name = LOGIN
53593   server_prompts = User Name : Password
53594   server_condition = \
53595     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
53596   server_set_id = $auth1
53597 </literallayout>
53598 <para>
53599 Because of the way plaintext operates, this authenticator accepts data supplied
53600 with the AUTH command (in contravention of the specification of LOGIN), but
53601 if the client does not supply it (as is the case for LOGIN clients), the prompt
53602 strings are used to obtain two data items.
53603 </para>
53604 <para>
53605 Some clients are very particular about the precise text of the prompts. For
53606 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
53607 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
53608 strings. It uses the <option>ldapauth</option> expansion condition to check the user
53609 name and password by binding to an LDAP server:
53610 </para>
53611 <literallayout class="monospaced">
53612 login:
53613   driver = plaintext
53614   public_name = LOGIN
53615   server_prompts = Username:: : Password::
53616   server_condition = ${if and{{ \
53617     !eq{}{$auth1} }{ \
53618     ldapauth{\
53619       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
53620       pass=${quote:$auth2} \
53621       ldap://ldap.example.org/} }} }
53622   server_set_id = uid=$auth1,ou=people,o=example.org
53623 </literallayout>
53624 <para>
53625 We have to check that the username is not empty before using it, because LDAP
53626 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
53627 operator to correctly quote the DN for authentication. However, the basic
53628 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
53629 correct one to use for the password, because quoting is needed only to make
53630 the password conform to the Exim syntax. At the LDAP level, the password is an
53631 uninterpreted string.
53632 </para>
53633 </section>
53634 <section id="SECID174">
53635 <title>Support for different kinds of authentication</title>
53636 <para>
53637 A number of string expansion features are provided for the purpose of
53638 interfacing to different ways of user authentication. These include checking
53639 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
53640 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
53641 <xref linkend="SECTexpcond"/>.
53642 </para>
53643 </section>
53644 <section id="SECID175">
53645 <title>Using plaintext in a client</title>
53646 <para>
53647 <indexterm role="concept">
53648 <primary>options</primary>
53649 <secondary><command>plaintext</command> authenticator (client)</secondary>
53650 </indexterm>
53651 The <command>plaintext</command> authenticator has two client options:
53652 </para>
53653 <para>
53654 <indexterm role="option">
53655 <primary><option>client_ignore_invalid_base64</option></primary>
53656 </indexterm>
53657 </para>
53658 <informaltable frame="all">
53659 <tgroup cols="4" colsep="0" rowsep="0">
53660 <colspec colwidth="8*" align="left"/>
53661 <colspec colwidth="6*" align="center"/>
53662 <colspec colwidth="6*" align="center"/>
53663 <colspec colwidth="6*" align="right"/>
53664 <tbody>
53665 <row>
53666 <entry><option>client_ignore_invalid_base64</option></entry>
53667 <entry>Use: <emphasis>plaintext</emphasis></entry>
53668 <entry>Type: <emphasis>boolean</emphasis></entry>
53669 <entry>Default: <emphasis>false</emphasis></entry>
53670 </row>
53671 </tbody>
53672 </tgroup>
53673 </informaltable>
53674 <para>
53675 If the client receives a server prompt that is not a valid base64 string,
53676 authentication is abandoned by default. However, if this option is set true,
53677 the error in the challenge is ignored and the client sends the response as
53678 usual.
53679 </para>
53680 <para>
53681 <indexterm role="option">
53682 <primary><option>client_send</option></primary>
53683 </indexterm>
53684 </para>
53685 <informaltable frame="all">
53686 <tgroup cols="4" colsep="0" rowsep="0">
53687 <colspec colwidth="8*" align="left"/>
53688 <colspec colwidth="6*" align="center"/>
53689 <colspec colwidth="6*" align="center"/>
53690 <colspec colwidth="6*" align="right"/>
53691 <tbody>
53692 <row>
53693 <entry><option>client_send</option></entry>
53694 <entry>Use: <emphasis>plaintext</emphasis></entry>
53695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53696 <entry>Default: <emphasis>unset</emphasis></entry>
53697 </row>
53698 </tbody>
53699 </tgroup>
53700 </informaltable>
53701 <para>
53702 The string is a colon-separated list of authentication data strings. Each
53703 string is independently expanded before being sent to the server. The first
53704 string is sent with the AUTH command; any more strings are sent in response
53705 to prompts from the server. Before each string is expanded, the value of the
53706 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
53707 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
53708 way. Thus, the prompt that is received in response to sending the first string
53709 (with the AUTH command) can be used in the expansion of the second string, and
53710 so on. If an invalid base64 string is received when
53711 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
53712 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
53713 </para>
53714 <para>
53715 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
53716 splitting takes priority and happens first.
53717 </para>
53718 <para>
53719 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
53720 the data, further processing is applied to each string before it is sent. If
53721 there are any single circumflex characters in the string, they are converted to
53722 NULs. Should an actual circumflex be required as data, it must be doubled in
53723 the string.
53724 </para>
53725 <para>
53726 This is an example of a client configuration that implements the PLAIN
53727 authentication mechanism with a fixed user name and password:
53728 </para>
53729 <literallayout class="monospaced">
53730 fixed_plain:
53731   driver = plaintext
53732   public_name = PLAIN
53733   client_send = ^username^mysecret
53734 </literallayout>
53735 <para>
53736 The lack of colons means that the entire text is sent with the AUTH
53737 command, with the circumflex characters converted to NULs. A similar example
53738 that uses the LOGIN mechanism is:
53739 </para>
53740 <literallayout class="monospaced">
53741 fixed_login:
53742   driver = plaintext
53743   public_name = LOGIN
53744   client_send = : username : mysecret
53745 </literallayout>
53746 <para>
53747 The initial colon means that the first string is empty, so no data is sent with
53748 the AUTH command itself. The remaining strings are sent in response to
53749 prompts.
53750 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
53751 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
53752 </para>
53753 </section>
53754 </chapter>
53755
53756 <chapter id="CHID9">
53757 <title>The cram_md5 authenticator</title>
53758 <para>
53759 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
53760 <primary><command>cram_md5</command> authenticator</primary>
53761 </indexterm>
53762 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
53763 <primary>authenticators</primary>
53764 <secondary><command>cram_md5</command></secondary>
53765 </indexterm>
53766 <indexterm role="concept">
53767 <primary>CRAM-MD5 authentication mechanism</primary>
53768 </indexterm>
53769 <indexterm role="concept">
53770 <primary>authentication</primary>
53771 <secondary>CRAM-MD5</secondary>
53772 </indexterm>
53773 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
53774 sends a challenge string to the client, and the response consists of a user
53775 name and the CRAM-MD5 digest of the challenge string combined with a secret
53776 string (password) which is known to both server and client. Thus, the secret
53777 is not sent over the network as plain text, which makes this authenticator more
53778 secure than <command>plaintext</command>. However, the downside is that the secret has to be
53779 available in plain text at either end.
53780 </para>
53781 <section id="SECID176">
53782 <title>Using cram_md5 as a server</title>
53783 <para>
53784 <indexterm role="concept">
53785 <primary>options</primary>
53786 <secondary><command>cram_md5</command> authenticator (server)</secondary>
53787 </indexterm>
53788 This authenticator has one server option, which must be set to configure the
53789 authenticator as a server:
53790 </para>
53791 <para>
53792 <indexterm role="option">
53793 <primary><option>server_secret</option></primary>
53794 </indexterm>
53795 </para>
53796 <informaltable frame="all">
53797 <tgroup cols="4" colsep="0" rowsep="0">
53798 <colspec colwidth="8*" align="left"/>
53799 <colspec colwidth="6*" align="center"/>
53800 <colspec colwidth="6*" align="center"/>
53801 <colspec colwidth="6*" align="right"/>
53802 <tbody>
53803 <row>
53804 <entry><option>server_secret</option></entry>
53805 <entry>Use: <emphasis>cram_md5</emphasis></entry>
53806 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53807 <entry>Default: <emphasis>unset</emphasis></entry>
53808 </row>
53809 </tbody>
53810 </tgroup>
53811 </informaltable>
53812 <para>
53813 <indexterm role="concept">
53814 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53815 <secondary>in <command>cram_md5</command> authenticator</secondary>
53816 </indexterm>
53817 When the server receives the client&#x2019;s response, the user name is placed in
53818 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
53819 obtain the password for that user. The server then computes the CRAM-MD5 digest
53820 that the client should have sent, and checks that it received the correct
53821 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
53822 fails. If the expansion fails for some other reason, a temporary error code is
53823 returned to the client.
53824 </para>
53825 <para>
53826 For compatibility with previous releases of Exim, the user name is also placed
53827 in <varname>$1</varname>. However, the use of this variables for this purpose is now
53828 deprecated, as it can lead to confusion in string expansions that also use
53829 numeric variables for other things.
53830 </para>
53831 <para>
53832 For example, the following authenticator checks that the user name given by the
53833 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
53834 user name, authentication fails.
53835 </para>
53836 <literallayout class="monospaced">
53837 fixed_cram:
53838   driver = cram_md5
53839   public_name = CRAM-MD5
53840   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
53841   server_set_id = $auth1
53842 </literallayout>
53843 <para>
53844 <indexterm role="variable">
53845 <primary><varname>$authenticated_id</varname></primary>
53846 </indexterm>
53847 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
53848 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
53849 secret string in a file, using the user name as the key. For example:
53850 </para>
53851 <literallayout class="monospaced">
53852 lookup_cram:
53853   driver = cram_md5
53854   public_name = CRAM-MD5
53855   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
53856                   {$value}fail}
53857   server_set_id = $auth1
53858 </literallayout>
53859 <para>
53860 Note that this expansion explicitly forces failure if the lookup fails
53861 because <varname>$auth1</varname> contains an unknown user name.
53862 </para>
53863 <para>
53864 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
53865 using the relevant libraries, you need to know the realm to specify in the
53866 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
53867 realm, with:
53868 </para>
53869 <literallayout class="monospaced">
53870 cyrusless_crammd5:
53871   driver = cram_md5
53872   public_name = CRAM-MD5
53873   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
53874                   dbmjz{/etc/sasldb2}{$value}fail}
53875   server_set_id = $auth1
53876 </literallayout>
53877 </section>
53878 <section id="SECID177">
53879 <title>Using cram_md5 as a client</title>
53880 <para>
53881 <indexterm role="concept">
53882 <primary>options</primary>
53883 <secondary><command>cram_md5</command> authenticator (client)</secondary>
53884 </indexterm>
53885 When used as a client, the <command>cram_md5</command> authenticator has two options:
53886 </para>
53887 <para>
53888 <indexterm role="option">
53889 <primary><option>client_name</option></primary>
53890 </indexterm>
53891 </para>
53892 <informaltable frame="all">
53893 <tgroup cols="4" colsep="0" rowsep="0">
53894 <colspec colwidth="8*" align="left"/>
53895 <colspec colwidth="6*" align="center"/>
53896 <colspec colwidth="6*" align="center"/>
53897 <colspec colwidth="6*" align="right"/>
53898 <tbody>
53899 <row>
53900 <entry><option>client_name</option></entry>
53901 <entry>Use: <emphasis>cram_md5</emphasis></entry>
53902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53903 <entry>Default: <emphasis>the primary host name</emphasis></entry>
53904 </row>
53905 </tbody>
53906 </tgroup>
53907 </informaltable>
53908 <para>
53909 This string is expanded, and the result used as the user name data when
53910 computing the response to the server&#x2019;s challenge.
53911 </para>
53912 <para>
53913 <indexterm role="option">
53914 <primary><option>client_secret</option></primary>
53915 </indexterm>
53916 </para>
53917 <informaltable frame="all">
53918 <tgroup cols="4" colsep="0" rowsep="0">
53919 <colspec colwidth="8*" align="left"/>
53920 <colspec colwidth="6*" align="center"/>
53921 <colspec colwidth="6*" align="center"/>
53922 <colspec colwidth="6*" align="right"/>
53923 <tbody>
53924 <row>
53925 <entry><option>client_secret</option></entry>
53926 <entry>Use: <emphasis>cram_md5</emphasis></entry>
53927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53928 <entry>Default: <emphasis>unset</emphasis></entry>
53929 </row>
53930 </tbody>
53931 </tgroup>
53932 </informaltable>
53933 <para>
53934 This option must be set for the authenticator to work as a client. Its value is
53935 expanded and the result used as the secret string when computing the response.
53936 </para>
53937 <para>
53938 <indexterm role="variable">
53939 <primary><varname>$host</varname></primary>
53940 </indexterm>
53941 <indexterm role="variable">
53942 <primary><varname>$host_address</varname></primary>
53943 </indexterm>
53944 Different user names and secrets can be used for different servers by referring
53945 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
53946 expansion string is treated as an indication that this authenticator is not
53947 prepared to handle this case. Exim moves on to the next configured client
53948 authenticator. Any other expansion failure causes Exim to give up trying to
53949 send the message to the current server.
53950 </para>
53951 <para>
53952 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
53953 strings, is:
53954 </para>
53955 <literallayout class="monospaced">
53956 fixed_cram:
53957   driver = cram_md5
53958   public_name = CRAM-MD5
53959   client_name = ph10
53960   client_secret = secret
53961 </literallayout>
53962 <para>
53963 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
53964 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
53965 </para>
53966 </section>
53967 </chapter>
53968
53969 <chapter id="CHID10">
53970 <title>The cyrus_sasl authenticator</title>
53971 <para>
53972 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
53973 <primary><command>cyrus_sasl</command> authenticator</primary>
53974 </indexterm>
53975 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
53976 <primary>authenticators</primary>
53977 <secondary><command>cyrus_sasl</command></secondary>
53978 </indexterm>
53979 <indexterm role="concept">
53980 <primary>Cyrus</primary>
53981 <secondary>SASL library</secondary>
53982 </indexterm>
53983 <indexterm role="concept">
53984 <primary>Kerberos</primary>
53985 </indexterm>
53986 The code for this authenticator was provided by Matthew Byng-Maddick while
53987 at A L Digital Ltd.
53988 </para>
53989 <para>
53990 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
53991 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
53992 Layer</quote>). This library supports a number of authentication mechanisms,
53993 including PLAIN and LOGIN, but also several others that Exim does not support
53994 directly. In particular, there is support for Kerberos authentication.
53995 </para>
53996 <para>
53997 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
53998 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
53999 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
54000 name of the driver to determine which mechanism to support.
54001 </para>
54002 <para>
54003 Where access to some kind of secret file is required, for example, in GSSAPI
54004 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
54005 user, and that the Cyrus SASL library has no way of escalating privileges
54006 by default. You may also find you need to set environment variables,
54007 depending on the driver you are using.
54008 </para>
54009 <para>
54010 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
54011 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
54012 Kerberos, note that because of limitations in the GSSAPI interface,
54013 changing the server keytab might need to be communicated down to the Kerberos
54014 layer independently. The mechanism for doing so is dependent upon the Kerberos
54015 implementation.
54016 </para>
54017 <para>
54018 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
54019 may be set to point to an alternative keytab file. Exim will pass this
54020 variable through from its own inherited environment when started as root or the
54021 Exim user. The keytab file needs to be readable by the Exim user.
54022 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
54023 environment variable.  In practice, for those releases, the Cyrus authenticator
54024 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
54025 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
54026 </para>
54027 <section id="SECID178">
54028 <title>Using cyrus_sasl as a server</title>
54029 <para>
54030 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
54031 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
54032 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
54033 use of this variable for this purpose is now deprecated, as it can lead to
54034 confusion in string expansions that also use numeric variables for other
54035 things.
54036 </para>
54037 <para>
54038 <indexterm role="option">
54039 <primary><option>server_hostname</option></primary>
54040 </indexterm>
54041 </para>
54042 <informaltable frame="all">
54043 <tgroup cols="4" colsep="0" rowsep="0">
54044 <colspec colwidth="8*" align="left"/>
54045 <colspec colwidth="6*" align="center"/>
54046 <colspec colwidth="6*" align="center"/>
54047 <colspec colwidth="6*" align="right"/>
54048 <tbody>
54049 <row>
54050 <entry><option>server_hostname</option></entry>
54051 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54052 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54053 <entry>Default: <emphasis>see below</emphasis></entry>
54054 </row>
54055 </tbody>
54056 </tgroup>
54057 </informaltable>
54058 <para>
54059 This option selects the hostname that is used when communicating with the
54060 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
54061 SASL plug-in what it does with this data.
54062 </para>
54063 <para>
54064 <indexterm role="option">
54065 <primary><option>server_mech</option></primary>
54066 </indexterm>
54067 </para>
54068 <informaltable frame="all">
54069 <tgroup cols="4" colsep="0" rowsep="0">
54070 <colspec colwidth="8*" align="left"/>
54071 <colspec colwidth="6*" align="center"/>
54072 <colspec colwidth="6*" align="center"/>
54073 <colspec colwidth="6*" align="right"/>
54074 <tbody>
54075 <row>
54076 <entry><option>server_mech</option></entry>
54077 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54078 <entry>Type: <emphasis>string</emphasis></entry>
54079 <entry>Default: <emphasis>see below</emphasis></entry>
54080 </row>
54081 </tbody>
54082 </tgroup>
54083 </informaltable>
54084 <para>
54085 This option selects the authentication mechanism this driver should use. The
54086 default is the value of the generic <option>public_name</option> option. This option allows
54087 you to use a different underlying mechanism from the advertised name. For
54088 example:
54089 </para>
54090 <literallayout class="monospaced">
54091 sasl:
54092   driver = cyrus_sasl
54093   public_name = X-ANYTHING
54094   server_mech = CRAM-MD5
54095   server_set_id = $auth1
54096 </literallayout>
54097 <para>
54098 <indexterm role="option">
54099 <primary><option>server_realm</option></primary>
54100 </indexterm>
54101 </para>
54102 <informaltable frame="all">
54103 <tgroup cols="4" colsep="0" rowsep="0">
54104 <colspec colwidth="8*" align="left"/>
54105 <colspec colwidth="6*" align="center"/>
54106 <colspec colwidth="6*" align="center"/>
54107 <colspec colwidth="6*" align="right"/>
54108 <tbody>
54109 <row>
54110 <entry><option>server_realm</option></entry>
54111 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54113 <entry>Default: <emphasis>unset</emphasis></entry>
54114 </row>
54115 </tbody>
54116 </tgroup>
54117 </informaltable>
54118 <para>
54119 This specifies the SASL realm that the server claims to be in.
54120 </para>
54121 <para>
54122 <indexterm role="option">
54123 <primary><option>server_service</option></primary>
54124 </indexterm>
54125 </para>
54126 <informaltable frame="all">
54127 <tgroup cols="4" colsep="0" rowsep="0">
54128 <colspec colwidth="8*" align="left"/>
54129 <colspec colwidth="6*" align="center"/>
54130 <colspec colwidth="6*" align="center"/>
54131 <colspec colwidth="6*" align="right"/>
54132 <tbody>
54133 <row>
54134 <entry><option>server_service</option></entry>
54135 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54136 <entry>Type: <emphasis>string</emphasis></entry>
54137 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
54138 </row>
54139 </tbody>
54140 </tgroup>
54141 </informaltable>
54142 <para>
54143 This is the SASL service that the server claims to implement.
54144 </para>
54145 <para>
54146 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
54147 private options. All you need to do is to specify an appropriate mechanism as
54148 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
54149 PLAIN, you could have two authenticators as follows:
54150 </para>
54151 <literallayout class="monospaced">
54152 sasl_cram_md5:
54153   driver = cyrus_sasl
54154   public_name = CRAM-MD5
54155   server_set_id = $auth1
54156
54157 sasl_plain:
54158   driver = cyrus_sasl
54159   public_name = PLAIN
54160   server_set_id = $auth2
54161 </literallayout>
54162 <para>
54163 Cyrus SASL does implement the LOGIN authentication method, even though it is
54164 not a standard method. It is disabled by default in the source distribution,
54165 but it is present in many binary distributions.
54166 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
54167 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
54168 </para>
54169 </section>
54170 </chapter>
54171
54172 <chapter id="CHAPdovecot">
54173 <title>The dovecot authenticator</title>
54174 <para>
54175 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
54176 <primary><command>dovecot</command> authenticator</primary>
54177 </indexterm>
54178 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
54179 <primary>authenticators</primary>
54180 <secondary><command>dovecot</command></secondary>
54181 </indexterm>
54182 This authenticator is an interface to the authentication facility of the
54183 Dovecot 2 POP/IMAP server, which can support a number of authentication methods.
54184 Note that Dovecot must be configured to use auth-client not auth-userdb.
54185 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
54186 to use the same mechanisms for SMTP authentication. This is a server
54187 authenticator only. There is only one option:
54188 </para>
54189 <para>
54190 <indexterm role="option">
54191 <primary><option>server_socket</option></primary>
54192 </indexterm>
54193 </para>
54194 <informaltable frame="all">
54195 <tgroup cols="4" colsep="0" rowsep="0">
54196 <colspec colwidth="8*" align="left"/>
54197 <colspec colwidth="6*" align="center"/>
54198 <colspec colwidth="6*" align="center"/>
54199 <colspec colwidth="6*" align="right"/>
54200 <tbody>
54201 <row>
54202 <entry><option>server_socket</option></entry>
54203 <entry>Use: <emphasis>dovecot</emphasis></entry>
54204 <entry>Type: <emphasis>string</emphasis></entry>
54205 <entry>Default: <emphasis>unset</emphasis></entry>
54206 </row>
54207 </tbody>
54208 </tgroup>
54209 </informaltable>
54210 <para>
54211 This option must specify the UNIX socket that is the interface to Dovecot
54212 authentication. The <option>public_name</option> option must specify an authentication
54213 mechanism that Dovecot is configured to support. You can have several
54214 authenticators for different mechanisms. For example:
54215 </para>
54216 <literallayout class="monospaced">
54217 dovecot_plain:
54218   driver = dovecot
54219   public_name = PLAIN
54220   server_socket = /var/run/dovecot/auth-client
54221   server_set_id = $auth1
54222
54223 dovecot_ntlm:
54224   driver = dovecot
54225   public_name = NTLM
54226   server_socket = /var/run/dovecot/auth-client
54227   server_set_id = $auth1
54228 </literallayout>
54229 <para>
54230 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
54231 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
54232 option is passed in the Dovecot authentication command. If, for a TLS
54233 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
54234 option is passed. When authentication succeeds, the identity of the user
54235 who authenticated is placed in <varname>$auth1</varname>.
54236 </para>
54237 <para revisionflag="changed">
54238 The Dovecot configuration to match the above wil look
54239 something like:
54240 </para>
54241 <literallayout class="monospaced" revisionflag="changed">
54242 conf.d/10-master.conf :-
54243
54244 service auth {
54245 ...
54246 #SASL
54247   unix_listener auth-client {
54248     mode = 0660
54249     user = mail
54250   }
54251 ...
54252 }
54253
54254 conf.d/10-auth.conf :-
54255
54256 auth_mechanisms = plain login ntlm
54257 </literallayout>
54258 <para>
54259 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
54260 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
54261 </para>
54262 </chapter>
54263
54264 <chapter id="CHAPgsasl">
54265 <title>The gsasl authenticator</title>
54266 <para>
54267 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
54268 <primary><command>gsasl</command> authenticator</primary>
54269 </indexterm>
54270 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
54271 <primary>authenticators</primary>
54272 <secondary><command>gsasl</command></secondary>
54273 </indexterm>
54274 <indexterm role="concept">
54275 <primary>authentication</primary>
54276 <secondary>GNU SASL</secondary>
54277 </indexterm>
54278 <indexterm role="concept">
54279 <primary>authentication</primary>
54280 <secondary>SASL</secondary>
54281 </indexterm>
54282 <indexterm role="concept">
54283 <primary>authentication</primary>
54284 <secondary>EXTERNAL</secondary>
54285 </indexterm>
54286 <indexterm role="concept">
54287 <primary>authentication</primary>
54288 <secondary>ANONYMOUS</secondary>
54289 </indexterm>
54290 <indexterm role="concept">
54291 <primary>authentication</primary>
54292 <secondary>PLAIN</secondary>
54293 </indexterm>
54294 <indexterm role="concept">
54295 <primary>authentication</primary>
54296 <secondary>LOGIN</secondary>
54297 </indexterm>
54298 <indexterm role="concept">
54299 <primary>authentication</primary>
54300 <secondary>DIGEST-MD5</secondary>
54301 </indexterm>
54302 <indexterm role="concept">
54303 <primary>authentication</primary>
54304 <secondary>CRAM-MD5</secondary>
54305 </indexterm>
54306 <indexterm role="concept">
54307 <primary>authentication</primary>
54308 <secondary>SCRAM family</secondary>
54309 </indexterm>
54310 The <command>gsasl</command> authenticator provides integration for the GNU SASL
54311 library and the mechanisms it provides.  This is new as of the 4.80 release
54312 and there are a few areas where the library does not let Exim smoothly
54313 scale to handle future authentication mechanisms, so no guarantee can be
54314 made that any particular new authentication mechanism will be supported
54315 without code changes in Exim.
54316 </para>
54317 <para revisionflag="changed">
54318 The library is expected to add support in an upcoming
54319 realease for the SCRAM-SHA-256 method.
54320 The macro _HAVE_AUTH_GSASL_SCRAM_SHA_256 will be defined
54321 when this happens.
54322 </para>
54323 <para revisionflag="changed">
54324 <indexterm role="option">
54325 <primary><option>client_authz</option></primary>
54326 </indexterm>
54327 </para>
54328 <informaltable frame="all" revisionflag="changed">
54329 <tgroup cols="4" colsep="0" rowsep="0">
54330 <colspec colwidth="8*" align="left"/>
54331 <colspec colwidth="6*" align="center"/>
54332 <colspec colwidth="6*" align="center"/>
54333 <colspec colwidth="6*" align="right"/>
54334 <tbody>
54335 <row>
54336 <entry><option>client_authz</option></entry>
54337 <entry>Use: <emphasis>gsasl</emphasis></entry>
54338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54339 <entry>Default: <emphasis>unset</emphasis></entry>
54340 </row>
54341 </tbody>
54342 </tgroup>
54343 </informaltable>
54344 <para revisionflag="changed">
54345 This option can be used to supply an <emphasis>authorization id</emphasis>
54346 which is different to the <emphasis>authentication_id</emphasis> provided
54347 by <option>client_username</option> option.
54348 If unset or (after expansion) empty it is not used,
54349 which is the common case.
54350 </para>
54351 <para revisionflag="changed">
54352 <indexterm role="option">
54353 <primary><option>client_channelbinding</option></primary>
54354 </indexterm>
54355 </para>
54356 <informaltable frame="all" revisionflag="changed">
54357 <tgroup cols="4" colsep="0" rowsep="0">
54358 <colspec colwidth="8*" align="left"/>
54359 <colspec colwidth="6*" align="center"/>
54360 <colspec colwidth="6*" align="center"/>
54361 <colspec colwidth="6*" align="right"/>
54362 <tbody>
54363 <row>
54364 <entry><option>client_channelbinding</option></entry>
54365 <entry>Use: <emphasis>gsasl</emphasis></entry>
54366 <entry>Type: <emphasis>boolean</emphasis></entry>
54367 <entry>Default: <emphasis>false</emphasis></entry>
54368 </row>
54369 </tbody>
54370 </tgroup>
54371 </informaltable>
54372 <para revisionflag="changed">
54373 See <option>server_channelbinding</option> below.
54374 </para>
54375 <para revisionflag="changed">
54376 <indexterm role="option">
54377 <primary><option>client_password</option></primary>
54378 </indexterm>
54379 </para>
54380 <informaltable frame="all" revisionflag="changed">
54381 <tgroup cols="4" colsep="0" rowsep="0">
54382 <colspec colwidth="8*" align="left"/>
54383 <colspec colwidth="6*" align="center"/>
54384 <colspec colwidth="6*" align="center"/>
54385 <colspec colwidth="6*" align="right"/>
54386 <tbody>
54387 <row>
54388 <entry><option>client_password</option></entry>
54389 <entry>Use: <emphasis>gsasl</emphasis></entry>
54390 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54391 <entry>Default: <emphasis>unset</emphasis></entry>
54392 </row>
54393 </tbody>
54394 </tgroup>
54395 </informaltable>
54396 <para revisionflag="changed">
54397 This option is exapanded before use, and should result in
54398 the password to be used, in clear.
54399 </para>
54400 <para revisionflag="changed">
54401 <indexterm role="option">
54402 <primary><option>client_username</option></primary>
54403 </indexterm>
54404 </para>
54405 <informaltable frame="all" revisionflag="changed">
54406 <tgroup cols="4" colsep="0" rowsep="0">
54407 <colspec colwidth="8*" align="left"/>
54408 <colspec colwidth="6*" align="center"/>
54409 <colspec colwidth="6*" align="center"/>
54410 <colspec colwidth="6*" align="right"/>
54411 <tbody>
54412 <row>
54413 <entry><option>client_username</option></entry>
54414 <entry>Use: <emphasis>gsasl</emphasis></entry>
54415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54416 <entry>Default: <emphasis>unset</emphasis></entry>
54417 </row>
54418 </tbody>
54419 </tgroup>
54420 </informaltable>
54421 <para revisionflag="changed">
54422 This option is exapanded before use, and should result in
54423 the account name to be used.
54424 </para>
54425 <para revisionflag="changed">
54426 <indexterm role="option">
54427 <primary><option>client_spassword</option></primary>
54428 </indexterm>
54429 </para>
54430 <informaltable frame="all" revisionflag="changed">
54431 <tgroup cols="4" colsep="0" rowsep="0">
54432 <colspec colwidth="8*" align="left"/>
54433 <colspec colwidth="6*" align="center"/>
54434 <colspec colwidth="6*" align="center"/>
54435 <colspec colwidth="6*" align="right"/>
54436 <tbody>
54437 <row>
54438 <entry><option>client_spassword</option></entry>
54439 <entry>Use: <emphasis>gsasl</emphasis></entry>
54440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54441 <entry>Default: <emphasis>unset</emphasis></entry>
54442 </row>
54443 </tbody>
54444 </tgroup>
54445 </informaltable>
54446 <para revisionflag="changed">
54447 If a SCRAM mechanism is being used and this option is set
54448 it is used in preference to <option>client_password</option>.
54449 The value after expansion should be
54450 a 40 (for SHA-1) or 64 (for SHA-256) character string
54451 with the PBKDF2-prepared password, hex-encoded.
54452 Note that this value will depend on the salt and iteration-count
54453 supplied by the server.
54454 </para>
54455 <para>
54456 <indexterm role="option">
54457 <primary><option>server_channelbinding</option></primary>
54458 </indexterm>
54459 </para>
54460 <informaltable frame="all">
54461 <tgroup cols="4" colsep="0" rowsep="0">
54462 <colspec colwidth="8*" align="left"/>
54463 <colspec colwidth="6*" align="center"/>
54464 <colspec colwidth="6*" align="center"/>
54465 <colspec colwidth="6*" align="right"/>
54466 <tbody>
54467 <row>
54468 <entry><option>server_channelbinding</option></entry>
54469 <entry>Use: <emphasis>gsasl</emphasis></entry>
54470 <entry>Type: <emphasis>boolean</emphasis></entry>
54471 <entry>Default: <emphasis>false</emphasis></entry>
54472 </row>
54473 </tbody>
54474 </tgroup>
54475 </informaltable>
54476 <para>
54477 Do not set this true and rely on the properties
54478 without consulting a cryptographic engineer.
54479 </para>
54480 <para>
54481 Some authentication mechanisms are able to use external context at both ends
54482 of the session to bind the authentication to that context, and fail the
54483 authentication process if that context differs.  Specifically, some TLS
54484 ciphersuites can provide identifying information about the cryptographic
54485 context.
54486 </para>
54487 <para>
54488 This should have meant that certificate identity and verification becomes a
54489 non-issue, as a man-in-the-middle attack will cause the correct client and
54490 server to see different identifiers and authentication will fail.
54491 </para>
54492 <para revisionflag="changed">
54493 This is
54494 only usable by mechanisms which support "channel binding"; at time of
54495 writing, that&#x2019;s the SCRAM family.
54496 When using this feature the "-PLUS" variants of the method names need to be used.
54497 </para>
54498 <para>
54499 This defaults off to ensure smooth upgrade across Exim releases, in case
54500 this option causes some clients to start failing.  Some future release
54501 of Exim might have switched the default to be true.
54502 </para>
54503 <para>
54504 However, Channel Binding in TLS has proven to be vulnerable in current versions.
54505 Do not plan to rely upon this feature for security, ever, without consulting
54506 with a subject matter expert (a cryptographic engineer).
54507 </para>
54508 <para>
54509 <indexterm role="option">
54510 <primary><option>server_hostname</option></primary>
54511 </indexterm>
54512 </para>
54513 <informaltable frame="all">
54514 <tgroup cols="4" colsep="0" rowsep="0">
54515 <colspec colwidth="8*" align="left"/>
54516 <colspec colwidth="6*" align="center"/>
54517 <colspec colwidth="6*" align="center"/>
54518 <colspec colwidth="6*" align="right"/>
54519 <tbody>
54520 <row>
54521 <entry><option>server_hostname</option></entry>
54522 <entry>Use: <emphasis>gsasl</emphasis></entry>
54523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54524 <entry>Default: <emphasis>see below</emphasis></entry>
54525 </row>
54526 </tbody>
54527 </tgroup>
54528 </informaltable>
54529 <para>
54530 This option selects the hostname that is used when communicating with the
54531 library. The default value is <literal>$primary_hostname</literal>.
54532 Some mechanisms will use this data.
54533 </para>
54534 <para>
54535 <indexterm role="option">
54536 <primary><option>server_mech</option></primary>
54537 </indexterm>
54538 </para>
54539 <informaltable frame="all">
54540 <tgroup cols="4" colsep="0" rowsep="0">
54541 <colspec colwidth="8*" align="left"/>
54542 <colspec colwidth="6*" align="center"/>
54543 <colspec colwidth="6*" align="center"/>
54544 <colspec colwidth="6*" align="right"/>
54545 <tbody>
54546 <row>
54547 <entry><option>server_mech</option></entry>
54548 <entry>Use: <emphasis>gsasl</emphasis></entry>
54549 <entry>Type: <emphasis>string</emphasis></entry>
54550 <entry>Default: <emphasis>see below</emphasis></entry>
54551 </row>
54552 </tbody>
54553 </tgroup>
54554 </informaltable>
54555 <para>
54556 This option selects the authentication mechanism this driver should use. The
54557 default is the value of the generic <option>public_name</option> option. This option allows
54558 you to use a different underlying mechanism from the advertised name. For
54559 example:
54560 </para>
54561 <literallayout class="monospaced">
54562 sasl:
54563   driver = gsasl
54564   public_name = X-ANYTHING
54565   server_mech = CRAM-MD5
54566   server_set_id = $auth1
54567 </literallayout>
54568 <para>
54569 <indexterm role="option">
54570 <primary><option>server_password</option></primary>
54571 </indexterm>
54572 </para>
54573 <informaltable frame="all">
54574 <tgroup cols="4" colsep="0" rowsep="0">
54575 <colspec colwidth="8*" align="left"/>
54576 <colspec colwidth="6*" align="center"/>
54577 <colspec colwidth="6*" align="center"/>
54578 <colspec colwidth="6*" align="right"/>
54579 <tbody>
54580 <row>
54581 <entry><option>server_password</option></entry>
54582 <entry>Use: <emphasis>gsasl</emphasis></entry>
54583 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54584 <entry>Default: <emphasis>unset</emphasis></entry>
54585 </row>
54586 </tbody>
54587 </tgroup>
54588 </informaltable>
54589 <para>
54590 Various mechanisms need access to the cleartext password on the server, so
54591 that proof-of-possession can be demonstrated on the wire, without sending
54592 the password itself.
54593 </para>
54594 <para>
54595 The data available for lookup varies per mechanism.
54596 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
54597 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
54598 if available, else the empty string.
54599 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
54600 else the empty string.
54601 </para>
54602 <para>
54603 A forced failure will cause authentication to defer.
54604 </para>
54605 <para>
54606 If using this option, it may make sense to set the <option>server_condition</option>
54607 option to be simply "true".
54608 </para>
54609 <para>
54610 <indexterm role="option">
54611 <primary><option>server_realm</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_realm</option></entry>
54623 <entry>Use: <emphasis>gsasl</emphasis></entry>
54624 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54625 <entry>Default: <emphasis>unset</emphasis></entry>
54626 </row>
54627 </tbody>
54628 </tgroup>
54629 </informaltable>
54630 <para>
54631 This specifies the SASL realm that the server claims to be in.
54632 Some mechanisms will use this data.
54633 </para>
54634 <para>
54635 <indexterm role="option">
54636 <primary><option>server_scram_iter</option></primary>
54637 </indexterm>
54638 </para>
54639 <informaltable frame="all">
54640 <tgroup cols="4" colsep="0" rowsep="0">
54641 <colspec colwidth="8*" align="left"/>
54642 <colspec colwidth="6*" align="center"/>
54643 <colspec colwidth="6*" align="center"/>
54644 <colspec colwidth="6*" align="right"/>
54645 <tbody>
54646 <row>
54647 <entry><option>server_scram_iter</option></entry>
54648 <entry>Use: <emphasis>gsasl</emphasis></entry>
54649 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54650 <entry>Default: <emphasis>4096</emphasis></entry>
54651 </row>
54652 </tbody>
54653 </tgroup>
54654 </informaltable>
54655 <para>
54656 This option provides data for the SCRAM family of mechanisms.
54657 </para>
54658 <para revisionflag="changed">
54659 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
54660 when this option is expanded.
54661 </para>
54662 <para revisionflag="changed">
54663 The result of expansion should be a decimal number,
54664 and represents both a lower-bound on the security, and
54665 a compute cost factor imposed on the client
54666 (if it does not cache results, or the server changes
54667 either the iteration count or the salt).
54668 A minimum value of 4096 is required by the standards
54669 for all current SCRAM mechanism variants.
54670 </para>
54671 <para>
54672 <indexterm role="option">
54673 <primary><option>server_scram_salt</option></primary>
54674 </indexterm>
54675 </para>
54676 <informaltable frame="all">
54677 <tgroup cols="4" colsep="0" rowsep="0">
54678 <colspec colwidth="8*" align="left"/>
54679 <colspec colwidth="6*" align="center"/>
54680 <colspec colwidth="6*" align="center"/>
54681 <colspec colwidth="6*" align="right"/>
54682 <tbody>
54683 <row>
54684 <entry><option>server_scram_salt</option></entry>
54685 <entry>Use: <emphasis>gsasl</emphasis></entry>
54686 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54687 <entry>Default: <emphasis>unset</emphasis></entry>
54688 </row>
54689 </tbody>
54690 </tgroup>
54691 </informaltable>
54692 <para>
54693 This option provides data for the SCRAM family of mechanisms.
54694 </para>
54695 <para revisionflag="changed">
54696 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
54697 when this option is expanded.
54698 The value should be a base64-encoded string,
54699 of random data typically 4-to-16 bytes long.
54700 If unset or empty after expansion the library will provides a value for the
54701 protocol conversation.
54702 </para>
54703 <para revisionflag="changed">
54704 <indexterm role="option">
54705 <primary><option>server_key</option></primary>
54706 </indexterm>
54707 </para>
54708 <informaltable frame="all" revisionflag="changed">
54709 <tgroup cols="4" colsep="0" rowsep="0">
54710 <colspec colwidth="8*" align="left"/>
54711 <colspec colwidth="6*" align="center"/>
54712 <colspec colwidth="6*" align="center"/>
54713 <colspec colwidth="6*" align="right"/>
54714 <tbody>
54715 <row>
54716 <entry><option>server_key</option></entry>
54717 <entry>Use: <emphasis>gsasl</emphasis></entry>
54718 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54719 <entry>Default: <emphasis>unset</emphasis></entry>
54720 </row>
54721 </tbody>
54722 </tgroup>
54723 </informaltable>
54724 <para revisionflag="changed">
54725 <indexterm role="option">
54726 <primary><option>server_skey</option></primary>
54727 </indexterm>
54728 </para>
54729 <informaltable frame="all" revisionflag="changed">
54730 <tgroup cols="4" colsep="0" rowsep="0">
54731 <colspec colwidth="8*" align="left"/>
54732 <colspec colwidth="6*" align="center"/>
54733 <colspec colwidth="6*" align="center"/>
54734 <colspec colwidth="6*" align="right"/>
54735 <tbody>
54736 <row>
54737 <entry><option>server_skey</option></entry>
54738 <entry>Use: <emphasis>gsasl</emphasis></entry>
54739 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54740 <entry>Default: <emphasis>unset</emphasis></entry>
54741 </row>
54742 </tbody>
54743 </tgroup>
54744 </informaltable>
54745 <para revisionflag="changed">
54746 These options can be used for the SCRAM family of mechanisms
54747 to provide stored information related to a password,
54748 the storage of which is preferable to plaintext.
54749 </para>
54750 <para revisionflag="changed">
54751 <option>server_key</option> is the value defined in the SCRAM standards as ServerKey;
54752 <option>server_skey</option> is StoredKey.
54753 </para>
54754 <para revisionflag="changed">
54755 They are only available for version 1.9.0 (or later) of the gsasl library.
54756 When this is so, the macros
54757 _OPT_AUTHENTICATOR_GSASL_SERVER_KEY
54758 and _HAVE_AUTH_GSASL_SCRAM_S_KEY
54759 will be defined.
54760 </para>
54761 <para revisionflag="changed">
54762 The <varname>$authN</varname> variables are available when these options are expanded.
54763 </para>
54764 <para revisionflag="changed">
54765 If set, the results of expansion should for each
54766 should be a 28 (for SHA-1) or 44 (for SHA-256) character string
54767 of base64-coded data, and will be used in preference to the
54768 <option>server_password</option> option.
54769 If unset or not of the right length, <option>server_password</option> will be used.
54770 </para>
54771 <para revisionflag="changed">
54772 The libgsasl library release includes a utility <emphasis>gsasl</emphasis> which can be used
54773 to generate these values.
54774 </para>
54775 <para>
54776 <indexterm role="option">
54777 <primary><option>server_service</option></primary>
54778 </indexterm>
54779 </para>
54780 <informaltable frame="all">
54781 <tgroup cols="4" colsep="0" rowsep="0">
54782 <colspec colwidth="8*" align="left"/>
54783 <colspec colwidth="6*" align="center"/>
54784 <colspec colwidth="6*" align="center"/>
54785 <colspec colwidth="6*" align="right"/>
54786 <tbody>
54787 <row>
54788 <entry><option>server_service</option></entry>
54789 <entry>Use: <emphasis>gsasl</emphasis></entry>
54790 <entry>Type: <emphasis>string</emphasis></entry>
54791 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
54792 </row>
54793 </tbody>
54794 </tgroup>
54795 </informaltable>
54796 <para>
54797 This is the SASL service that the server claims to implement.
54798 Some mechanisms will use this data.
54799 </para>
54800 <section id="SECTgsaslauthvar">
54801 <title><command>gsasl</command> auth variables</title>
54802 <para>
54803 <indexterm role="variable">
54804 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
54805 </indexterm>
54806 These may be set when evaluating specific options, as detailed above.
54807 They will also be set when evaluating <option>server_condition</option>.
54808 </para>
54809 <para>
54810 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
54811 meanings for these variables:
54812 </para>
54813 <itemizedlist>
54814 <listitem>
54815 <para>
54816 <indexterm role="variable">
54817 <primary><varname>$auth1</varname></primary>
54818 </indexterm>
54819 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
54820 </para>
54821 </listitem>
54822 <listitem>
54823 <para>
54824 <indexterm role="variable">
54825 <primary><varname>$auth2</varname></primary>
54826 </indexterm>
54827 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
54828 </para>
54829 </listitem>
54830 <listitem>
54831 <para>
54832 <indexterm role="variable">
54833 <primary><varname>$auth3</varname></primary>
54834 </indexterm>
54835 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
54836 </para>
54837 </listitem>
54838 </itemizedlist>
54839 <para>
54840 On a per-mechanism basis:
54841 </para>
54842 <itemizedlist>
54843 <listitem>
54844 <para>
54845 <indexterm role="concept">
54846 <primary>authentication</primary>
54847 <secondary>EXTERNAL</secondary>
54848 </indexterm>
54849 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
54850 the <option>server_condition</option> option must be present.
54851 </para>
54852 </listitem>
54853 <listitem>
54854 <para>
54855 <indexterm role="concept">
54856 <primary>authentication</primary>
54857 <secondary>ANONYMOUS</secondary>
54858 </indexterm>
54859 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
54860 the <option>server_condition</option> option must be present.
54861 </para>
54862 </listitem>
54863 <listitem>
54864 <para>
54865 <indexterm role="concept">
54866 <primary>authentication</primary>
54867 <secondary>GSSAPI</secondary>
54868 </indexterm>
54869 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
54870 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
54871 the <option>server_condition</option> option must be present.
54872 </para>
54873 </listitem>
54874 </itemizedlist>
54875 <para>
54876 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
54877 identifier; this is analogous to FTP anonymous authentication passing an
54878 email address, or software-identifier@, as the "password".
54879 </para>
54880 <para>
54881 An example showing the password having the realm specified in the callback
54882 and demonstrating a Cyrus SASL to GSASL migration approach is:
54883 </para>
54884 <literallayout class="monospaced">
54885 gsasl_cyrusless_crammd5:
54886   driver = gsasl
54887   public_name = CRAM-MD5
54888   server_realm = imap.example.org
54889   server_password = ${lookup{$auth1:$auth3:userPassword}\
54890                     dbmjz{/etc/sasldb2}{$value}fail}
54891   server_set_id = ${quote:$auth1}
54892   server_condition = yes
54893 </literallayout>
54894 </section>
54895 </chapter>
54896
54897 <chapter id="CHAPheimdalgss">
54898 <title>The heimdal_gssapi authenticator</title>
54899 <para>
54900 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
54901 <primary><command>heimdal_gssapi</command> authenticator</primary>
54902 </indexterm>
54903 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
54904 <primary>authenticators</primary>
54905 <secondary><command>heimdal_gssapi</command></secondary>
54906 </indexterm>
54907 <indexterm role="concept">
54908 <primary>authentication</primary>
54909 <secondary>GSSAPI</secondary>
54910 </indexterm>
54911 <indexterm role="concept">
54912 <primary>authentication</primary>
54913 <secondary>Kerberos</secondary>
54914 </indexterm>
54915 The <command>heimdal_gssapi</command> authenticator provides server integration for the
54916 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
54917 reliably.
54918 </para>
54919 <para>
54920 <indexterm role="option">
54921 <primary><option>server_hostname</option></primary>
54922 </indexterm>
54923 </para>
54924 <informaltable frame="all">
54925 <tgroup cols="4" colsep="0" rowsep="0">
54926 <colspec colwidth="8*" align="left"/>
54927 <colspec colwidth="6*" align="center"/>
54928 <colspec colwidth="6*" align="center"/>
54929 <colspec colwidth="6*" align="right"/>
54930 <tbody>
54931 <row>
54932 <entry><option>server_hostname</option></entry>
54933 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
54934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54935 <entry>Default: <emphasis>see below</emphasis></entry>
54936 </row>
54937 </tbody>
54938 </tgroup>
54939 </informaltable>
54940 <para>
54941 This option selects the hostname that is used, with <option>server_service</option>,
54942 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
54943 identifier.  The default value is <literal>$primary_hostname</literal>.
54944 </para>
54945 <para>
54946 <indexterm role="option">
54947 <primary><option>server_keytab</option></primary>
54948 </indexterm>
54949 </para>
54950 <informaltable frame="all">
54951 <tgroup cols="4" colsep="0" rowsep="0">
54952 <colspec colwidth="8*" align="left"/>
54953 <colspec colwidth="6*" align="center"/>
54954 <colspec colwidth="6*" align="center"/>
54955 <colspec colwidth="6*" align="right"/>
54956 <tbody>
54957 <row>
54958 <entry><option>server_keytab</option></entry>
54959 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
54960 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54961 <entry>Default: <emphasis>unset</emphasis></entry>
54962 </row>
54963 </tbody>
54964 </tgroup>
54965 </informaltable>
54966 <para>
54967 If set, then Heimdal will not use the system default keytab (typically
54968 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
54969 The value should be a pathname, with no <quote>file:</quote> prefix.
54970 </para>
54971 <para>
54972 <indexterm role="option">
54973 <primary><option>server_service</option></primary>
54974 </indexterm>
54975 </para>
54976 <informaltable frame="all">
54977 <tgroup cols="4" colsep="0" rowsep="0">
54978 <colspec colwidth="8*" align="left"/>
54979 <colspec colwidth="6*" align="center"/>
54980 <colspec colwidth="6*" align="center"/>
54981 <colspec colwidth="6*" align="right"/>
54982 <tbody>
54983 <row>
54984 <entry><option>server_service</option></entry>
54985 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
54986 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54987 <entry>Default: <emphasis>smtp</emphasis></entry>
54988 </row>
54989 </tbody>
54990 </tgroup>
54991 </informaltable>
54992 <para>
54993 This option specifies the service identifier used, in conjunction with
54994 <option>server_hostname</option>, for building the identifier for finding credentials
54995 from the keytab.
54996 </para>
54997 <section id="SECTheimdalgssauthvar">
54998 <title><command>heimdal_gssapi</command> auth variables</title>
54999 <para>
55000 Beware that these variables will typically include a realm, thus will appear
55001 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
55002 not verified, so a malicious client can set it to anything.
55003 </para>
55004 <para>
55005 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
55006 Distribution Center.  Note that these are not quite email addresses.
55007 Each identifier is for a role, and so the left-hand-side may include a
55008 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
55009 </para>
55010 <para>
55011 <indexterm role="variable">
55012 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
55013 </indexterm>
55014 </para>
55015 <itemizedlist>
55016 <listitem>
55017 <para>
55018 <indexterm role="variable">
55019 <primary><varname>$auth1</varname></primary>
55020 </indexterm>
55021 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
55022 </para>
55023 </listitem>
55024 <listitem>
55025 <para>
55026 <indexterm role="variable">
55027 <primary><varname>$auth2</varname></primary>
55028 </indexterm>
55029 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
55030 authentication.  If that was empty, this will also be set to the
55031 GSS Display Name.
55032 </para>
55033 </listitem>
55034 </itemizedlist>
55035 </section>
55036 </chapter>
55037
55038 <chapter id="CHAPspa">
55039 <title>The spa authenticator</title>
55040 <para>
55041 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
55042 <primary><command>spa</command> authenticator</primary>
55043 </indexterm>
55044 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
55045 <primary>authenticators</primary>
55046 <secondary><command>spa</command></secondary>
55047 </indexterm>
55048 <indexterm role="concept">
55049 <primary>authentication</primary>
55050 <secondary>Microsoft Secure Password</secondary>
55051 </indexterm>
55052 <indexterm role="concept">
55053 <primary>authentication</primary>
55054 <secondary>NTLM</secondary>
55055 </indexterm>
55056 <indexterm role="concept">
55057 <primary>Microsoft Secure Password Authentication</primary>
55058 </indexterm>
55059 <indexterm role="concept">
55060 <primary>NTLM authentication</primary>
55061 </indexterm>
55062 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
55063 Password Authentication</emphasis> mechanism,
55064 which is also sometimes known as NTLM (NT LanMan). The code for client side of
55065 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
55066 taken from the Samba project (<emphasis role="bold"><ulink url="https://www.samba.org/">https://www.samba.org/</ulink></emphasis>). The code for the
55067 server side was subsequently contributed by Tom Kistner. The mechanism works as
55068 follows:
55069 </para>
55070 <itemizedlist>
55071 <listitem>
55072 <para>
55073 After the AUTH command has been accepted, the client sends an SPA
55074 authentication request based on the user name and optional domain.
55075 </para>
55076 </listitem>
55077 <listitem>
55078 <para>
55079 The server sends back a challenge.
55080 </para>
55081 </listitem>
55082 <listitem>
55083 <para>
55084 The client builds a challenge response which makes use of the user&#x2019;s password
55085 and sends it to the server, which then accepts or rejects it.
55086 </para>
55087 </listitem>
55088 </itemizedlist>
55089 <para>
55090 Encryption is used to protect the password in transit.
55091 </para>
55092 <section id="SECID179">
55093 <title>Using spa as a server</title>
55094 <para>
55095 <indexterm role="concept">
55096 <primary>options</primary>
55097 <secondary><command>spa</command> authenticator (server)</secondary>
55098 </indexterm>
55099 The <command>spa</command> authenticator has just one server option:
55100 </para>
55101 <para>
55102 <indexterm role="option">
55103 <primary><option>server_password</option></primary>
55104 </indexterm>
55105 </para>
55106 <informaltable frame="all">
55107 <tgroup cols="4" colsep="0" rowsep="0">
55108 <colspec colwidth="8*" align="left"/>
55109 <colspec colwidth="6*" align="center"/>
55110 <colspec colwidth="6*" align="center"/>
55111 <colspec colwidth="6*" align="right"/>
55112 <tbody>
55113 <row>
55114 <entry><option>server_password</option></entry>
55115 <entry>Use: <emphasis>spa</emphasis></entry>
55116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55117 <entry>Default: <emphasis>unset</emphasis></entry>
55118 </row>
55119 </tbody>
55120 </tgroup>
55121 </informaltable>
55122 <para>
55123 <indexterm role="concept">
55124 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55125 <secondary>in <command>spa</command> authenticator</secondary>
55126 </indexterm>
55127 This option is expanded, and the result must be the cleartext password for the
55128 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
55129 compatibility with previous releases of Exim, the user name is also placed in
55130 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
55131 it can lead to confusion in string expansions that also use numeric variables
55132 for other things. For example:
55133 </para>
55134 <literallayout class="monospaced">
55135 spa:
55136   driver = spa
55137   public_name = NTLM
55138   server_password = \
55139     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
55140 </literallayout>
55141 <para>
55142 If the expansion is forced to fail, authentication fails. Any other expansion
55143 failure causes a temporary error code to be returned.
55144 </para>
55145 </section>
55146 <section id="SECID180">
55147 <title>Using spa as a client</title>
55148 <para>
55149 <indexterm role="concept">
55150 <primary>options</primary>
55151 <secondary><command>spa</command> authenticator (client)</secondary>
55152 </indexterm>
55153 The <command>spa</command> authenticator has the following client options:
55154 </para>
55155 <para>
55156 <indexterm role="option">
55157 <primary><option>client_domain</option></primary>
55158 </indexterm>
55159 </para>
55160 <informaltable frame="all">
55161 <tgroup cols="4" colsep="0" rowsep="0">
55162 <colspec colwidth="8*" align="left"/>
55163 <colspec colwidth="6*" align="center"/>
55164 <colspec colwidth="6*" align="center"/>
55165 <colspec colwidth="6*" align="right"/>
55166 <tbody>
55167 <row>
55168 <entry><option>client_domain</option></entry>
55169 <entry>Use: <emphasis>spa</emphasis></entry>
55170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55171 <entry>Default: <emphasis>unset</emphasis></entry>
55172 </row>
55173 </tbody>
55174 </tgroup>
55175 </informaltable>
55176 <para>
55177 This option specifies an optional domain for the authentication.
55178 </para>
55179 <para>
55180 <indexterm role="option">
55181 <primary><option>client_password</option></primary>
55182 </indexterm>
55183 </para>
55184 <informaltable frame="all">
55185 <tgroup cols="4" colsep="0" rowsep="0">
55186 <colspec colwidth="8*" align="left"/>
55187 <colspec colwidth="6*" align="center"/>
55188 <colspec colwidth="6*" align="center"/>
55189 <colspec colwidth="6*" align="right"/>
55190 <tbody>
55191 <row>
55192 <entry><option>client_password</option></entry>
55193 <entry>Use: <emphasis>spa</emphasis></entry>
55194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55195 <entry>Default: <emphasis>unset</emphasis></entry>
55196 </row>
55197 </tbody>
55198 </tgroup>
55199 </informaltable>
55200 <para>
55201 This option specifies the user&#x2019;s password, and must be set.
55202 </para>
55203 <para>
55204 <indexterm role="option">
55205 <primary><option>client_username</option></primary>
55206 </indexterm>
55207 </para>
55208 <informaltable frame="all">
55209 <tgroup cols="4" colsep="0" rowsep="0">
55210 <colspec colwidth="8*" align="left"/>
55211 <colspec colwidth="6*" align="center"/>
55212 <colspec colwidth="6*" align="center"/>
55213 <colspec colwidth="6*" align="right"/>
55214 <tbody>
55215 <row>
55216 <entry><option>client_username</option></entry>
55217 <entry>Use: <emphasis>spa</emphasis></entry>
55218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55219 <entry>Default: <emphasis>unset</emphasis></entry>
55220 </row>
55221 </tbody>
55222 </tgroup>
55223 </informaltable>
55224 <para>
55225 This option specifies the user name, and must be set. Here is an example of a
55226 configuration of this authenticator for use with the mail servers at
55227 <emphasis>msn.com</emphasis>:
55228 </para>
55229 <literallayout class="monospaced">
55230 msn:
55231   driver = spa
55232   public_name = MSN
55233   client_username = msn/msn_username
55234   client_password = msn_plaintext_password
55235   client_domain = DOMAIN_OR_UNSET
55236 </literallayout>
55237 <para>
55238 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
55239 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
55240 </para>
55241 </section>
55242 </chapter>
55243
55244 <chapter id="CHAPexternauth">
55245 <title>The external authenticator</title>
55246 <para>
55247 <indexterm role="concept" id="IIDexternauth1" class="startofrange">
55248 <primary><command>external</command> authenticator</primary>
55249 </indexterm>
55250 <indexterm role="concept" id="IIDexternauth2" class="startofrange">
55251 <primary>authenticators</primary>
55252 <secondary><command>external</command></secondary>
55253 </indexterm>
55254 <indexterm role="concept">
55255 <primary>authentication</primary>
55256 <secondary>Client Certificate</secondary>
55257 </indexterm>
55258 <indexterm role="concept">
55259 <primary>authentication</primary>
55260 <secondary>X509</secondary>
55261 </indexterm>
55262 <indexterm role="concept">
55263 <primary>Certificate-based authentication</primary>
55264 </indexterm>
55265 The <command>external</command> authenticator provides support for
55266 authentication based on non-SMTP information.
55267 The specification is in RFC 4422 Appendix A
55268 (<emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc4422">https://tools.ietf.org/html/rfc4422</ulink></emphasis>).
55269 It is only a transport and negotiation mechanism;
55270 the process of authentication is entirely controlled
55271 by the server configuration.
55272 </para>
55273 <para>
55274 The client presents an identity in-clear.
55275 It is probably wise for a server to only advertise,
55276 and for clients to only attempt,
55277 this authentication method on a secure (eg. under TLS) connection.
55278 </para>
55279 <para>
55280 One possible use, compatible with the
55281 K-9 Mail Andoid client (<emphasis role="bold"><ulink url="https://k9mail.github.io/">https://k9mail.github.io/</ulink></emphasis>),
55282 is for using X509 client certificates.
55283 </para>
55284 <para>
55285 It thus overlaps in function with the TLS authenticator
55286 (see <xref linkend="CHAPtlsauth"/>)
55287 but is a full SMTP SASL authenticator
55288 rather than being implicit for TLS-connection carried
55289 client certificates only.
55290 </para>
55291 <para>
55292 The examples and discussion in this chapter assume that
55293 client-certificate authentication is being done.
55294 </para>
55295 <para>
55296 The client must present a certificate,
55297 for which it must have been requested via the
55298 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
55299 (see <xref linkend="CHAPTLS"/>).
55300 For authentication to be effective the certificate should be
55301 verifiable against a trust-anchor certificate known to the server.
55302 </para>
55303 <section id="SECTexternsoptions">
55304 <title>External options</title>
55305 <para>
55306 <indexterm role="concept">
55307 <primary>options</primary>
55308 <secondary><command>external</command> authenticator (server)</secondary>
55309 </indexterm>
55310 The <command>external</command> authenticator has two server options:
55311 </para>
55312 <para>
55313 <indexterm role="option">
55314 <primary><option>server_param2</option></primary>
55315 </indexterm>
55316 </para>
55317 <informaltable frame="all">
55318 <tgroup cols="4" colsep="0" rowsep="0">
55319 <colspec colwidth="8*" align="left"/>
55320 <colspec colwidth="6*" align="center"/>
55321 <colspec colwidth="6*" align="center"/>
55322 <colspec colwidth="6*" align="right"/>
55323 <tbody>
55324 <row>
55325 <entry><option>server_param2</option></entry>
55326 <entry>Use: <emphasis>external</emphasis></entry>
55327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55328 <entry>Default: <emphasis>unset</emphasis></entry>
55329 </row>
55330 </tbody>
55331 </tgroup>
55332 </informaltable>
55333 <para>
55334 <indexterm role="option">
55335 <primary><option>server_param3</option></primary>
55336 </indexterm>
55337 </para>
55338 <informaltable frame="all">
55339 <tgroup cols="4" colsep="0" rowsep="0">
55340 <colspec colwidth="8*" align="left"/>
55341 <colspec colwidth="6*" align="center"/>
55342 <colspec colwidth="6*" align="center"/>
55343 <colspec colwidth="6*" align="right"/>
55344 <tbody>
55345 <row>
55346 <entry><option>server_param3</option></entry>
55347 <entry>Use: <emphasis>external</emphasis></entry>
55348 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55349 <entry>Default: <emphasis>unset</emphasis></entry>
55350 </row>
55351 </tbody>
55352 </tgroup>
55353 </informaltable>
55354 <para>
55355 <indexterm role="concept">
55356 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
55357 <secondary>in <command>external</command> authenticator</secondary>
55358 </indexterm>
55359 These options are expanded before the <option>server_condition</option> option
55360 and the result are placed in <varname>$auth2</varname> and <varname>$auth3</varname> resectively.
55361 If the expansion is forced to fail, authentication fails. Any other expansion
55362 failure causes a temporary error code to be returned.
55363 </para>
55364 <para>
55365 They can be used to clarify the coding of a complex <option>server_condition</option>.
55366 </para>
55367 </section>
55368 <section id="SECTexternserver">
55369 <title>Using external in a server</title>
55370 <para>
55371 <indexterm role="concept">
55372 <primary>AUTH</primary>
55373 <secondary>in <command>external</command> authenticator</secondary>
55374 </indexterm>
55375 <indexterm role="concept">
55376 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55377 <secondary>in <command>external</command> authenticator</secondary>
55378 </indexterm>
55379 <indexterm role="variable">
55380 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
55381 </indexterm>
55382 <indexterm role="concept">
55383 <primary>base64 encoding</primary>
55384 <secondary>in <command>external</command> authenticator</secondary>
55385 </indexterm>
55386 </para>
55387 <para>
55388 When running as a server, <command>external</command> performs the authentication test by
55389 expanding a string. The data sent by the client with the AUTH command, or in
55390 response to subsequent prompts, is base64 encoded, and so may contain any byte
55391 values when decoded. The decoded value is treated as
55392 an identity for authentication and
55393 placed in the expansion variable <varname>$auth1</varname>.
55394 </para>
55395 <para>
55396 For compatibility with previous releases of Exim, the value is also placed in
55397 the expansion variable <varname>$1</varname>. However, the use of this
55398 variable for this purpose is now deprecated, as it can lead to confusion in
55399 string expansions that also use them for other things.
55400 </para>
55401 <para>
55402 <indexterm role="variable">
55403 <primary><varname>$authenticated_id</varname></primary>
55404 </indexterm>
55405 Once an identity has been received,
55406 <option>server_condition</option> is expanded. If the expansion is forced to fail,
55407 authentication fails. Any other expansion failure causes a temporary error code
55408 to be returned. If the result of a successful expansion is an empty string,
55409 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
55410 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
55411 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
55412 For any other result, a temporary error code is returned, with the expanded
55413 string as the error text.
55414 </para>
55415 <para>
55416 Example:
55417 </para>
55418 <literallayout class="monospaced">
55419 ext_ccert_san_mail:
55420   driver =            external
55421   public_name =       EXTERNAL
55422
55423   server_advertise_condition = $tls_in_certificate_verified
55424   server_param2 =     ${certextract {subj_altname,mail,&gt;:} \
55425                                     {$tls_in_peercert}}
55426   server_condition =  ${if forany {$auth2} \
55427                             {eq {$item}{$auth1}}}
55428   server_set_id =     $auth1
55429 </literallayout>
55430 <para>
55431 This accepts a client certificate that is verifiable against any
55432 of your configured trust-anchors
55433 (which usually means the full set of public CAs)
55434 and which has a mail-SAN matching the claimed identity sent by the client.
55435 </para>
55436 <para>
55437 <emphasis role="bold">Note</emphasis>: up to TLS1.2, the client cert is on the wire in-clear, including the SAN.
55438 The account name is therefore guessable by an opponent.
55439 TLS 1.3 protects both server and client certificates, and is not vulnerable
55440 in this way.
55441 </para>
55442 </section>
55443 <section id="SECTexternclient">
55444 <title>Using external in a client</title>
55445 <para>
55446 <indexterm role="concept">
55447 <primary>options</primary>
55448 <secondary><command>external</command> authenticator (client)</secondary>
55449 </indexterm>
55450 The <command>external</command> authenticator has one client option:
55451 </para>
55452 <para>
55453 <indexterm role="option">
55454 <primary><option>client_send</option></primary>
55455 </indexterm>
55456 </para>
55457 <informaltable frame="all">
55458 <tgroup cols="4" colsep="0" rowsep="0">
55459 <colspec colwidth="8*" align="left"/>
55460 <colspec colwidth="6*" align="center"/>
55461 <colspec colwidth="6*" align="center"/>
55462 <colspec colwidth="6*" align="right"/>
55463 <tbody>
55464 <row>
55465 <entry><option>client_send</option></entry>
55466 <entry>Use: <emphasis>external</emphasis></entry>
55467 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55468 <entry>Default: <emphasis>unset</emphasis></entry>
55469 </row>
55470 </tbody>
55471 </tgroup>
55472 </informaltable>
55473 <para>
55474 This option is expanded and sent with the AUTH command as the
55475 identity being asserted.
55476 </para>
55477 <para>
55478 Example:
55479 </para>
55480 <literallayout class="monospaced">
55481 ext_ccert:
55482   driver =      external
55483   public_name = EXTERNAL
55484
55485   client_condition = ${if !eq{$tls_out_cipher}{}}
55486   client_send = myaccount@smarthost.example.net
55487 </literallayout>
55488 <para>
55489 <indexterm role="concept" startref="IIDexternauth1" class="endofrange"/>
55490 <indexterm role="concept" startref="IIDexternauth2" class="endofrange"/>
55491 </para>
55492 </section>
55493 </chapter>
55494
55495 <chapter id="CHAPtlsauth">
55496 <title>The tls authenticator</title>
55497 <para>
55498 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
55499 <primary><command>tls</command> authenticator</primary>
55500 </indexterm>
55501 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
55502 <primary>authenticators</primary>
55503 <secondary><command>tls</command></secondary>
55504 </indexterm>
55505 <indexterm role="concept">
55506 <primary>authentication</primary>
55507 <secondary>Client Certificate</secondary>
55508 </indexterm>
55509 <indexterm role="concept">
55510 <primary>authentication</primary>
55511 <secondary>X509</secondary>
55512 </indexterm>
55513 <indexterm role="concept">
55514 <primary>Certificate-based authentication</primary>
55515 </indexterm>
55516 The <command>tls</command> authenticator provides server support for
55517 authentication based on client certificates.
55518 </para>
55519 <para>
55520 It is not an SMTP authentication mechanism and is not
55521 advertised by the server as part of the SMTP EHLO response.
55522 It is an Exim authenticator in the sense that it affects
55523 the protocol element of the log line, can be tested for
55524 by the <option>authenticated</option> ACL condition, and can set
55525 the <varname>$authenticated_id</varname> variable.
55526 </para>
55527 <para>
55528 The client must present a verifiable certificate,
55529 for which it must have been requested via the
55530 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
55531 (see <xref linkend="CHAPTLS"/>).
55532 </para>
55533 <para>
55534 If an authenticator of this type is configured it is
55535 run before any SMTP-level communication is done,
55536 and can authenticate the connection.
55537 If it does, SMTP authentication is not offered.
55538 </para>
55539 <para>
55540 A maximum of one authenticator of this type may be present.
55541 </para>
55542 <para>
55543 <indexterm role="concept">
55544 <primary>options</primary>
55545 <secondary><command>tls</command> authenticator (server)</secondary>
55546 </indexterm>
55547 The <command>tls</command> authenticator has three server options:
55548 </para>
55549 <para>
55550 <indexterm role="option">
55551 <primary><option>server_param1</option></primary>
55552 </indexterm>
55553 </para>
55554 <informaltable frame="all">
55555 <tgroup cols="4" colsep="0" rowsep="0">
55556 <colspec colwidth="8*" align="left"/>
55557 <colspec colwidth="6*" align="center"/>
55558 <colspec colwidth="6*" align="center"/>
55559 <colspec colwidth="6*" align="right"/>
55560 <tbody>
55561 <row>
55562 <entry><option>server_param1</option></entry>
55563 <entry>Use: <emphasis>tls</emphasis></entry>
55564 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55565 <entry>Default: <emphasis>unset</emphasis></entry>
55566 </row>
55567 </tbody>
55568 </tgroup>
55569 </informaltable>
55570 <para>
55571 <indexterm role="concept">
55572 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
55573 <secondary>in <command>tls</command> authenticator</secondary>
55574 </indexterm>
55575 This option is expanded after the TLS negotiation and
55576 the result is placed in <varname>$auth1</varname>.
55577 If the expansion is forced to fail, authentication fails. Any other expansion
55578 failure causes a temporary error code to be returned.
55579 </para>
55580 <para>
55581 <indexterm role="option">
55582 <primary><option>server_param2</option></primary>
55583 </indexterm>
55584 </para>
55585 <informaltable frame="all">
55586 <tgroup cols="4" colsep="0" rowsep="0">
55587 <colspec colwidth="8*" align="left"/>
55588 <colspec colwidth="6*" align="center"/>
55589 <colspec colwidth="6*" align="center"/>
55590 <colspec colwidth="6*" align="right"/>
55591 <tbody>
55592 <row>
55593 <entry><option>server_param2</option></entry>
55594 <entry>Use: <emphasis>tls</emphasis></entry>
55595 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55596 <entry>Default: <emphasis>unset</emphasis></entry>
55597 </row>
55598 </tbody>
55599 </tgroup>
55600 </informaltable>
55601 <para>
55602 <indexterm role="option">
55603 <primary><option>server_param3</option></primary>
55604 </indexterm>
55605 </para>
55606 <informaltable frame="all">
55607 <tgroup cols="4" colsep="0" rowsep="0">
55608 <colspec colwidth="8*" align="left"/>
55609 <colspec colwidth="6*" align="center"/>
55610 <colspec colwidth="6*" align="center"/>
55611 <colspec colwidth="6*" align="right"/>
55612 <tbody>
55613 <row>
55614 <entry><option>server_param3</option></entry>
55615 <entry>Use: <emphasis>tls</emphasis></entry>
55616 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55617 <entry>Default: <emphasis>unset</emphasis></entry>
55618 </row>
55619 </tbody>
55620 </tgroup>
55621 </informaltable>
55622 <para>
55623 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
55624 </para>
55625 <para>
55626 <option>server_param1</option> may also be spelled <option>server_param</option>.
55627 </para>
55628 <para>
55629 Example:
55630 </para>
55631 <literallayout class="monospaced">
55632 tls:
55633   driver = tls
55634   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
55635                                     {$tls_in_peercert}}
55636   server_condition =  ${if and { {eq{$tls_in_certificate_verified}{1}} \
55637                                  {forany {$auth1} \
55638                             {!= {0} \
55639                                 {${lookup ldap{ldap:///\
55640                          mailname=${quote_ldap_dn:${lc:$item}},\
55641                          ou=users,LDAP_DC?mailid} {$value}{0} \
55642                        }    }  } }}}
55643   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
55644 </literallayout>
55645 <para>
55646 This accepts a client certificate that is verifiable against any
55647 of your configured trust-anchors
55648 (which usually means the full set of public CAs)
55649 and which has a SAN with a good account name.
55650 </para>
55651 <para>
55652 Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
55653 The account name is therefore guessable by an opponent.
55654 TLS 1.3 protects both server and client certificates, and is not vulnerable
55655 in this way.
55656 Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
55657 </para>
55658 <para>
55659 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
55660 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
55661 </para>
55662 <para>
55663 Note that because authentication is traditionally an SMTP operation,
55664 the <option>authenticated</option> ACL condition cannot be used in
55665 a connect- or helo-ACL.
55666 </para>
55667 </chapter>
55668
55669 <chapter id="CHAPTLS">
55670 <title>Encrypted SMTP connections using TLS/SSL</title>
55671 <titleabbrev>Encrypted SMTP connections</titleabbrev>
55672 <para>
55673 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
55674 <primary>encryption</primary>
55675 <secondary>on SMTP connection</secondary>
55676 </indexterm>
55677 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
55678 <primary>SMTP</primary>
55679 <secondary>encryption</secondary>
55680 </indexterm>
55681 <indexterm role="concept">
55682 <primary>TLS</primary>
55683 <secondary>on SMTP connection</secondary>
55684 </indexterm>
55685 <indexterm role="concept">
55686 <primary>OpenSSL</primary>
55687 </indexterm>
55688 <indexterm role="concept">
55689 <primary>GnuTLS</primary>
55690 </indexterm>
55691 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
55692 Sockets Layer), is implemented by making use of the OpenSSL library or the
55693 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
55694 cryptographic code in the Exim distribution itself for implementing TLS. In
55695 order to use this feature you must install OpenSSL or GnuTLS, and then build a
55696 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
55697 You also need to understand the basic concepts of encryption at a managerial
55698 level, and in particular, the way that public keys, private keys, and
55699 certificates are used.
55700 </para>
55701 <para>
55702 RFC 3207 defines how SMTP connections can make use of encryption. Once a
55703 connection is established, the client issues a STARTTLS command. If the
55704 server accepts this, the client and the server negotiate an encryption
55705 mechanism. If the negotiation succeeds, the data that subsequently passes
55706 between them is encrypted.
55707 </para>
55708 <para>
55709 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
55710 and if so, what cipher suite is in use, whether the client supplied a
55711 certificate, and whether or not that certificate was verified. This makes it
55712 possible for an Exim server to deny or accept certain commands based on the
55713 encryption state.
55714 </para>
55715 <para>
55716 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
55717 disrupt TLS connections. You need to turn off SMTP scanning for these products
55718 in order to get TLS to work.
55719 </para>
55720 <section id="SECID284">
55721 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
55722 <para>
55723 <indexterm role="concept">
55724 <primary>submissions protocol</primary>
55725 </indexterm>
55726 <indexterm role="concept">
55727 <primary>ssmtp protocol</primary>
55728 </indexterm>
55729 <indexterm role="concept">
55730 <primary>smtps protocol</primary>
55731 </indexterm>
55732 <indexterm role="concept">
55733 <primary>SMTP</primary>
55734 <secondary>submissions protocol</secondary>
55735 </indexterm>
55736 <indexterm role="concept">
55737 <primary>SMTP</primary>
55738 <secondary>ssmtp protocol</secondary>
55739 </indexterm>
55740 <indexterm role="concept">
55741 <primary>SMTP</primary>
55742 <secondary>smtps protocol</secondary>
55743 </indexterm>
55744 The history of port numbers for TLS in SMTP is a little messy and has been
55745 contentious.  As of RFC 8314, the common practice of using the historically
55746 allocated port 465 for "email submission but with TLS immediately upon connect
55747 instead of using STARTTLS" is officially blessed by the IETF, and recommended
55748 by them in preference to STARTTLS.
55749 </para>
55750 <para>
55751 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
55752 clarity emerged over the dual roles of SMTP, for MX delivery and Email
55753 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
55754 </para>
55755 <para>
55756 This approach was, for a while, officially abandoned when encrypted SMTP was
55757 standardized, but many clients kept using it, even as the TCP port number was
55758 reassigned for other use.
55759 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
55760 this port.
55761 In practice, a number of mail-clients have only ever supported submissions,
55762 not submission with STARTTLS upgrade.
55763 Ideally, offer both submission (587) and submissions (465) service.
55764 </para>
55765 <para>
55766 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
55767 global option. Its value must be a list of port numbers;
55768 the most common use is expected to be:
55769 </para>
55770 <literallayout class="monospaced">
55771 tls_on_connect_ports = 465
55772 </literallayout>
55773 <para>
55774 The port numbers specified by this option apply to all SMTP connections, both
55775 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
55776 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
55777 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
55778 an extra port &ndash; rather, it specifies different behaviour on a port that is
55779 defined elsewhere.
55780 </para>
55781 <para>
55782 There is also a <option>-tls-on-connect</option> command line option. This overrides
55783 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
55784 </para>
55785 </section>
55786 <section id="SECTopenvsgnu">
55787 <title>OpenSSL vs GnuTLS</title>
55788 <para>
55789 <indexterm role="concept">
55790 <primary>TLS</primary>
55791 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
55792 </indexterm>
55793 TLS is supported in Exim using either the OpenSSL or GnuTLS library.
55794 To build Exim to use OpenSSL you need to set
55795 </para>
55796 <literallayout class="monospaced">
55797 USE_OPENSSL=yes
55798 </literallayout>
55799 <para>
55800 in Local/Makefile.
55801 </para>
55802 <para>
55803 To build Exim to use GnuTLS, you need to set
55804 </para>
55805 <literallayout class="monospaced">
55806 USE_GNUTLS=yes
55807 </literallayout>
55808 <para>
55809 in Local/Makefile.
55810 </para>
55811 <para>
55812 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
55813 include files and libraries for GnuTLS can be found.
55814 </para>
55815 <para>
55816 There are some differences in usage when using GnuTLS instead of OpenSSL:
55817 </para>
55818 <itemizedlist>
55819 <listitem>
55820 <para>
55821 The <option>tls_verify_certificates</option> option
55822 cannot be the path of a directory
55823 for GnuTLS versions before 3.3.6
55824 (for later versions, or OpenSSL, it can be either).
55825 </para>
55826 </listitem>
55827 <listitem>
55828 <para>
55829 The default value for <option>tls_dhparam</option> differs for historical reasons.
55830 </para>
55831 </listitem>
55832 <listitem>
55833 <para>
55834 <indexterm role="variable">
55835 <primary><varname>$tls_in_peerdn</varname></primary>
55836 </indexterm>
55837 <indexterm role="variable">
55838 <primary><varname>$tls_out_peerdn</varname></primary>
55839 </indexterm>
55840 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
55841 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
55842 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
55843 </para>
55844 </listitem>
55845 <listitem>
55846 <para>
55847 OpenSSL identifies cipher suites using hyphens as separators, for example:
55848 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
55849 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
55850 in a cipher list. To make life simpler, Exim changes underscores to hyphens
55851 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
55852 to handle its own older variants) when processing lists of cipher suites in the
55853 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
55854 option).
55855 </para>
55856 </listitem>
55857 <listitem>
55858 <para>
55859 The <option>tls_require_ciphers</option> options operate differently, as described in the
55860 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
55861 </para>
55862 </listitem>
55863 <listitem>
55864 <para>
55865 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
55866 When using OpenSSL, this option is ignored.
55867 (If an API is found to let OpenSSL be configured in this way,
55868 let the Exim Maintainers know and we&#x2019;ll likely use it).
55869 </para>
55870 </listitem>
55871 <listitem>
55872 <para>
55873 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
55874 main option, it must be ordered to match the <option>tls_certificate</option> list.
55875 </para>
55876 </listitem>
55877 <listitem>
55878 <para>
55879 Some other recently added features may only be available in one or the other.
55880 This should be documented with the feature.  If the documentation does not
55881 explicitly state that the feature is infeasible in the other TLS
55882 implementation, then patches are welcome.
55883 </para>
55884 </listitem>
55885 </itemizedlist>
55886 </section>
55887 <section id="SECTgnutlsparam">
55888 <title>GnuTLS parameter computation</title>
55889 <para>
55890 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
55891 an explicit path; if the latter, then the text about generation still applies,
55892 but not the chosen filename.
55893 By default, as of Exim 4.80 a hard-coded D-H prime is used.
55894 See the documentation of <option>tls_dhparam</option> for more information.
55895 </para>
55896 <para>
55897 GnuTLS uses D-H parameters that may take a substantial amount of time
55898 to compute. It is unreasonable to re-compute them for every TLS session.
55899 Therefore, Exim keeps this data in a file in its spool directory, called
55900 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
55901 of bits requested.
55902 The file is owned by the Exim user and is readable only by
55903 its owner. Every Exim process that start up GnuTLS reads the D-H
55904 parameters from this file. If the file does not exist, the first Exim process
55905 that needs it computes the data and writes it to a temporary file which is
55906 renamed once it is complete. It does not matter if several Exim processes do
55907 this simultaneously (apart from wasting a few resources). Once a file is in
55908 place, new Exim processes immediately start using it.
55909 </para>
55910 <para>
55911 For maximum security, the parameters that are stored in this file should be
55912 recalculated periodically, the frequency depending on your paranoia level.
55913 If you are avoiding using the fixed D-H primes published in RFCs, then you
55914 are concerned about some advanced attacks and will wish to do this; if you do
55915 not regenerate then you might as well stick to the standard primes.
55916 </para>
55917 <para>
55918 Arranging this is easy in principle; just delete the file when you want new
55919 values to be computed. However, there may be a problem. The calculation of new
55920 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
55921 If the system is not very active, <filename>/dev/random</filename> may delay returning data
55922 until enough randomness (entropy) is available. This may cause Exim to hang for
55923 a substantial amount of time, causing timeouts on incoming connections.
55924 </para>
55925 <para>
55926 The solution is to generate the parameters externally to Exim. They are stored
55927 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
55928 generated externally using the <command>certtool</command> command that is part of GnuTLS.
55929 </para>
55930 <para>
55931 To replace the parameters with new ones, instead of deleting the file
55932 and letting Exim re-create it, you can generate new parameters using
55933 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
55934 renaming. The relevant commands are something like this:
55935 </para>
55936 <literallayout class="monospaced">
55937 # ls
55938 [ look for file; assume gnutls-params-2236 is the most recent ]
55939 # rm -f new-params
55940 # touch new-params
55941 # chown exim:exim new-params
55942 # chmod 0600 new-params
55943 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
55944 # openssl dhparam -noout -text -in new-params | head
55945 [ check the first line, make sure it's not more than 2236;
55946   if it is, then go back to the start ("rm") and repeat
55947   until the size generated is at most the size requested ]
55948 # chmod 0400 new-params
55949 # mv new-params gnutls-params-2236
55950 </literallayout>
55951 <para>
55952 If Exim never has to generate the parameters itself, the possibility of
55953 stalling is removed.
55954 </para>
55955 <para>
55956 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
55957 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
55958 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
55959 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
55960 and Exim does so.  This attempt to remove Exim from TLS policy decisions
55961 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
55962 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
55963 which applies to all D-H usage, client or server.  If the value returned by
55964 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
55965 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
55966 limit, which is still much higher than Exim historically used.
55967 </para>
55968 <para>
55969 The filename and bits used will change as the GnuTLS maintainers change the
55970 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
55971 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
55972 2432 bits, while NSS is limited to 2236 bits.
55973 </para>
55974 <para>
55975 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
55976 increase the chance of the generated prime actually being within acceptable
55977 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
55978 procedure above.  There is no sane procedure available to Exim to double-check
55979 the size of the generated prime, so it might still be too large.
55980 </para>
55981 </section>
55982 <section id="SECTreqciphssl">
55983 <title>Requiring specific ciphers in OpenSSL</title>
55984 <para>
55985 <indexterm role="concept">
55986 <primary>TLS</primary>
55987 <secondary>requiring specific ciphers (OpenSSL)</secondary>
55988 </indexterm>
55989 <indexterm role="option">
55990 <primary><option>tls_require_ciphers</option></primary>
55991 <secondary>OpenSSL</secondary>
55992 </indexterm>
55993 There is a function in the OpenSSL library that can be passed a list of cipher
55994 suites before the cipher negotiation takes place. This specifies which ciphers
55995 are acceptable for TLS versions prior to 1.3.
55996 The list is colon separated and may contain names like
55997 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
55998 directly to this function call.
55999 Many systems will install the OpenSSL manual-pages, so you may have
56000 <emphasis>ciphers(1)</emphasis> available to you.
56001 The following quotation from the OpenSSL
56002 documentation specifies what forms of item are allowed in the cipher string:
56003 </para>
56004 <itemizedlist>
56005 <listitem>
56006 <para>
56007 It can consist of a single cipher suite such as RC4-SHA.
56008 </para>
56009 </listitem>
56010 <listitem>
56011 <para>
56012 It can represent a list of cipher suites containing a certain algorithm,
56013 or cipher suites of a certain type. For example SHA1 represents all
56014 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
56015 SSL v3 algorithms.
56016 </para>
56017 </listitem>
56018 <listitem>
56019 <para>
56020 Lists of cipher suites can be combined in a single cipher string using
56021 the + character. This is used as a logical and operation. For example
56022 SHA1+DES represents all cipher suites containing the SHA1 and the DES
56023 algorithms.
56024 </para>
56025 </listitem>
56026 </itemizedlist>
56027 <para>
56028 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
56029 <literal>-</literal> or <literal>+</literal>.
56030 </para>
56031 <itemizedlist>
56032 <listitem>
56033 <para>
56034 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
56035 ciphers deleted can never reappear in the list even if they are explicitly
56036 stated.
56037 </para>
56038 </listitem>
56039 <listitem>
56040 <para>
56041 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
56042 of the ciphers can be added again by later options.
56043 </para>
56044 </listitem>
56045 <listitem>
56046 <para>
56047 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
56048 option does not add any new ciphers; it just moves matching existing ones.
56049 </para>
56050 </listitem>
56051 </itemizedlist>
56052 <para>
56053 If none of these characters is present, the string is interpreted as
56054 a list of ciphers to be appended to the current preference list. If the list
56055 includes any ciphers already present they will be ignored: that is, they will
56056 not be moved to the end of the list.
56057 </para>
56058 <para>
56059 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
56060 string:
56061 </para>
56062 <literallayout class="monospaced">
56063 # note single-quotes to get ! past any shell history expansion
56064 $ openssl ciphers 'HIGH:!MD5:!SHA1'
56065 </literallayout>
56066 <para>
56067 This example will let the library defaults be permitted on the MX port, where
56068 there&#x2019;s probably no identity verification anyway, but ups the ante on the
56069 submission ports where the administrator might have some influence on the
56070 choice of clients used:
56071 </para>
56072 <literallayout class="monospaced">
56073 # OpenSSL variant; see man ciphers(1)
56074 tls_require_ciphers = ${if =={$received_port}{25}\
56075                            {DEFAULT}\
56076                            {HIGH:!MD5:!SHA1}}
56077 </literallayout>
56078 <para>
56079 This example will prefer ECDSA-authenticated ciphers over RSA ones:
56080 </para>
56081 <literallayout class="monospaced">
56082 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
56083 </literallayout>
56084 <para>
56085 For TLS version 1.3 the control available is less fine-grained
56086 and Exim does not provide access to it at present.
56087 The value of the <option>tls_require_ciphers</option> option is ignored when
56088 TLS version 1.3 is negotiated.
56089 </para>
56090 <para>
56091 As of writing the library default cipher suite list for TLSv1.3 is
56092 </para>
56093 <literallayout class="monospaced">
56094 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
56095 </literallayout>
56096 </section>
56097 <section id="SECTreqciphgnu">
56098 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
56099 <para>
56100 <indexterm role="concept">
56101 <primary>GnuTLS</primary>
56102 <secondary>specifying parameters for</secondary>
56103 </indexterm>
56104 <indexterm role="concept">
56105 <primary>TLS</primary>
56106 <secondary>specifying ciphers (GnuTLS)</secondary>
56107 </indexterm>
56108 <indexterm role="concept">
56109 <primary>TLS</primary>
56110 <secondary>specifying key exchange methods (GnuTLS)</secondary>
56111 </indexterm>
56112 <indexterm role="concept">
56113 <primary>TLS</primary>
56114 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
56115 </indexterm>
56116 <indexterm role="concept">
56117 <primary>TLS</primary>
56118 <secondary>specifying protocols (GnuTLS)</secondary>
56119 </indexterm>
56120 <indexterm role="concept">
56121 <primary>TLS</primary>
56122 <secondary>specifying priority string (GnuTLS)</secondary>
56123 </indexterm>
56124 <indexterm role="option">
56125 <primary><option>tls_require_ciphers</option></primary>
56126 <secondary>GnuTLS</secondary>
56127 </indexterm>
56128 The GnuTLS library allows the caller to provide a "priority string", documented
56129 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
56130 ciphersuite specification in OpenSSL.
56131 </para>
56132 <para>
56133 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
56134 and controls both protocols and ciphers.
56135 </para>
56136 <para>
56137 The <option>tls_require_ciphers</option> option is available both as an global option,
56138 controlling how Exim behaves as a server, and also as an option of the
56139 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
56140 the value is string expanded.  The resulting string is not an Exim list and
56141 the string is given to the GnuTLS library, so that Exim does not need to be
56142 aware of future feature enhancements of GnuTLS.
56143 </para>
56144 <para>
56145 Documentation of the strings accepted may be found in the GnuTLS manual, under
56146 "Priority strings".  This is online as
56147 <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>,
56148 but beware that this relates to GnuTLS 3, which may be newer than the version
56149 installed on your system.  If you are using GnuTLS 3,
56150 then the example code
56151 <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>
56152 on that site can be used to test a given string.
56153 </para>
56154 <para>
56155 For example:
56156 </para>
56157 <literallayout class="monospaced">
56158 # Disable older versions of protocols
56159 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
56160 </literallayout>
56161 <para>
56162 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
56163 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
56164 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
56165 </para>
56166 <para>
56167 This example will let the library defaults be permitted on the MX port, where
56168 there&#x2019;s probably no identity verification anyway, and lowers security further
56169 by increasing compatibility; but this ups the ante on the submission ports
56170 where the administrator might have some influence on the choice of clients
56171 used:
56172 </para>
56173 <literallayout class="monospaced">
56174 # GnuTLS variant
56175 tls_require_ciphers = ${if =={$received_port}{25}\
56176                            {NORMAL:%COMPAT}\
56177                            {SECURE128}}
56178 </literallayout>
56179 </section>
56180 <section id="SECID182">
56181 <title>Configuring an Exim server to use TLS</title>
56182 <para>
56183 <indexterm role="concept">
56184 <primary>TLS</primary>
56185 <secondary>configuring an Exim server</secondary>
56186 </indexterm>
56187 <indexterm role="concept">
56188 <primary>ESMTP extensions</primary>
56189 <secondary>STARTTLS</secondary>
56190 </indexterm>
56191 When Exim has been built with TLS support, it advertises the availability of
56192 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
56193 but not to any others. The default value of this option is *, which means
56194 that STARTTLS is always advertised.  Set it to blank to never advertise;
56195 this is reasonable for systems that want to use TLS only as a client.
56196 </para>
56197 <para>
56198 If STARTTLS is to be used you
56199 need to set some other options in order to make TLS available.
56200 </para>
56201 <para>
56202 If a client issues a STARTTLS command and there is some configuration
56203 problem in the server, the command is rejected with a 454 error. If the client
56204 persists in trying to issue SMTP commands, all except QUIT are rejected
56205 with the error
56206 </para>
56207 <literallayout class="monospaced">
56208 554 Security failure
56209 </literallayout>
56210 <para>
56211 If a STARTTLS command is issued within an existing TLS session, it is
56212 rejected with a 554 error code.
56213 </para>
56214 <para>
56215 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
56216 must be set to match some hosts. The default is * which matches all hosts.
56217 </para>
56218 <para>
56219 If this is all you do, TLS encryption will be enabled but not authentication -
56220 meaning that the peer has no assurance it is actually you he is talking to.
56221 You gain protection from a passive sniffer listening on the wire but not
56222 from someone able to intercept the communication.
56223 </para>
56224 <para>
56225 Further protection requires some further configuration at the server end.
56226 </para>
56227 <para>
56228 To make TLS work you need to set, in the server,
56229 </para>
56230 <literallayout class="monospaced">
56231 tls_certificate = /some/file/name
56232 tls_privatekey = /some/file/name
56233 </literallayout>
56234 <para>
56235 These options are, in fact, expanded strings, so you can make them depend on
56236 the identity of the client that is connected if you wish. The first file
56237 contains the server&#x2019;s X509 certificate, and the second contains the private key
56238 that goes with it. These files need to be
56239 PEM format and readable by the Exim user, and must
56240 always be given as full path names.
56241 The key must not be password-protected.
56242 They can be the same file if both the
56243 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
56244 set, or if its expansion is forced to fail or results in an empty string, this
56245 is assumed to be the case. The certificate file may also contain intermediate
56246 certificates that need to be sent to the client to enable it to authenticate
56247 the server&#x2019;s certificate.
56248 </para>
56249 <para>
56250 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
56251 colon-separated lists of file paths.  Ciphers using given authentication
56252 algorithms require the presence of a suitable certificate to supply the
56253 public-key.  The server selects among the certificates to present to the
56254 client depending on the selected cipher, hence the priority ordering for
56255 ciphers will affect which certificate is used.
56256 </para>
56257 <para>
56258 If you do not understand about certificates and keys, please try to find a
56259 source of this background information, which is not Exim-specific. (There are a
56260 few comments below in section <xref linkend="SECTcerandall"/>.)
56261 </para>
56262 <para>
56263 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
56264 they apply only in the case of a server. If you need to use a certificate in an
56265 Exim client, you must set the options of the same names in an <command>smtp</command>
56266 transport.
56267 </para>
56268 <para>
56269 With just these options, an Exim server will be able to use TLS. It does not
56270 require the client to have a certificate (but see below for how to insist on
56271 this). There is one other option that may be needed in other situations. If
56272 </para>
56273 <literallayout class="monospaced">
56274 tls_dhparam = /some/file/name
56275 </literallayout>
56276 <para>
56277 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
56278 with the parameters contained in the file.
56279 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
56280 available:
56281 </para>
56282 <literallayout class="monospaced">
56283 tls_dhparam = none
56284 </literallayout>
56285 <para>
56286 This may also be set to a string identifying a standard prime to be used for
56287 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
56288 used is <literal>ike23</literal>.  There are a few standard primes available, see the
56289 documentation for <option>tls_dhparam</option> for the complete list.
56290 </para>
56291 <para>
56292 See the command
56293 </para>
56294 <literallayout class="monospaced">
56295 openssl dhparam
56296 </literallayout>
56297 <para>
56298 for a way of generating file data.
56299 </para>
56300 <para>
56301 The strings supplied for these three options are expanded every time a client
56302 host connects. It is therefore possible to use different certificates and keys
56303 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
56304 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
56305 forced to fail, Exim behaves as if the option is not set.
56306 </para>
56307 <para>
56308 <indexterm role="concept">
56309 <primary>cipher</primary>
56310 <secondary>logging</secondary>
56311 </indexterm>
56312 <indexterm role="concept">
56313 <primary>log</primary>
56314 <secondary>TLS cipher</secondary>
56315 </indexterm>
56316 <indexterm role="variable">
56317 <primary><varname>$tls_in_cipher</varname></primary>
56318 </indexterm>
56319 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
56320 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
56321 incoming message (by default &ndash; you can, of course, change this), and it is
56322 also included in the log line that records a message&#x2019;s arrival, keyed by
56323 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
56324 condition can be used to test for specific cipher suites in ACLs.
56325 </para>
56326 <para>
56327 Once TLS has been established, the ACLs that run for subsequent SMTP commands
56328 can check the name of the cipher suite and vary their actions accordingly. The
56329 cipher suite names vary, depending on which TLS library is being used. For
56330 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
56331 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
56332 documentation for more details.
56333 </para>
56334 <para>
56335 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
56336 (again depending on the <option>tls_cipher</option> log selector).
56337 </para>
56338 </section>
56339 <section id="SECID183">
56340 <title>Requesting and verifying client certificates</title>
56341 <para>
56342 <indexterm role="concept">
56343 <primary>certificate</primary>
56344 <secondary>verification of client</secondary>
56345 </indexterm>
56346 <indexterm role="concept">
56347 <primary>TLS</primary>
56348 <secondary>client certificate verification</secondary>
56349 </indexterm>
56350 If you want an Exim server to request a certificate when negotiating a TLS
56351 session with a client, you must set either <option>tls_verify_hosts</option> or
56352 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
56353 apply to all TLS connections. For any host that matches one of these options,
56354 Exim requests a certificate as part of the setup of the TLS session. The
56355 contents of the certificate are verified by comparing it with a list of
56356 expected trust-anchors or certificates.
56357 These may be the system default set (depending on library version),
56358 an explicit file or,
56359 depending on library version, a directory, identified by
56360 <option>tls_verify_certificates</option>.
56361 </para>
56362 <para>
56363 A file can contain multiple certificates, concatenated end to end. If a
56364 directory is used
56365 (OpenSSL only),
56366 each certificate must be in a separate file, with a name (or a symbolic link)
56367 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
56368 certificate. You can compute the relevant hash by running the command
56369 </para>
56370 <literallayout class="monospaced">
56371 openssl x509 -hash -noout -in /cert/file
56372 </literallayout>
56373 <para>
56374 where <filename>/cert/file</filename> contains a single certificate.
56375 </para>
56376 <para>
56377 There is no checking of names of the client against the certificate
56378 Subject Name or Subject Alternate Names.
56379 </para>
56380 <para>
56381 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
56382 what happens if the client does not supply a certificate, or if the certificate
56383 does not match any of the certificates in the collection named by
56384 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
56385 attempt to set up a TLS session is aborted, and the incoming connection is
56386 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
56387 session continues. ACLs that run for subsequent SMTP commands can detect the
56388 fact that no certificate was verified, and vary their actions accordingly. For
56389 example, you can insist on a certificate before accepting a message for
56390 relaying, but not when the message is destined for local delivery.
56391 </para>
56392 <para>
56393 <indexterm role="variable">
56394 <primary><varname>$tls_in_peerdn</varname></primary>
56395 </indexterm>
56396 When a client supplies a certificate (whether it verifies or not), the value of
56397 the Distinguished Name of the certificate is made available in the variable
56398 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
56399 </para>
56400 <para>
56401 <indexterm role="concept">
56402 <primary>log</primary>
56403 <secondary>distinguished name</secondary>
56404 </indexterm>
56405 Because it is often a long text string, it is not included in the log line or
56406 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
56407 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
56408 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
56409 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
56410 </para>
56411 </section>
56412 <section id="SECID184">
56413 <title>Revoked certificates</title>
56414 <para>
56415 <indexterm role="concept">
56416 <primary>TLS</primary>
56417 <secondary>revoked certificates</secondary>
56418 </indexterm>
56419 <indexterm role="concept">
56420 <primary>revocation list</primary>
56421 </indexterm>
56422 <indexterm role="concept">
56423 <primary>certificate</primary>
56424 <secondary>revocation list</secondary>
56425 </indexterm>
56426 <indexterm role="concept">
56427 <primary>OCSP</primary>
56428 <secondary>stapling</secondary>
56429 </indexterm>
56430 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
56431 certificates are revoked. If you have such a list, you can pass it to an Exim
56432 server using the global option called <option>tls_crl</option> and to an Exim client using
56433 an identically named option for the <command>smtp</command> transport. In each case, the value
56434 of the option is expanded and must then be the name of a file that contains a
56435 CRL in PEM format.
56436 The downside is that clients have to periodically re-download a potentially huge
56437 file from every certificate authority they know of.
56438 </para>
56439 <para>
56440 The way with most moving parts at query time is Online Certificate
56441 Status Protocol (OCSP), where the client verifies the certificate
56442 against an OCSP server run by the CA.  This lets the CA track all
56443 usage of the certs.  It requires running software with access to the
56444 private key of the CA, to sign the responses to the OCSP queries.  OCSP
56445 is based on HTTP and can be proxied accordingly.
56446 </para>
56447 <para>
56448 The only widespread OCSP server implementation (known to this writer)
56449 comes as part of OpenSSL and aborts on an invalid request, such as
56450 connecting to the port and then disconnecting.  This requires
56451 re-entering the passphrase each time some random client does this.
56452 </para>
56453 <para>
56454 The third way is OCSP Stapling; in this, the server using a certificate
56455 issued by the CA periodically requests an OCSP proof of validity from
56456 the OCSP server, then serves it up inline as part of the TLS
56457 negotiation.   This approach adds no extra round trips, does not let the
56458 CA track users, scales well with number of certs issued by the CA and is
56459 resilient to temporary OCSP server failures, as long as the server
56460 starts retrying to fetch an OCSP proof some time before its current
56461 proof expires.  The downside is that it requires server support.
56462 </para>
56463 <para>
56464 Unless Exim is built with the support disabled,
56465 or with GnuTLS earlier than version 3.3.16 / 3.4.8
56466 support for OCSP stapling is included.
56467 </para>
56468 <para>
56469 There is a global option called <option>tls_ocsp_file</option>.
56470 The file specified therein is expected to be in DER format, and contain
56471 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
56472 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
56473 contains <literal>tls_in_sni</literal>, as per other TLS options.
56474 </para>
56475 <para>
56476 Exim does not at this time implement any support for fetching a new OCSP
56477 proof.  The burden is on the administrator to handle this, outside of
56478 Exim.  The file specified should be replaced atomically, so that the
56479 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
56480 on each connection, so a new file will be handled transparently on the
56481 next connection.
56482 </para>
56483 <para>
56484 When built with OpenSSL Exim will check for a valid next update timestamp
56485 in the OCSP proof; if not present, or if the proof has expired, it will be
56486 ignored.
56487 </para>
56488 <para>
56489 For the client to be able to verify the stapled OCSP the server must
56490 also supply, in its stapled information, any intermediate
56491 certificates for the chain leading to the OCSP proof from the signer
56492 of the server certificate.  There may be zero or one such. These
56493 intermediate certificates should be added to the server OCSP stapling
56494 file named by <option>tls_ocsp_file</option>.
56495 </para>
56496 <para>
56497 Note that the proof only covers the terminal server certificate,
56498 not any of the chain from CA to it.
56499 </para>
56500 <para>
56501 There is no current way to staple a proof for a client certificate.
56502 </para>
56503 <literallayout class="monospaced">
56504   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
56505   OCSP server is supplied.  The server URL may be included in the
56506   server certificate, if the CA is helpful.
56507
56508   One failure mode seen was the OCSP Signer cert expiring before the end
56509   of validity of the OCSP proof. The checking done by Exim/OpenSSL
56510   noted this as invalid overall, but the re-fetch script did not.
56511 </literallayout>
56512 </section>
56513 <section id="SECTclientTLS">
56514 <title>Configuring an Exim client to use TLS</title>
56515 <para>
56516 <indexterm role="concept">
56517 <primary>cipher</primary>
56518 <secondary>logging</secondary>
56519 </indexterm>
56520 <indexterm role="concept">
56521 <primary>log</primary>
56522 <secondary>TLS cipher</secondary>
56523 </indexterm>
56524 <indexterm role="concept">
56525 <primary>log</primary>
56526 <secondary>distinguished name</secondary>
56527 </indexterm>
56528 <indexterm role="concept">
56529 <primary>TLS</primary>
56530 <secondary>configuring an Exim client</secondary>
56531 </indexterm>
56532 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
56533 deliveries as well as to incoming, the latter one causing logging of the
56534 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
56535 within the <command>smtp</command> transport.
56536 </para>
56537 <para>
56538 <indexterm role="concept">
56539 <primary>ESMTP extensions</primary>
56540 <secondary>STARTTLS</secondary>
56541 </indexterm>
56542 It is not necessary to set any options to have TLS work in the <command>smtp</command>
56543 transport. If Exim is built with TLS support, and TLS is advertised by a
56544 server, the <command>smtp</command> transport always tries to start a TLS session. However,
56545 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
56546 transport) to a list of server hosts for which TLS should not be used.
56547 </para>
56548 <para>
56549 If you do not want Exim to attempt to send messages unencrypted when an attempt
56550 to set up an encrypted connection fails in any way, you can set
56551 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
56552 those hosts, delivery is always deferred if an encrypted connection cannot be
56553 set up. If there are any other hosts for the address, they are tried in the
56554 usual way.
56555 </para>
56556 <para>
56557 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
56558 the message unencrypted. It always does this if the response to STARTTLS is
56559 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
56560 session after a success response code, what happens is controlled by the
56561 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
56562 delivery to this host is deferred, and other hosts (if available) are tried. If
56563 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
56564 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
56565 negotiation fails, Exim closes the current connection (because it is in an
56566 unknown state), opens a new one to the same host, and then tries the delivery
56567 unencrypted.
56568 </para>
56569 <para>
56570 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
56571 transport provide the client with a certificate, which is passed to the server
56572 if it requests it. If the server is Exim, it will request a certificate only if
56573 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
56574 </para>
56575 <para>
56576 <emphasis role="bold">Note</emphasis>: Do not use a certificate which has the OCSP-must-staple extension,
56577 for client use (they are usable for server use).
56578 As the TLS protocol has no means for the client to staple before TLS 1.3 it will result
56579 in failed connections.
56580 </para>
56581 <para>
56582 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
56583 specifies a collection of expected server certificates.
56584 These may be
56585 the system default set (depending on library version),
56586 a file,
56587 or (depending on library version) a directory.
56588 The client verifies the server&#x2019;s certificate
56589 against this collection, taking into account any revoked certificates that are
56590 in the list defined by <option>tls_crl</option>.
56591 Failure to verify fails the TLS connection unless either of the
56592 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
56593 </para>
56594 <para>
56595 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
56596 certificate verification to the listed servers.  Verification either must
56597 or need not succeed respectively.
56598 </para>
56599 <para>
56600 The <option>tls_verify_cert_hostnames</option> option lists hosts for which additional
56601 checks are made: that the host name (the one in the DNS A record)
56602 is valid for the certificate.
56603 The option defaults to always checking.
56604 </para>
56605 <para>
56606 The <command>smtp</command> transport has two OCSP-related options:
56607 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
56608 is requested and required for the connection to proceed.  The default
56609 value is empty.
56610 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
56611 a Certificate Status is requested (but not necessarily verified).  The default
56612 value is "*" meaning that requests are made unless configured
56613 otherwise.
56614 </para>
56615 <para>
56616 The host(s) should also be in <option>hosts_require_tls</option>, and
56617 <option>tls_verify_certificates</option> configured for the transport,
56618 for OCSP to be relevant.
56619 </para>
56620 <para>
56621 If
56622 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
56623 list of permitted cipher suites. If either of these checks fails, delivery to
56624 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
56625 alternative hosts, if any.
56626 </para>
56627 <para>
56628  <emphasis role="bold">Note</emphasis>:
56629 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
56630 is operating as a client. Exim does not assume that a server certificate (set
56631 by the global options of the same name) should also be used when operating as a
56632 client.
56633 </para>
56634 <para>
56635 <indexterm role="variable">
56636 <primary><varname>$host</varname></primary>
56637 </indexterm>
56638 <indexterm role="variable">
56639 <primary><varname>$host_address</varname></primary>
56640 </indexterm>
56641 All the TLS options in the <command>smtp</command> transport are expanded before use, with
56642 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
56643 which the client is connected. Forced failure of an expansion causes Exim to
56644 behave as if the relevant option were unset.
56645 </para>
56646 <para>
56647 <indexterm role="variable">
56648 <primary><varname>$tls_out_bits</varname></primary>
56649 </indexterm>
56650 <indexterm role="variable">
56651 <primary><varname>$tls_out_cipher</varname></primary>
56652 </indexterm>
56653 <indexterm role="variable">
56654 <primary><varname>$tls_out_peerdn</varname></primary>
56655 </indexterm>
56656 <indexterm role="variable">
56657 <primary><varname>$tls_out_sni</varname></primary>
56658 </indexterm>
56659 Before an SMTP connection is established, the
56660 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
56661 variables are emptied. (Until the first connection, they contain the values
56662 that were set when the message was received.) If STARTTLS is subsequently
56663 successfully obeyed, these variables are set to the relevant values for the
56664 outgoing connection.
56665 </para>
56666 </section>
56667 <section id="SECTtlssni">
56668 <title>Use of TLS Server Name Indication</title>
56669 <para>
56670 <indexterm role="concept">
56671 <primary>TLS</primary>
56672 <secondary>Server Name Indication</secondary>
56673 </indexterm>
56674 <indexterm role="variable">
56675 <primary><varname>$tls_in_sni</varname></primary>
56676 </indexterm>
56677 <indexterm role="option">
56678 <primary><option>tls_in_sni</option></primary>
56679 </indexterm>
56680 With TLS1.0 or above, there is an extension mechanism by which extra
56681 information can be included at various points in the protocol.  One of these
56682 extensions, documented in RFC 6066 (and before that RFC 4366) is
56683 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
56684 client in the initial handshake, so that the server can examine the servername
56685 within and possibly choose to use different certificates and keys (and more)
56686 for this session.
56687 </para>
56688 <para>
56689 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
56690 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
56691 address.
56692 </para>
56693 <para>
56694 With SMTP to MX, there are the same problems here as in choosing the identity
56695 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
56696 provide the identity which you then cryptographically verify.  So this will
56697 be of limited use in that environment.
56698 </para>
56699 <para>
56700 With SMTP to Submission, there is a well-defined hostname which clients are
56701 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
56702 choose to include this information in the TLS negotiation.  If this becomes
56703 wide-spread, then hosters can choose to present different certificates to
56704 different clients.  Or even negotiate different cipher suites.
56705 </para>
56706 <para>
56707 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
56708 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
56709 nothing more to it.  Choosing a sensible value not derived insecurely is the
56710 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
56711 for the lifetime of the client connection (including during authentication).
56712 </para>
56713 <para>
56714 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
56715 received from a client.
56716 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
56717 </para>
56718 <para>
56719 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
56720 option (prior to expansion) then the following options will be re-expanded
56721 during TLS session handshake, to permit alternative values to be chosen:
56722 </para>
56723 <itemizedlist>
56724 <listitem>
56725 <para>
56726 <option>tls_certificate</option>
56727 </para>
56728 </listitem>
56729 <listitem>
56730 <para>
56731 <option>tls_crl</option>
56732 </para>
56733 </listitem>
56734 <listitem>
56735 <para>
56736 <option>tls_privatekey</option>
56737 </para>
56738 </listitem>
56739 <listitem>
56740 <para>
56741 <option>tls_verify_certificates</option>
56742 </para>
56743 </listitem>
56744 <listitem>
56745 <para>
56746 <option>tls_ocsp_file</option>
56747 </para>
56748 </listitem>
56749 </itemizedlist>
56750 <para>
56751 Great care should be taken to deal with matters of case, various injection
56752 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
56753 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
56754 arbitrary unverified data provided prior to authentication.
56755 Further, the initial certificate is loaded before SNI has arrived, so
56756 an expansion for <option>tls_certificate</option> must have a default which is used
56757 when <varname>$tls_in_sni</varname> is empty.
56758 </para>
56759 <para>
56760 The Exim developers are proceeding cautiously and so far no other TLS options
56761 are re-expanded.
56762 </para>
56763 <para>
56764 When Exim is built against OpenSSL, OpenSSL must have been built with support
56765 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
56766 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
56767 see <literal>-servername</literal> in the output, then OpenSSL has support.
56768 </para>
56769 <para>
56770 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
56771 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
56772 built, then you have SNI support).
56773 </para>
56774 </section>
56775 <section id="SECTmulmessam">
56776 <title>Multiple messages on the same encrypted TCP/IP connection</title>
56777 <para>
56778 <indexterm role="concept">
56779 <primary>multiple SMTP deliveries with TLS</primary>
56780 </indexterm>
56781 <indexterm role="concept">
56782 <primary>TLS</primary>
56783 <secondary>multiple message deliveries</secondary>
56784 </indexterm>
56785 Exim sends multiple messages down the same TCP/IP connection by starting up
56786 an entirely new delivery process for each message, passing the socket from
56787 one process to the next. This implementation does not fit well with the use
56788 of TLS, because there is quite a lot of state information associated with a TLS
56789 connection, not just a socket identification. Passing all the state information
56790 to a new process is not feasible. Consequently, for sending using TLS Exim
56791 starts an additional proxy process for handling the encryption, piping the
56792 unencrypted data stream from and to the delivery processes.
56793 </para>
56794 <para>
56795 An older mode of operation can be enabled on a per-host basis by the
56796 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
56797 this list the proxy process described above is not used; instead Exim
56798 shuts down an existing TLS session being run by the delivery process
56799 before passing the socket to a new process. The new process may then
56800 try to start a new TLS session, and if successful, may try to re-authenticate
56801 if AUTH is in use, before sending the next message.
56802 </para>
56803 <para>
56804 The RFC is not clear as to whether or not an SMTP session continues in clear
56805 after TLS has been shut down, or whether TLS may be restarted again later, as
56806 just described. However, if the server is Exim, this shutdown and
56807 reinitialization works. It is not known which (if any) other servers operate
56808 successfully if the client closes a TLS session and continues with unencrypted
56809 SMTP, but there are certainly some that do not work. For such servers, Exim
56810 should not pass the socket to another process, because the failure of the
56811 subsequent attempt to use it would cause Exim to record a temporary host error,
56812 and delay other deliveries to that host.
56813 </para>
56814 <para>
56815 To test for this case, Exim sends an EHLO command to the server after
56816 closing down the TLS session. If this fails in any way, the connection is
56817 closed instead of being passed to a new delivery process, but no retry
56818 information is recorded.
56819 </para>
56820 <para>
56821 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
56822 <command>smtp</command> transport to match those hosts for which Exim should not pass
56823 connections to new processes if TLS has been used.
56824 </para>
56825 </section>
56826 <section id="SECTcerandall">
56827 <title>Certificates and all that</title>
56828 <para>
56829 <indexterm role="concept">
56830 <primary>certificate</primary>
56831 <secondary>references to discussion</secondary>
56832 </indexterm>
56833 In order to understand fully how TLS works, you need to know about
56834 certificates, certificate signing, and certificate authorities.
56835 This is a large topic and an introductory guide is unsuitable for the Exim
56836 reference manual, so instead we provide pointers to existing documentation.
56837 </para>
56838 <para>
56839 The Apache web-server was for a long time the canonical guide, so their
56840 documentation is a good place to start; their SSL module&#x2019;s Introduction
56841 document is currently at
56842 </para>
56843 <literallayout>
56844 <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>
56845 </literallayout>
56846 <para>
56847 and their FAQ is at
56848 </para>
56849 <literallayout>
56850 <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>
56851 </literallayout>
56852 <para>
56853 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
56854 0-201-61598-3) in 2001, contains both introductory and more in-depth
56855 descriptions.
56856 More recently Ivan Ristić&#x2019;s book <emphasis>Bulletproof SSL and TLS</emphasis>,
56857 published by Feisty Duck (ISBN 978-1907117046) in 2013 is good.
56858 Ivan is the author of the popular TLS testing tools at
56859 <emphasis role="bold"><ulink url="https://www.ssllabs.com/">https://www.ssllabs.com/</ulink></emphasis>.
56860 </para>
56861 </section>
56862 <section id="SECID186">
56863 <title>Certificate chains</title>
56864 <para>
56865 The file named by <option>tls_certificate</option> may contain more than one
56866 certificate. This is useful in the case where the certificate that is being
56867 sent is validated by an intermediate certificate which the other end does
56868 not have. Multiple certificates must be in the correct order in the file.
56869 First the host&#x2019;s certificate itself, then the first intermediate
56870 certificate to validate the issuer of the host certificate, then the next
56871 intermediate certificate to validate the issuer of the first intermediate
56872 certificate, and so on, until finally (optionally) the root certificate.
56873 The root certificate must already be trusted by the recipient for
56874 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
56875 root certificate along with the rest makes it available for the user to
56876 install if the receiving end is a client MUA that can interact with a user.
56877 </para>
56878 <para>
56879 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
56880 even if your libraries allow loading them for use in Exim when acting as a
56881 server, increasingly clients will not accept such certificates.  The error
56882 diagnostics in such a case can be frustratingly vague.
56883 </para>
56884 </section>
56885 <section id="SECID187">
56886 <title>Self-signed certificates</title>
56887 <para>
56888 <indexterm role="concept">
56889 <primary>certificate</primary>
56890 <secondary>self-signed</secondary>
56891 </indexterm>
56892 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
56893 with OpenSSL, like this:
56894 </para>
56895 <literallayout class="monospaced">
56896 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
56897             -days 9999 -nodes
56898 </literallayout>
56899 <para>
56900 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
56901 delimited and so can be identified independently. The <option>-days</option> option
56902 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
56903 important: if you do not set it, the key is encrypted with a passphrase
56904 that you are prompted for, and any use that is made of the key causes more
56905 prompting for the passphrase. This is not helpful if you are going to use
56906 this certificate and key in an MTA, where prompting is not possible.
56907 </para>
56908 <para>
56909 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
56910 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
56911 the above command might produce a date in the past.  Think carefully about
56912 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
56913 of the certificate or reconsider your platform deployment.  (At time of
56914 writing, reducing the duration is the most likely choice, but the inexorable
56915 progression of time takes us steadily towards an era where this will not
56916 be a sensible resolution).
56917 </para>
56918 <para>
56919 A self-signed certificate made in this way is sufficient for testing, and
56920 may be adequate for all your requirements if you are mainly interested in
56921 encrypting transfers, and not in secure identification.
56922 </para>
56923 <para>
56924 However, many clients require that the certificate presented by the server be a
56925 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
56926 certificate. In this situation, the self-signed certificate described above
56927 must be installed on the client host as a trusted root <emphasis>certification
56928 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
56929 signed with that self-signed certificate.
56930 </para>
56931 <para>
56932 For information on creating self-signed CA certificates and using them to sign
56933 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
56934 Open-source PKI book, available online at
56935 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/ospkibook/">https://sourceforge.net/projects/ospkibook/</ulink></emphasis>.
56936 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
56937 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
56938 </para>
56939 </section>
56940 <section id="SECDANE">
56941 <title>DANE</title>
56942 <para>
56943 <indexterm role="concept">
56944 <primary>DANE</primary>
56945 </indexterm>
56946 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
56947 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
56948 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
56949 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
56950 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
56951 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
56952 </para>
56953 <para>
56954 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
56955 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
56956 by (a) is thought to be smaller than that of the set of root CAs.
56957 </para>
56958 <para>
56959 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
56960 fail to pass on a server&#x2019;s STARTTLS.
56961 </para>
56962 <para>
56963 DANE scales better than having to maintain (and side-channel communicate) copies of server certificates
56964 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
56965 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
56966 </para>
56967 <para>
56968 DANE requires a server operator to do three things: 1) run DNSSEC.  This provides assurance to clients
56969 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
56970 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
56971 DNSSEC.
56972 2) add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
56973 3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
56974 </para>
56975 <para>
56976 There are no changes to Exim specific to server-side operation of DANE.
56977 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
56978 in <filename>Local/Makefile</filename>.
56979 If it has been included, the macro "_HAVE_DANE" will be defined.
56980 </para>
56981 <para>
56982 A TLSA record consist of 4 fields, the "Certificate Usage", the
56983 "Selector", the "Matching type", and the "Certificate Association Data".
56984 For a detailed description of the TLSA record see
56985 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc7671#page-5">RFC 7671</ulink></emphasis>.
56986 </para>
56987 <para>
56988 The TLSA record for the server may have "Certificate Usage" (1st) field of DANE-TA(2) or DANE-EE(3).
56989 These are the "Trust Anchor" and "End Entity" variants.
56990 The latter specifies the End Entity directly, i.e. the certificate involved is that of the server
56991 (and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake);
56992 this is appropriate for a single system, using a self-signed certificate.
56993 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
56994 well-known one.
56995 A private CA at simplest is just a self-signed certificate (with certain
56996 attributes) which is used to sign server certificates, but running one securely
56997 does require careful arrangement.
56998 With DANE-TA, as implemented in Exim and commonly in other MTAs,
56999 the server TLS handshake must transmit the entire certificate chain from CA to server-certificate.
57000 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
57001 all of which point to a single TLSA record.
57002 DANE-TA and DANE-EE can both be used together.
57003 </para>
57004 <para>
57005 Our recommendation is to use DANE with a certificate from a public CA,
57006 because this enables a variety of strategies for remote clients to verify
57007 your certificate.
57008 You can then publish information both via DANE and another technology,
57009 "MTA-STS", described below.
57010 </para>
57011 <para>
57012 When you use DANE-TA to publish trust anchor information, you ask entities
57013 outside your administrative control to trust the Certificate Authority for
57014 connections to you.
57015 If using a private CA then you should expect others to still apply the
57016 technical criteria they&#x2019;d use for a public CA to your certificates.
57017 In particular, you should probably try to follow current best practices for CA
57018 operation around hash algorithms and key sizes.
57019 Do not expect other organizations to lower their security expectations just
57020 because a particular profile might be reasonable for your own internal use.
57021 </para>
57022 <para>
57023 When this text was last updated, this in practice means to avoid use of SHA-1
57024 and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger
57025 than 4096, for interoperability); to use keyUsage fields correctly; to use
57026 random serial numbers.
57027 The list of requirements is subject to change as best practices evolve.
57028 If you&#x2019;re not already using a private CA, or it doesn&#x2019;t meet these
57029 requirements, then we encourage you to avoid all these issues and use a public
57030 CA such as <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis> instead.
57031 </para>
57032 <para>
57033 The TLSA record should have a "Selector" (2nd) field of SPKI(1) and
57034 a "Matching Type" (3rd) field of SHA2-512(2).
57035 </para>
57036 <para>
57037 For the "Certificate Authority Data" (4th) field, commands like
57038 </para>
57039 <literallayout class="monospaced">
57040   openssl x509 -pubkey -noout &lt;certificate.pem \
57041   | openssl rsa -outform der -pubin 2&gt;/dev/null \
57042   | openssl sha512 \
57043   | awk '{print $2}'
57044 </literallayout>
57045 <para>
57046 are workable to create a hash of the certificate&#x2019;s public key.
57047 </para>
57048 <para>
57049 An example TLSA record for DANE-EE(3), SPKI(1), and SHA-512 (2) looks like
57050 </para>
57051 <literallayout class="monospaced">
57052   _25._tcp.mail.example.com. TLSA 3 1 2 8BA8A336E...
57053 </literallayout>
57054 <para>
57055 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>
57056 is useful for quickly generating TLSA records.
57057 </para>
57058 <para>
57059 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
57060 </para>
57061 <para>
57062 The Certificate issued by the CA published in the DANE-TA model should be
57063 issued using a strong hash algorithm.
57064 Exim, and importantly various other MTAs sending to you, will not
57065 re-enable hash algorithms which have been disabled by default in TLS
57066 libraries.
57067 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
57068 interoperability (and probably the maximum too, in 2018).
57069 </para>
57070 <para>
57071 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
57072 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
57073 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
57074 </para>
57075 <literallayout class="monospaced">
57076   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
57077                                  {= {4}{$tls_out_tlsa_usage}} } \
57078                          {*}{}}
57079 </literallayout>
57080 <para>
57081 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
57082 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
57083 found. If the definition of <option>hosts_request_ocsp</option> includes the
57084 string "tls_out_tlsa_usage", they are re-expanded in time to
57085 control the OCSP request.
57086 </para>
57087 <para>
57088 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
57089 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
57090 </para>
57091 <para>
57092 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
57093 and <option>dane_require_tls_ciphers</option>.
57094 The <quote>require</quote> variant will result in failure if the target host is not
57095 DNSSEC-secured. To get DNSSEC-secured hostname resolution, use
57096 the <option>dnssec_request_domains</option> router or transport option.
57097 </para>
57098 <para>
57099 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
57100 </para>
57101 <para>
57102 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using dnssec.
57103 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
57104 will be required for the host.  If it does not, the host will not
57105 be used; there is no fallback to non-DANE or non-TLS.
57106 </para>
57107 <para>
57108 If DANE is requested and usable, then the TLS cipher list configuration
57109 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
57110 back to <option>tls_require_ciphers</option> only if that is unset.
57111 This lets you configure "decent crypto" for DANE and "better than nothing
57112 crypto" as the default.  Note though that while GnuTLS lets the string control
57113 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
57114 limited to ciphersuite constraints.
57115 </para>
57116 <para>
57117 If DANE is requested and useable (see above) the following transport options are ignored:
57118 </para>
57119 <literallayout class="monospaced">
57120   hosts_require_tls
57121   tls_verify_hosts
57122   tls_try_verify_hosts
57123   tls_verify_certificates
57124   tls_crl
57125   tls_verify_cert_hostnames
57126 </literallayout>
57127 <para>
57128 If DANE is not usable, whether requested or not, and CA-anchored
57129 verification evaluation is wanted, the above variables should be set appropriately.
57130 </para>
57131 <para>
57132 The router and transport option <option>dnssec_request_domains</option> must not be
57133 set to <quote>never</quote>, and <option>dnssec_require_domains</option> is ignored.
57134 </para>
57135 <para>
57136 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
57137 </para>
57138 <para>
57139 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
57140 verification succeeded using DANE and "no" otherwise (only useful
57141 in combination with events; see <xref linkend="CHAPevents"/>),
57142 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
57143 </para>
57144 <para>
57145 <indexterm role="concept">
57146 <primary>DANE</primary>
57147 <secondary>reporting</secondary>
57148 </indexterm>
57149 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
57150 to achieve DANE-verified connection, if one was either requested and offered, or
57151 required.  This is intended to support TLS-reporting as defined in
57152 <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>.
57153 The <varname>$event_data</varname> will be one of the Result Types defined in
57154 Section 4.3 of that document.
57155 </para>
57156 <para>
57157 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
57158 </para>
57159 <para>
57160 DANE is specified in published RFCs and decouples certificate authority trust
57161 selection from a "race to the bottom" of "you must trust everything for mail
57162 to get through".  There is an alternative technology called MTA-STS, which
57163 instead publishes MX trust anchor information on an HTTPS website.  At the
57164 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
57165 Exim has no support for MTA-STS as a client, but Exim mail server operators
57166 can choose to publish information describing their TLS configuration using
57167 MTA-STS to let those clients who do use that protocol derive trust
57168 information.
57169 </para>
57170 <para>
57171 The MTA-STS design requires a certificate from a public Certificate Authority
57172 which is recognized by clients sending to you.
57173 That selection of which CAs are trusted by others is outside your control.
57174 </para>
57175 <para>
57176 The most interoperable course of action is probably to use
57177 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
57178 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
57179 records for DANE clients (such as Exim and Postfix) and to publish anchor
57180 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
57181 domain itself (with caveats around occasionally broken MTA-STS because of
57182 incompatible specification changes prior to reaching RFC status).
57183 </para>
57184 </section>
57185 </chapter>
57186
57187 <chapter id="CHAPACL">
57188 <title>Access control lists</title>
57189 <para>
57190 <indexterm role="concept" id="IIDacl" class="startofrange">
57191 <primary>access control lists (ACLs)</primary>
57192 <secondary>description</secondary>
57193 </indexterm>
57194 <indexterm role="concept">
57195 <primary>control of incoming mail</primary>
57196 </indexterm>
57197 <indexterm role="concept">
57198 <primary>message</primary>
57199 <secondary>controlling incoming</secondary>
57200 </indexterm>
57201 <indexterm role="concept">
57202 <primary>policy control</primary>
57203 <secondary>access control lists</secondary>
57204 </indexterm>
57205 Access Control Lists (ACLs) are defined in a separate section of the runtime
57206 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
57207 name, terminated by a colon. Here is a complete ACL section that contains just
57208 one very small ACL:
57209 </para>
57210 <literallayout class="monospaced">
57211 begin acl
57212 small_acl:
57213   accept   hosts = one.host.only
57214 </literallayout>
57215 <para>
57216 You can have as many lists as you like in the ACL section, and the order in
57217 which they appear does not matter. The lists are self-terminating.
57218 </para>
57219 <para>
57220 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
57221 certain SMTP commands. This applies both to incoming TCP/IP connections, and
57222 when a local process submits a message using SMTP by specifying the <option>-bs</option>
57223 option. The most common use is for controlling which recipients are accepted
57224 in incoming messages. In addition, you can define an ACL that is used to check
57225 local non-SMTP messages. The default configuration file contains an example of
57226 a realistic ACL for checking RCPT commands. This is discussed in chapter
57227 <xref linkend="CHAPdefconfil"/>.
57228 </para>
57229 <section id="SECID188">
57230 <title>Testing ACLs</title>
57231 <para>
57232 The <option>-bh</option> command line option provides a way of testing your ACL
57233 configuration locally by running a fake SMTP session with which you interact.
57234 </para>
57235 </section>
57236 <section id="SECID189">
57237 <title>Specifying when ACLs are used</title>
57238 <para>
57239 <indexterm role="concept">
57240 <primary>access control lists (ACLs)</primary>
57241 <secondary>options for specifying</secondary>
57242 </indexterm>
57243 In order to cause an ACL to be used, you have to name it in one of the relevant
57244 options in the main part of the configuration. These options are:
57245 <indexterm role="concept">
57246 <primary>AUTH</primary>
57247 <secondary>ACL for</secondary>
57248 </indexterm>
57249 <indexterm role="concept">
57250 <primary>DATA</primary>
57251 <secondary>ACLs for</secondary>
57252 </indexterm>
57253 <indexterm role="concept">
57254 <primary>ETRN</primary>
57255 <secondary>ACL for</secondary>
57256 </indexterm>
57257 <indexterm role="concept">
57258 <primary>EXPN</primary>
57259 <secondary>ACL for</secondary>
57260 </indexterm>
57261 <indexterm role="concept">
57262 <primary>HELO</primary>
57263 <secondary>ACL for</secondary>
57264 </indexterm>
57265 <indexterm role="concept">
57266 <primary>EHLO</primary>
57267 <secondary>ACL for</secondary>
57268 </indexterm>
57269 <indexterm role="concept">
57270 <primary>DKIM</primary>
57271 <secondary>ACL for</secondary>
57272 </indexterm>
57273 <indexterm role="concept">
57274 <primary>MAIL</primary>
57275 <secondary>ACL for</secondary>
57276 </indexterm>
57277 <indexterm role="concept">
57278 <primary>QUIT, ACL for</primary>
57279 </indexterm>
57280 <indexterm role="concept">
57281 <primary>RCPT</primary>
57282 <secondary>ACL for</secondary>
57283 </indexterm>
57284 <indexterm role="concept">
57285 <primary>STARTTLS, ACL for</primary>
57286 </indexterm>
57287 <indexterm role="concept">
57288 <primary>VRFY</primary>
57289 <secondary>ACL for</secondary>
57290 </indexterm>
57291 <indexterm role="concept">
57292 <primary>SMTP</primary>
57293 <secondary>connection, ACL for</secondary>
57294 </indexterm>
57295 <indexterm role="concept">
57296 <primary>non-SMTP messages</primary>
57297 <secondary>ACLs for</secondary>
57298 </indexterm>
57299 <indexterm role="concept">
57300 <primary>MIME content scanning</primary>
57301 <secondary>ACL for</secondary>
57302 </indexterm>
57303 <indexterm role="concept">
57304 <primary>PRDR</primary>
57305 <secondary>ACL for</secondary>
57306 </indexterm>
57307 </para>
57308 <informaltable frame="none">
57309 <tgroup cols="2" colsep="0" rowsep="0">
57310 <colspec colwidth="140pt" align="left"/>
57311 <colspec colwidth="254pt" align="left"/>
57312 <tbody>
57313 <row>
57314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
57315 <entry>ACL for non-SMTP messages</entry>
57316 </row>
57317 <row>
57318 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
57319 <entry>ACL for non-SMTP MIME parts</entry>
57320 </row>
57321 <row>
57322 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
57323 <entry>ACL at start of non-SMTP message</entry>
57324 </row>
57325 <row>
57326 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
57327 <entry>ACL for AUTH</entry>
57328 </row>
57329 <row>
57330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
57331 <entry>ACL for start of SMTP connection</entry>
57332 </row>
57333 <row>
57334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
57335 <entry>ACL after DATA is complete</entry>
57336 </row>
57337 <row>
57338 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
57339 <entry>ACL for each recipient, after DATA is complete</entry>
57340 </row>
57341 <row>
57342 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
57343 <entry>ACL for each DKIM signer</entry>
57344 </row>
57345 <row>
57346 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
57347 <entry>ACL for ETRN</entry>
57348 </row>
57349 <row>
57350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
57351 <entry>ACL for EXPN</entry>
57352 </row>
57353 <row>
57354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
57355 <entry>ACL for HELO or EHLO</entry>
57356 </row>
57357 <row>
57358 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
57359 <entry>ACL for MAIL</entry>
57360 </row>
57361 <row>
57362 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
57363 <entry>ACL for the AUTH parameter of MAIL</entry>
57364 </row>
57365 <row>
57366 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
57367 <entry>ACL for content-scanning MIME parts</entry>
57368 </row>
57369 <row>
57370 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
57371 <entry>ACL for non-QUIT terminations</entry>
57372 </row>
57373 <row>
57374 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
57375 <entry>ACL at start of DATA command</entry>
57376 </row>
57377 <row>
57378 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
57379 <entry>ACL for QUIT</entry>
57380 </row>
57381 <row>
57382 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
57383 <entry>ACL for RCPT</entry>
57384 </row>
57385 <row>
57386 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
57387 <entry>ACL for STARTTLS</entry>
57388 </row>
57389 <row>
57390 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
57391 <entry>ACL for VRFY</entry>
57392 </row>
57393 </tbody>
57394 </tgroup>
57395 </informaltable>
57396 <para>
57397 For example, if you set
57398 </para>
57399 <literallayout class="monospaced">
57400 acl_smtp_rcpt = small_acl
57401 </literallayout>
57402 <para>
57403 the little ACL defined above is used whenever Exim receives a RCPT command
57404 in an SMTP dialogue. The majority of policy tests on incoming messages can be
57405 done when RCPT commands arrive. A rejection of RCPT should cause the
57406 sending MTA to give up on the recipient address contained in the RCPT
57407 command, whereas rejection at other times may cause the client MTA to keep on
57408 trying to deliver the message. It is therefore recommended that you do as much
57409 testing as possible at RCPT time.
57410 </para>
57411 </section>
57412 <section id="SECID190">
57413 <title>The non-SMTP ACLs</title>
57414 <para>
57415 <indexterm role="concept">
57416 <primary>non-SMTP messages</primary>
57417 <secondary>ACLs for</secondary>
57418 </indexterm>
57419 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
57420 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
57421 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
57422 the state of the SMTP connection such as encryption and authentication) are not
57423 relevant and are forbidden in these ACLs. However, the sender and recipients
57424 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
57425 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
57426 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
57427 in any of these ACLs.
57428 </para>
57429 <para>
57430 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
57431 non-SMTP message, before any of the message has been read. (This is the
57432 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
57433 batched SMTP input, it runs after the DATA command has been reached. The
57434 result of this ACL is ignored; it cannot be used to reject a message. If you
57435 really need to, you could set a value in an ACL variable here and reject based
57436 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
57437 controls, and in particular, it can be used to set
57438 </para>
57439 <literallayout class="monospaced">
57440 control = suppress_local_fixups
57441 </literallayout>
57442 <para>
57443 This cannot be used in the other non-SMTP ACLs because by the time they are
57444 run, it is too late.
57445 </para>
57446 <para>
57447 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
57448 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
57449 </para>
57450 <para>
57451 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
57452 kind of rejection is treated as permanent, because there is no way of sending a
57453 temporary error for these kinds of message.
57454 </para>
57455 </section>
57456 <section id="SECID191">
57457 <title>The SMTP connect ACL</title>
57458 <para>
57459 <indexterm role="concept">
57460 <primary>SMTP</primary>
57461 <secondary>connection, ACL for</secondary>
57462 </indexterm>
57463 <indexterm role="option">
57464 <primary><option>smtp_banner</option></primary>
57465 </indexterm>
57466 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
57467 session, after the test specified by <option>host_reject_connection</option> (which is now
57468 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
57469 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
57470 the message override the banner message that is otherwise specified by the
57471 <option>smtp_banner</option> option.
57472 </para>
57473 </section>
57474 <section id="SECID192">
57475 <title>The EHLO/HELO ACL</title>
57476 <para>
57477 <indexterm role="concept">
57478 <primary>EHLO</primary>
57479 <secondary>ACL for</secondary>
57480 </indexterm>
57481 <indexterm role="concept">
57482 <primary>HELO</primary>
57483 <secondary>ACL for</secondary>
57484 </indexterm>
57485 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
57486 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
57487 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
57488 Note that a client may issue more than one EHLO or HELO command in an SMTP
57489 session, and indeed is required to issue a new EHLO or HELO after successfully
57490 setting up encryption following a STARTTLS command.
57491 </para>
57492 <para>
57493 Note also that a deny neither forces the client to go away nor means that
57494 mail will be refused on the connection.  Consider checking for
57495 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
57496 </para>
57497 <para>
57498 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
57499 modifier, the message may not contain more than one line (it will be truncated
57500 at the first newline and a panic logged if it does). Such a message cannot
57501 affect the EHLO options that are listed on the second and subsequent lines of
57502 an EHLO response.
57503 </para>
57504 </section>
57505 <section id="SECID193">
57506 <title>The DATA ACLs</title>
57507 <para>
57508 <indexterm role="concept">
57509 <primary>DATA</primary>
57510 <secondary>ACLs for</secondary>
57511 </indexterm>
57512 Two ACLs are associated with the DATA command, because it is two-stage
57513 command, with two responses being sent to the client.
57514 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
57515 is obeyed. This gives you control after all the RCPT commands, but before
57516 the message itself is received. It offers the opportunity to give a negative
57517 response to the DATA command before the data is transmitted. Header lines
57518 added by MAIL or RCPT ACLs are not visible at this time, but any that
57519 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
57520 </para>
57521 <para>
57522 You cannot test the contents of the message, for example, to verify addresses
57523 in the headers, at RCPT time or when the DATA command is received. Such
57524 tests have to appear in the ACL that is run after the message itself has been
57525 received, before the final response to the DATA command is sent. This is
57526 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
57527 associated with the DATA command.
57528 </para>
57529 <para>
57530 <indexterm role="concept">
57531 <primary>CHUNKING</primary>
57532 <secondary>BDAT command</secondary>
57533 </indexterm>
57534 <indexterm role="concept">
57535 <primary>BDAT</primary>
57536 <secondary>SMTP command</secondary>
57537 </indexterm>
57538 <indexterm role="concept">
57539 <primary>RFC 3030</primary>
57540 <secondary>CHUNKING</secondary>
57541 </indexterm>
57542 If CHUNKING was advertised and a BDAT command sequence is received,
57543 the <option>acl_smtp_predata</option> ACL is not run.
57544 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
57545 the data specified is received.
57546 </para>
57547 <para>
57548 For both of these ACLs, it is not possible to reject individual recipients. An
57549 error response rejects the entire message. Unfortunately, it is known that some
57550 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
57551 before or after the data) correctly &ndash; they keep the message on their queues
57552 and try again later, but that is their problem, though it does waste some of
57553 your resources.
57554 </para>
57555 <para>
57556 The <option>acl_smtp_data</option> ACL is run after
57557 the <option>acl_smtp_data_prdr</option>,
57558 the <option>acl_smtp_dkim</option>
57559 and the <option>acl_smtp_mime</option> ACLs.
57560 </para>
57561 </section>
57562 <section id="SECTDKIMACL">
57563 <title>The SMTP DKIM ACL</title>
57564 <para>
57565 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
57566 enabled (which is the default).
57567 </para>
57568 <para>
57569 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
57570 received, and is executed for each DKIM signature found in a message.  If not
57571 otherwise specified, the default action is to accept.
57572 </para>
57573 <para>
57574 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
57575 </para>
57576 <para>
57577 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
57578 </para>
57579 </section>
57580 <section id="SECID194">
57581 <title>The SMTP MIME ACL</title>
57582 <para>
57583 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
57584 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
57585 </para>
57586 <para>
57587 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
57588 </para>
57589 </section>
57590 <section id="SECTPRDRACL">
57591 <title>The SMTP PRDR ACL</title>
57592 <para>
57593 <indexterm role="concept">
57594 <primary>PRDR</primary>
57595 <secondary>ACL for</secondary>
57596 </indexterm>
57597 <indexterm role="option">
57598 <primary><option>prdr_enable</option></primary>
57599 </indexterm>
57600 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
57601 with PRDR support enabled (which is the default).
57602 It becomes active only when the PRDR feature is negotiated between
57603 client and server for a message, and more than one recipient
57604 has been accepted.
57605 </para>
57606 <para>
57607 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
57608 has been received, and is executed once for each recipient of the message
57609 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
57610 The test may accept, defer or deny for individual recipients.
57611 The <option>acl_smtp_data</option> will still be called after this ACL and
57612 can reject the message overall, even if this ACL has accepted it
57613 for some or all recipients.
57614 </para>
57615 <para>
57616 PRDR may be used to support per-user content filtering.  Without it
57617 one must defer any recipient after the first that has a different
57618 content-filter configuration.  With PRDR, the RCPT-time check
57619 <indexterm role="concept">
57620 <primary>PRDR</primary>
57621 <secondary>variable for</secondary>
57622 </indexterm>
57623 for this can be disabled when the variable <varname>$prdr_requested</varname>
57624 is <quote>yes</quote>.
57625 Any required difference in behaviour of the main DATA-time
57626 ACL should however depend on the PRDR-time ACL having run, as Exim
57627 will avoid doing so in some situations (e.g. single-recipient mails).
57628 </para>
57629 <para>
57630 See also the <option>prdr_enable</option> global option
57631 and the <option>hosts_try_prdr</option> smtp transport option.
57632 </para>
57633 <para>
57634 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
57635 If the ACL is not defined, processing completes as if
57636 the feature was not requested by the client.
57637 </para>
57638 </section>
57639 <section id="SECTQUITACL">
57640 <title>The QUIT ACL</title>
57641 <para>
57642 <indexterm role="concept">
57643 <primary>QUIT, ACL for</primary>
57644 </indexterm>
57645 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
57646 does not affect the response code to QUIT, which is always 221. Thus, the ACL
57647 does not in fact control any access.
57648 For this reason, it may only accept
57649 or warn as its final result.
57650 </para>
57651 <para>
57652 This ACL can be used for tasks such as custom logging at the end of an SMTP
57653 session. For example, you can use ACL variables in other ACLs to count
57654 messages, recipients, etc., and log the totals at QUIT time using one or
57655 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
57656 </para>
57657 <para>
57658 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
57659 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
57660 </para>
57661 <para>
57662 You do not need to have a final <option>accept</option>, but if you do, you can use a
57663 <option>message</option> modifier to specify custom text that is sent as part of the 221
57664 response to QUIT.
57665 </para>
57666 <para>
57667 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
57668 failure (for example, failure to open a log file, or when Exim is bombing out
57669 because it has detected an unrecoverable error), all SMTP commands from the
57670 client are given temporary error responses until QUIT is received or the
57671 connection is closed. In these special cases, the QUIT ACL does not run.
57672 </para>
57673 </section>
57674 <section id="SECTNOTQUITACL">
57675 <title>The not-QUIT ACL</title>
57676 <para>
57677 <indexterm role="variable">
57678 <primary><varname>$acl_smtp_notquit</varname></primary>
57679 </indexterm>
57680 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
57681 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
57682 trouble, such as being unable to write to its log files, this ACL is not run,
57683 because it might try to do things (such as write to log files) that make the
57684 situation even worse.
57685 </para>
57686 <para>
57687 Like the QUIT ACL, this ACL is provided to make it possible to do customized
57688 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
57689 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
57690 and <option>warn</option>.
57691 </para>
57692 <para>
57693 <indexterm role="variable">
57694 <primary><varname>$smtp_notquit_reason</varname></primary>
57695 </indexterm>
57696 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
57697 to a string that indicates the reason for the termination of the SMTP
57698 connection. The possible values are:
57699 </para>
57700 <informaltable frame="none">
57701 <tgroup cols="2" colsep="0" rowsep="0">
57702 <colspec colwidth="196pt" align="left"/>
57703 <colspec colwidth="254pt" align="left"/>
57704 <tbody>
57705 <row>
57706 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
57707 <entry>Another ACL issued a <option>drop</option> command</entry>
57708 </row>
57709 <row>
57710 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
57711 <entry>Too many unknown or non-mail commands</entry>
57712 </row>
57713 <row>
57714 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
57715 <entry>Timeout while reading SMTP commands</entry>
57716 </row>
57717 <row>
57718 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
57719 <entry>The SMTP connection has been lost</entry>
57720 </row>
57721 <row>
57722 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
57723 <entry>Timeout while reading message data</entry>
57724 </row>
57725 <row>
57726 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
57727 <entry>The <function>local_scan()</function> function crashed</entry>
57728 </row>
57729 <row>
57730 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
57731 <entry>The <function>local_scan()</function> function timed out</entry>
57732 </row>
57733 <row>
57734 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
57735 <entry>SIGTERM or SIGINT</entry>
57736 </row>
57737 <row>
57738 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
57739 <entry>SMTP synchronization error</entry>
57740 </row>
57741 <row>
57742 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
57743 <entry>TLS failed to start</entry>
57744 </row>
57745 </tbody>
57746 </tgroup>
57747 </informaltable>
57748 <para>
57749 In most cases when an SMTP connection is closed without having received QUIT,
57750 Exim sends an SMTP response message before actually closing the connection.
57751 With the exception of the <literal>acl-drop</literal> case, the default message can be
57752 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
57753 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
57754 used.
57755 </para>
57756 </section>
57757 <section id="SECID195">
57758 <title>Finding an ACL to use</title>
57759 <para>
57760 <indexterm role="concept">
57761 <primary>access control lists (ACLs)</primary>
57762 <secondary>finding which to use</secondary>
57763 </indexterm>
57764 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
57765 you can use different ACLs in different circumstances. For example,
57766 </para>
57767 <literallayout class="monospaced">
57768 acl_smtp_rcpt = ${if ={25}{$interface_port} \
57769                      {acl_check_rcpt} {acl_check_rcpt_submit} }
57770 </literallayout>
57771 <para>
57772 In the default configuration file there are some example settings for
57773 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
57774 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
57775 expansion like this to choose an ACL for MUAs on these ports which is
57776 more appropriate for this purpose than the default ACL on port 25.
57777 </para>
57778 <para>
57779 The expanded string does not have to be the name of an ACL in the
57780 configuration file; there are other possibilities. Having expanded the
57781 string, Exim searches for an ACL as follows:
57782 </para>
57783 <itemizedlist>
57784 <listitem>
57785 <para>
57786 If the string begins with a slash, Exim uses it as a filename, and reads its
57787 contents as an ACL. The lines are processed in the same way as lines in the
57788 Exim configuration file. In particular, continuation lines are supported, blank
57789 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
57790 If the file does not exist or cannot be read, an error occurs (typically
57791 causing a temporary failure of whatever caused the ACL to be run). For example:
57792 </para>
57793 <literallayout class="monospaced">
57794 acl_smtp_data = /etc/acls/\
57795   ${lookup{$sender_host_address}lsearch\
57796   {/etc/acllist}{$value}{default}}
57797 </literallayout>
57798 <para>
57799 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
57800 back to a default if the lookup fails. If an ACL is successfully read from a
57801 file, it is retained in memory for the duration of the Exim process, so that it
57802 can be re-used without having to re-read the file.
57803 </para>
57804 </listitem>
57805 <listitem>
57806 <para>
57807 If the string does not start with a slash, and does not contain any spaces,
57808 Exim searches the ACL section of the configuration for an ACL whose name
57809 matches the string.
57810 </para>
57811 </listitem>
57812 <listitem>
57813 <para>
57814 If no named ACL is found, or if the string contains spaces, Exim parses
57815 the string as an inline ACL. This can save typing in cases where you just
57816 want to have something like
57817 </para>
57818 <literallayout class="monospaced">
57819 acl_smtp_vrfy = accept
57820 </literallayout>
57821 <para>
57822 in order to allow free use of the VRFY command. Such a string may contain
57823 newlines; it is processed in the same way as an ACL that is read from a file.
57824 </para>
57825 </listitem>
57826 </itemizedlist>
57827 </section>
57828 <section id="SECID196">
57829 <title>ACL return codes</title>
57830 <para>
57831 <indexterm role="concept">
57832 <primary>access control lists (ACLs)</primary>
57833 <secondary>return codes</secondary>
57834 </indexterm>
57835 Except for the QUIT ACL, which does not affect the SMTP return code (see
57836 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
57837 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
57838 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
57839 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
57840 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
57841 This also causes a 4<emphasis>xx</emphasis> return code.
57842 </para>
57843 <para>
57844 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
57845 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
57846 submitters of non-SMTP messages.
57847 </para>
57848 <para>
57849 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
57850 has the effect of <quote>accept</quote>, but causes either the entire message or an
57851 individual recipient address to be discarded. In other words, it is a
57852 blackholing facility. Use it with care.
57853 </para>
57854 <para>
57855 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
57856 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
57857 RCPT ACL is to discard just the one recipient address. If there are no
57858 recipients left when the message&#x2019;s data is received, the DATA ACL is not
57859 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
57860 remaining recipients. The <quote>discard</quote> return is not permitted for the
57861 <option>acl_smtp_predata</option> ACL.
57862 </para>
57863 <para>
57864 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
57865 is done on the address and the result determines the SMTP response.
57866 </para>
57867 <para>
57868 <indexterm role="concept">
57869 <primary><function>local_scan()</function> function</primary>
57870 <secondary>when all recipients discarded</secondary>
57871 </indexterm>
57872 The <function>local_scan()</function> function is always run, even if there are no remaining
57873 recipients; it may create new recipients.
57874 </para>
57875 </section>
57876 <section id="SECID197">
57877 <title>Unset ACL options</title>
57878 <para>
57879 <indexterm role="concept">
57880 <primary>access control lists (ACLs)</primary>
57881 <secondary>unset options</secondary>
57882 </indexterm>
57883 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
57884 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
57885 not defined at all. For any defined ACL, the default action when control
57886 reaches the end of the ACL statements is <quote>deny</quote>.
57887 </para>
57888 <para>
57889 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
57890 these two are ACLs that are used only for their side effects. They cannot be
57891 used to accept or reject anything.
57892 </para>
57893 <para>
57894 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
57895 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
57896 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
57897 when the ACL is not defined is <quote>accept</quote>.
57898 </para>
57899 <para>
57900 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
57901 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
57902 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
57903 messages over an SMTP connection. For an example, see the ACL in the default
57904 configuration file.
57905 </para>
57906 </section>
57907 <section id="SECID198">
57908 <title>Data for message ACLs</title>
57909 <para>
57910 <indexterm role="concept">
57911 <primary>access control lists (ACLs)</primary>
57912 <secondary>data for message ACL</secondary>
57913 </indexterm>
57914 <indexterm role="variable">
57915 <primary><varname>$domain</varname></primary>
57916 </indexterm>
57917 <indexterm role="variable">
57918 <primary><varname>$local_part</varname></primary>
57919 </indexterm>
57920 <indexterm role="variable">
57921 <primary><varname>$sender_address</varname></primary>
57922 </indexterm>
57923 <indexterm role="variable">
57924 <primary><varname>$sender_host_address</varname></primary>
57925 </indexterm>
57926 <indexterm role="variable">
57927 <primary><varname>$smtp_command</varname></primary>
57928 </indexterm>
57929 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
57930 that contain information about the host and the message&#x2019;s sender (for example,
57931 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
57932 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
57933 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
57934 is available in <varname>$smtp_command</varname>.
57935 </para>
57936 <para>
57937 When an ACL for the AUTH parameter of MAIL is running, the variables that
57938 contain information about the host are set, but <varname>$sender_address</varname> is not yet
57939 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
57940 how it is used.
57941 </para>
57942 <para>
57943 <indexterm role="variable">
57944 <primary><varname>$message_size</varname></primary>
57945 </indexterm>
57946 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
57947 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
57948 that parameter is not given. The value is updated to the true message size by
57949 the time the final DATA ACL is run (after the message data has been
57950 received).
57951 </para>
57952 <para>
57953 <indexterm role="variable">
57954 <primary><varname>$rcpt_count</varname></primary>
57955 </indexterm>
57956 <indexterm role="variable">
57957 <primary><varname>$recipients_count</varname></primary>
57958 </indexterm>
57959 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
57960 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
57961 accepted, so while an ACL for RCPT is being processed, it contains the number
57962 of previously accepted recipients. At DATA time (for both the DATA ACLs),
57963 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
57964 <varname>$recipients_count</varname> contains the total number of accepted recipients.
57965 </para>
57966 </section>
57967 <section id="SECTdatfornon">
57968 <title>Data for non-message ACLs</title>
57969 <para>
57970 <indexterm role="concept">
57971 <primary>access control lists (ACLs)</primary>
57972 <secondary>data for non-message ACL</secondary>
57973 </indexterm>
57974 <indexterm role="variable">
57975 <primary><varname>$smtp_command_argument</varname></primary>
57976 </indexterm>
57977 <indexterm role="variable">
57978 <primary><varname>$smtp_command</varname></primary>
57979 </indexterm>
57980 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
57981 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
57982 and the entire SMTP command is available in <varname>$smtp_command</varname>.
57983 These variables can be tested using a <option>condition</option> condition. For example,
57984 here is an ACL for use with AUTH, which insists that either the session is
57985 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
57986 does not permit authentication methods that use cleartext passwords on
57987 unencrypted connections.
57988 </para>
57989 <literallayout class="monospaced">
57990 acl_check_auth:
57991   accept encrypted = *
57992   accept condition = ${if eq{${uc:$smtp_command_argument}}\
57993                      {CRAM-MD5}}
57994   deny   message   = TLS encryption or CRAM-MD5 required
57995 </literallayout>
57996 <para>
57997 (Another way of applying this restriction is to arrange for the authenticators
57998 that use cleartext passwords not to be advertised when the connection is not
57999 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
58000 option to do this.)
58001 </para>
58002 </section>
58003 <section id="SECID199">
58004 <title>Format of an ACL</title>
58005 <para>
58006 <indexterm role="concept">
58007 <primary>access control lists (ACLs)</primary>
58008 <secondary>format of</secondary>
58009 </indexterm>
58010 <indexterm role="concept">
58011 <primary>access control lists (ACLs)</primary>
58012 <secondary>verbs, definition of</secondary>
58013 </indexterm>
58014 An individual ACL consists of a number of statements. Each statement starts
58015 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
58016 Modifiers can change the way the verb operates, define error and log messages,
58017 set variables, insert delays, and vary the processing of accepted messages.
58018 </para>
58019 <para>
58020 If all the conditions are met, the verb is obeyed. The same condition may be
58021 used (with different arguments) more than once in the same statement. This
58022 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
58023 example:
58024 </para>
58025 <literallayout class="monospaced">
58026 deny  dnslists = list1.example
58027       dnslists = list2.example
58028 </literallayout>
58029 <para>
58030 If there are no conditions, the verb is always obeyed. Exim stops evaluating
58031 the conditions and modifiers when it reaches a condition that fails. What
58032 happens then depends on the verb (and in one case, on a special modifier). Not
58033 all the conditions make sense at every testing point. For example, you cannot
58034 test a sender address in the ACL that is run for a VRFY command.
58035 </para>
58036 </section>
58037 <section id="SECID200">
58038 <title>ACL verbs</title>
58039 <para>
58040 The ACL verbs are as follows:
58041 </para>
58042 <itemizedlist>
58043 <listitem>
58044 <para>
58045 <indexterm role="concept">
58046 <primary><option>accept</option> ACL verb</primary>
58047 </indexterm>
58048 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
58049 of the conditions are not met, what happens depends on whether <option>endpass</option>
58050 appears among the conditions (for syntax see below). If the failing condition
58051 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
58052 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
58053 check a RCPT command:
58054 </para>
58055 <literallayout class="monospaced">
58056 accept domains = +local_domains
58057        endpass
58058        verify = recipient
58059 </literallayout>
58060 <para>
58061 If the recipient domain does not match the <option>domains</option> condition, control
58062 passes to the next statement. If it does match, the recipient is verified, and
58063 the command is accepted if verification succeeds. However, if verification
58064 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
58065 <option>endpass</option>.
58066 </para>
58067 <para>
58068 The <option>endpass</option> feature has turned out to be confusing to many people, so its
58069 use is not recommended nowadays. It is always possible to rewrite an ACL so
58070 that <option>endpass</option> is not needed, and it is no longer used in the default
58071 configuration.
58072 </para>
58073 <para>
58074 <indexterm role="concept">
58075 <primary><option>message</option> ACL modifier</primary>
58076 <secondary>with <option>accept</option></secondary>
58077 </indexterm>
58078 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
58079 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
58080 (when an <option>accept</option> verb either accepts or passes control to the next
58081 statement), <option>message</option> can be used to vary the message that is sent when an
58082 SMTP command is accepted. For example, in a RCPT ACL you could have:
58083 </para>
58084 <literallayout>
58085 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58086 <literal>        message = OK, I will allow you through today</literal>
58087 </literallayout>
58088 <para>
58089 You can specify an SMTP response code, optionally followed by an <quote>extended
58090 response code</quote> at the start of the message, but the first digit must be the
58091 same as would be sent by default, which is 2 for an <option>accept</option> verb.
58092 </para>
58093 <para>
58094 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
58095 an error message that is used when access is denied. This behaviour is retained
58096 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
58097 of <option>endpass</option>.
58098 </para>
58099 </listitem>
58100 <listitem>
58101 <para>
58102 <indexterm role="concept">
58103 <primary><option>defer</option> ACL verb</primary>
58104 </indexterm>
58105 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
58106 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
58107 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
58108 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
58109 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
58110 be used in any ACL, and even for a recipient it might be a simpler approach.
58111 </para>
58112 </listitem>
58113 <listitem>
58114 <para>
58115 <indexterm role="concept">
58116 <primary><option>deny</option> ACL verb</primary>
58117 </indexterm>
58118 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
58119 the conditions are not met, control is passed to the next ACL statement. For
58120 example,
58121 </para>
58122 <literallayout class="monospaced">
58123 deny dnslists = blackholes.mail-abuse.org
58124 </literallayout>
58125 <para>
58126 rejects commands from hosts that are on a DNS black list.
58127 </para>
58128 </listitem>
58129 <listitem>
58130 <para>
58131 <indexterm role="concept">
58132 <primary><option>discard</option> ACL verb</primary>
58133 </indexterm>
58134 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
58135 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
58136 that are concerned with receiving messages. When all the conditions are true,
58137 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
58138 recipients to be discarded. If it is used in an ACL for RCPT, just the one
58139 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
58140 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
58141 do not appear in the log line when the <option>received_recipients</option> log selector is set.
58142 </para>
58143 <para>
58144 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
58145 its contents are added to the line that is automatically written to the log.
58146 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
58147 </para>
58148 </listitem>
58149 <listitem>
58150 <para>
58151 <indexterm role="concept">
58152 <primary><option>drop</option> ACL verb</primary>
58153 </indexterm>
58154 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
58155 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
58156 </para>
58157 <literallayout class="monospaced">
58158 drop   condition = ${if &gt; {$rcpt_count}{20}}
58159        message   = I don't take more than 20 RCPTs
58160 </literallayout>
58161 <para>
58162 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
58163 The connection is always dropped after sending a 550 response.
58164 </para>
58165 </listitem>
58166 <listitem>
58167 <para>
58168 <indexterm role="concept">
58169 <primary><option>require</option> ACL verb</primary>
58170 </indexterm>
58171 <option>require</option>: If all the conditions are met, control is passed to the next ACL
58172 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
58173 example, when checking a RCPT command,
58174 </para>
58175 <literallayout class="monospaced">
58176 require message = Sender did not verify
58177         verify  = sender
58178 </literallayout>
58179 <para>
58180 passes control to subsequent statements only if the message&#x2019;s sender can be
58181 verified. Otherwise, it rejects the command. Note the positioning of the
58182 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
58183 discussed in section <xref linkend="SECTcondmodproc"/>.
58184 </para>
58185 </listitem>
58186 <listitem>
58187 <para>
58188 <indexterm role="concept">
58189 <primary><option>warn</option> ACL verb</primary>
58190 </indexterm>
58191 <option>warn</option>: If all the conditions are true, a line specified by the
58192 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
58193 to the next ACL statement. If any condition is false, the log line is not
58194 written. If an identical log line is requested several times in the same
58195 message, only one copy is actually written to the log. If you want to force
58196 duplicates to be written, use the <option>logwrite</option> modifier instead.
58197 </para>
58198 <para>
58199 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
58200 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
58201 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
58202 first failing condition. There is more about adding header lines in section
58203 <xref linkend="SECTaddheadacl"/>.
58204 </para>
58205 <para>
58206 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
58207 some sort of defer), the log line specified by <option>log_message</option> is not written.
58208 This does not include the case of a forced failure from a lookup, which
58209 is considered to be a successful completion. After a defer, no further
58210 conditions or modifiers in the <option>warn</option> statement are processed. The incident
58211 is logged, and the ACL continues to be processed, from the next statement
58212 onwards.
58213 </para>
58214 <para>
58215 <indexterm role="variable">
58216 <primary><varname>$acl_verify_message</varname></primary>
58217 </indexterm>
58218 When one of the <option>warn</option> conditions is an address verification that fails, the
58219 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
58220 want this logged, you must set it up explicitly. For example:
58221 </para>
58222 <literallayout class="monospaced">
58223 warn   !verify = sender
58224        log_message = sender verify failed: $acl_verify_message
58225 </literallayout>
58226 </listitem>
58227 </itemizedlist>
58228 <para>
58229 At the end of each ACL there is an implicit unconditional <option>deny</option>.
58230 </para>
58231 <para>
58232 As you can see from the examples above, the conditions and modifiers are
58233 written one to a line, with the first one on the same line as the verb, and
58234 subsequent ones on following lines. If you have a very long condition, you can
58235 continue it onto several physical lines by the usual backslash continuation
58236 mechanism. It is conventional to align the conditions vertically.
58237 </para>
58238 </section>
58239 <section id="SECTaclvariables">
58240 <title>ACL variables</title>
58241 <para>
58242 <indexterm role="concept">
58243 <primary>access control lists (ACLs)</primary>
58244 <secondary>variables</secondary>
58245 </indexterm>
58246 There are some special variables that can be set during ACL processing. They
58247 can be used to pass information between different ACLs, different invocations
58248 of the same ACL in the same SMTP connection, and between ACLs and the routers,
58249 transports, and filters that are used to deliver a message. The names of these
58250 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
58251 an underscore, but the remainder of the name can be any sequence of
58252 alphanumeric characters and underscores that you choose. There is no limit on
58253 the number of ACL variables. The two sets act as follows:
58254 </para>
58255 <itemizedlist>
58256 <listitem>
58257 <para>
58258 The values of those variables whose names begin with <varname>$acl_c</varname> persist
58259 throughout an SMTP connection. They are never reset. Thus, a value that is set
58260 while receiving one message is still available when receiving the next message
58261 on the same SMTP connection.
58262 </para>
58263 </listitem>
58264 <listitem>
58265 <para>
58266 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
58267 while a message is being received. They are reset afterwards. They are also
58268 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
58269 </para>
58270 </listitem>
58271 </itemizedlist>
58272 <para>
58273 When a message is accepted, the current values of all the ACL variables are
58274 preserved with the message and are subsequently made available at delivery
58275 time. The ACL variables are set by a modifier called <option>set</option>. For example:
58276 </para>
58277 <literallayout class="monospaced">
58278 accept hosts = whatever
58279        set acl_m4 = some value
58280 accept authenticated = *
58281        set acl_c_auth = yes
58282 </literallayout>
58283 <para>
58284 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
58285 be set. If you want to set a variable without taking any action, you can use a
58286 <option>warn</option> verb without any other modifiers or conditions.
58287 </para>
58288 <para>
58289 <indexterm role="option">
58290 <primary><option>strict_acl_vars</option></primary>
58291 </indexterm>
58292 What happens if a syntactically valid but undefined ACL variable is
58293 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
58294 false (the default), an empty string is substituted; if it is true, an
58295 error is generated.
58296 </para>
58297 <para>
58298 Versions of Exim before 4.64 have a limited set of numbered variables, but
58299 their names are compatible, so there is no problem with upgrading.
58300 </para>
58301 </section>
58302 <section id="SECTcondmodproc">
58303 <title>Condition and modifier processing</title>
58304 <para>
58305 <indexterm role="concept">
58306 <primary>access control lists (ACLs)</primary>
58307 <secondary>conditions; processing</secondary>
58308 </indexterm>
58309 <indexterm role="concept">
58310 <primary>access control lists (ACLs)</primary>
58311 <secondary>modifiers; processing</secondary>
58312 </indexterm>
58313 An exclamation mark preceding a condition negates its result. For example:
58314 </para>
58315 <literallayout class="monospaced">
58316 deny   domains = *.dom.example
58317       !verify  = recipient
58318 </literallayout>
58319 <para>
58320 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
58321 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
58322 negation can be used on the right-hand side of a condition. For example, these
58323 two statements are equivalent:
58324 </para>
58325 <literallayout class="monospaced">
58326 deny  hosts = !192.168.3.4
58327 deny !hosts =  192.168.3.4
58328 </literallayout>
58329 <para>
58330 However, for many conditions (<option>verify</option> being a good example), only left-hand
58331 side negation of the whole condition is possible.
58332 </para>
58333 <para>
58334 The arguments of conditions and modifiers are expanded. A forced failure
58335 of an expansion causes a condition to be ignored, that is, it behaves as if the
58336 condition is true. Consider these two statements:
58337 </para>
58338 <literallayout class="monospaced">
58339 accept  senders = ${lookup{$host_name}lsearch\
58340                   {/some/file}{$value}fail}
58341 accept  senders = ${lookup{$host_name}lsearch\
58342                   {/some/file}{$value}{}}
58343 </literallayout>
58344 <para>
58345 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
58346 the returned list is searched, but if the lookup fails the behaviour is
58347 different in the two cases. The <option>fail</option> in the first statement causes the
58348 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
58349 therefore succeeds. The second statement, however, generates an empty list when
58350 the lookup fails. No sender can match an empty list, so the condition fails,
58351 and therefore the <option>accept</option> also fails.
58352 </para>
58353 <para>
58354 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
58355 specify actions that are taken as the conditions for a statement are checked;
58356 others specify text for messages that are used when access is denied or a
58357 warning is generated. The <option>control</option> modifier affects the way an incoming
58358 message is handled.
58359 </para>
58360 <para>
58361 The positioning of the modifiers in an ACL statement is important, because the
58362 processing of a verb ceases as soon as its outcome is known. Only those
58363 modifiers that have already been encountered will take effect. For example,
58364 consider this use of the <option>message</option> modifier:
58365 </para>
58366 <literallayout class="monospaced">
58367 require message = Can't verify sender
58368         verify  = sender
58369         message = Can't verify recipient
58370         verify  = recipient
58371         message = This message cannot be used
58372 </literallayout>
58373 <para>
58374 If sender verification fails, Exim knows that the result of the statement is
58375 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
58376 so its text is used as the error message. If sender verification succeeds, but
58377 recipient verification fails, the second message is used. If recipient
58378 verification succeeds, the third message becomes <quote>current</quote>, but is never used
58379 because there are no more conditions to cause failure.
58380 </para>
58381 <para>
58382 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
58383 modifier that is used, because all the conditions must be true for rejection to
58384 happen. Specifying more than one <option>message</option> modifier does not make sense, and
58385 the message can even be specified after all the conditions. For example:
58386 </para>
58387 <literallayout class="monospaced">
58388 deny   hosts = ...
58389       !senders = *@my.domain.example
58390        message = Invalid sender from client host
58391 </literallayout>
58392 <para>
58393 The <quote>deny</quote> result does not happen until the end of the statement is reached,
58394 by which time Exim has set up the message.
58395 </para>
58396 </section>
58397 <section id="SECTACLmodi">
58398 <title>ACL modifiers</title>
58399 <para>
58400 <indexterm role="concept">
58401 <primary>access control lists (ACLs)</primary>
58402 <secondary>modifiers; list of</secondary>
58403 </indexterm>
58404 The ACL modifiers are as follows:
58405 </para>
58406 <variablelist>
58407 <varlistentry>
58408 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58409 <listitem>
58410 <para>
58411 This modifier specifies one or more header lines that are to be added to an
58412 incoming message, assuming, of course, that the message is ultimately
58413 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
58414 </para>
58415 </listitem></varlistentry>
58416 <varlistentry>
58417 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58418 <listitem>
58419 <para>
58420 <indexterm role="concept">
58421 <primary><option>continue</option> ACL modifier</primary>
58422 </indexterm>
58423 <indexterm role="concept">
58424 <primary>database</primary>
58425 <secondary>updating in ACL</secondary>
58426 </indexterm>
58427 This modifier does nothing of itself, and processing of the ACL always
58428 continues with the next condition or modifier. The value of <option>continue</option> is in
58429 the side effects of expanding its argument. Typically this could be used to
58430 update a database. It is really just a syntactic tidiness, to avoid having to
58431 write rather ugly lines like this:
58432 </para>
58433 <literallayout>
58434 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
58435 </literallayout>
58436 <para>
58437 Instead, all you need is
58438 </para>
58439 <literallayout>
58440 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
58441 </literallayout>
58442 </listitem></varlistentry>
58443 <varlistentry>
58444 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58445 <listitem>
58446 <para>
58447 <indexterm role="concept">
58448 <primary><option>control</option> ACL modifier</primary>
58449 </indexterm>
58450 This modifier affects the subsequent processing of the SMTP connection or of an
58451 incoming message that is accepted. The effect of the first type of control
58452 lasts for the duration of the connection, whereas the effect of the second type
58453 lasts only until the current message has been received. The message-specific
58454 controls always apply to the whole message, not to individual recipients,
58455 even if the <option>control</option> modifier appears in a RCPT ACL.
58456 </para>
58457 <para>
58458 As there are now quite a few controls that can be applied, they are described
58459 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
58460 in several different ways. For example:
58461 </para>
58462 <itemizedlist>
58463 <listitem>
58464 <para>
58465 It can be at the end of an <option>accept</option> statement:
58466 </para>
58467 <literallayout class="monospaced">
58468     accept  ...some conditions
58469             control = queue
58470 </literallayout>
58471 <para>
58472 In this case, the control is applied when this statement yields <quote>accept</quote>, in
58473 other words, when the conditions are all true.
58474 </para>
58475 </listitem>
58476 <listitem>
58477 <para>
58478 It can be in the middle of an <option>accept</option> statement:
58479 </para>
58480 <literallayout class="monospaced">
58481     accept  ...some conditions...
58482             control = queue
58483             ...some more conditions...
58484 </literallayout>
58485 <para>
58486 If the first set of conditions are true, the control is applied, even if the
58487 statement does not accept because one of the second set of conditions is false.
58488 In this case, some subsequent statement must yield <quote>accept</quote> for the control
58489 to be relevant.
58490 </para>
58491 </listitem>
58492 <listitem>
58493 <para>
58494 It can be used with <option>warn</option> to apply the control, leaving the
58495 decision about accepting or denying to a subsequent verb. For
58496 example:
58497 </para>
58498 <literallayout class="monospaced">
58499     warn    ...some conditions...
58500             control = freeze
58501     accept  ...
58502 </literallayout>
58503 <para>
58504 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
58505 <option>logwrite</option>, so it does not add anything to the message and does not write a
58506 log entry.
58507 </para>
58508 </listitem>
58509 <listitem>
58510 <para>
58511 If you want to apply a control unconditionally, you can use it with a
58512 <option>require</option> verb. For example:
58513 </para>
58514 <literallayout class="monospaced">
58515     require  control = no_multiline_responses
58516 </literallayout>
58517 </listitem>
58518 </itemizedlist>
58519 </listitem></varlistentry>
58520 <varlistentry>
58521 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
58522 <listitem>
58523 <para>
58524 <indexterm role="concept">
58525 <primary><option>delay</option> ACL modifier</primary>
58526 </indexterm>
58527 <indexterm role="option">
58528 <primary><option>-bh</option></primary>
58529 </indexterm>
58530 This modifier may appear in any ACL except notquit. It causes Exim to wait for
58531 the time interval before proceeding. However, when testing Exim using the
58532 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
58533 output instead). The time is given in the usual Exim notation, and the delay
58534 happens as soon as the modifier is processed. In an SMTP session, pending
58535 output is flushed before the delay is imposed.
58536 </para>
58537 <para>
58538 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
58539 example:
58540 </para>
58541 <literallayout class="monospaced">
58542 deny    ...some conditions...
58543         delay = 30s
58544 </literallayout>
58545 <para>
58546 The delay happens if all the conditions are true, before the statement returns
58547 <quote>deny</quote>. Compare this with:
58548 </para>
58549 <literallayout class="monospaced">
58550 deny    delay = 30s
58551         ...some conditions...
58552 </literallayout>
58553 <para>
58554 which waits for 30s before processing the conditions. The <option>delay</option> modifier
58555 can also be used with <option>warn</option> and together with <option>control</option>:
58556 </para>
58557 <literallayout class="monospaced">
58558 warn    ...some conditions...
58559         delay = 2m
58560         control = freeze
58561 accept  ...
58562 </literallayout>
58563 <para>
58564 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
58565 responses to several commands are no longer buffered and sent in one packet (as
58566 they would normally be) because all output is flushed before imposing the
58567 delay. This optimization is disabled so that a number of small delays do not
58568 appear to the client as one large aggregated delay that might provoke an
58569 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
58570 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
58571 </para>
58572 </listitem></varlistentry>
58573 <varlistentry>
58574 <term><emphasis role="bold">endpass</emphasis></term>
58575 <listitem>
58576 <para>
58577 <indexterm role="concept">
58578 <primary><option>endpass</option> ACL modifier</primary>
58579 </indexterm>
58580 This modifier, which has no argument, is recognized only in <option>accept</option> and
58581 <option>discard</option> statements. It marks the boundary between the conditions whose
58582 failure causes control to pass to the next statement, and the conditions whose
58583 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
58584 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
58585 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
58586 </para>
58587 </listitem></varlistentry>
58588 <varlistentry>
58589 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58590 <listitem>
58591 <para>
58592 <indexterm role="concept">
58593 <primary><option>log_message</option> ACL modifier</primary>
58594 </indexterm>
58595 This modifier sets up a message that is used as part of the log message if the
58596 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
58597 </para>
58598 <literallayout class="monospaced">
58599 require log_message = wrong cipher suite $tls_in_cipher
58600         encrypted   = DES-CBC3-SHA
58601 </literallayout>
58602 <para>
58603 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
58604 example:
58605 </para>
58606 <literallayout>
58607 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58608 <literal>        log_message = Discarded $local_part@$domain because...</literal>
58609 </literallayout>
58610 <para>
58611 When access is denied, <option>log_message</option> adds to any underlying error message
58612 that may exist because of a condition failure. For example, while verifying a
58613 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
58614 message.
58615 </para>
58616 <para>
58617 The message may be defined before the conditions to which it applies, because
58618 the string expansion does not happen until Exim decides that access is to be
58619 denied. This means that any variables that are set by the condition are
58620 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
58621 variables are set after a DNS black list lookup succeeds. If the expansion of
58622 <option>log_message</option> fails, or if the result is an empty string, the modifier is
58623 ignored.
58624 </para>
58625 <para>
58626 <indexterm role="variable">
58627 <primary><varname>$acl_verify_message</varname></primary>
58628 </indexterm>
58629 If you want to use a <option>warn</option> statement to log the result of an address
58630 verification, you can use <varname>$acl_verify_message</varname> to include the verification
58631 error message.
58632 </para>
58633 <para>
58634 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
58635 the start of the logged message. If the same warning log message is requested
58636 more than once while receiving  a single email message, only one copy is
58637 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
58638 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
58639 is logged for a successful <option>warn</option> statement.
58640 </para>
58641 <para>
58642 If <option>log_message</option> is not present and there is no underlying error message (for
58643 example, from the failure of address verification), but <option>message</option> is present,
58644 the <option>message</option> text is used for logging rejections. However, if any text for
58645 logging contains newlines, only the first line is logged. In the absence of
58646 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
58647 logging rejections.
58648 </para>
58649 </listitem></varlistentry>
58650 <varlistentry>
58651 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
58652 <listitem>
58653 <para>
58654 <indexterm role="concept">
58655 <primary><option>log_reject_target</option> ACL modifier</primary>
58656 </indexterm>
58657 <indexterm role="concept">
58658 <primary>logging in ACL</primary>
58659 <secondary>specifying which log</secondary>
58660 </indexterm>
58661 This modifier makes it possible to specify which logs are used for messages
58662 about ACL rejections. Its argument is a colon-separated list of words that can
58663 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
58664 may be empty, in which case a rejection is not logged at all. For example, this
58665 ACL fragment writes no logging information when access is denied:
58666 </para>
58667 <literallayout>
58668 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58669 <literal>     log_reject_target =</literal>
58670 </literallayout>
58671 <para>
58672 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
58673 permanent and temporary rejections. Its effect lasts for the rest of the
58674 current ACL.
58675 </para>
58676 </listitem></varlistentry>
58677 <varlistentry>
58678 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58679 <listitem>
58680 <para>
58681 <indexterm role="concept">
58682 <primary><option>logwrite</option> ACL modifier</primary>
58683 </indexterm>
58684 <indexterm role="concept">
58685 <primary>logging in ACL</primary>
58686 <secondary>immediate</secondary>
58687 </indexterm>
58688 This modifier writes a message to a log file as soon as it is encountered when
58689 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
58690 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
58691 access.) The <option>logwrite</option> modifier can be used to log special incidents in
58692 ACLs. For example:
58693 </para>
58694 <literallayout>
58695 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
58696 <literal>       control  = freeze</literal>
58697 <literal>       logwrite = froze message because ...</literal>
58698 </literallayout>
58699 <para>
58700 By default, the message is written to the main log. However, it may begin
58701 with a colon, followed by a comma-separated list of log names, and then
58702 another colon, to specify exactly which logs are to be written. For
58703 example:
58704 </para>
58705 <literallayout class="monospaced">
58706 logwrite = :main,reject: text for main and reject logs
58707 logwrite = :panic: text for panic log only
58708 </literallayout>
58709 </listitem></varlistentry>
58710 <varlistentry>
58711 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58712 <listitem>
58713 <para>
58714 <indexterm role="concept">
58715 <primary><option>message</option> ACL modifier</primary>
58716 </indexterm>
58717 This modifier sets up a text string that is expanded and used as a response
58718 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
58719 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
58720 there is some complication if <option>endpass</option> is involved; see the description of
58721 <option>accept</option> for details.)
58722 </para>
58723 <para>
58724 The expansion of the message happens at the time Exim decides that the ACL is
58725 to end, not at the time it processes <option>message</option>. If the expansion fails, or
58726 generates an empty string, the modifier is ignored. Here is an example where
58727 <option>message</option> must be specified first, because the ACL ends with a rejection if
58728 the <option>hosts</option> condition fails:
58729 </para>
58730 <literallayout class="monospaced">
58731 require  message = Host not recognized
58732          hosts = 10.0.0.0/8
58733 </literallayout>
58734 <para>
58735 (Once a condition has failed, no further conditions or modifiers are
58736 processed.)
58737 </para>
58738 <para>
58739 <indexterm role="concept">
58740 <primary>SMTP</primary>
58741 <secondary>error codes</secondary>
58742 </indexterm>
58743 <indexterm role="option">
58744 <primary><option>smtp_banner</option></primary>
58745 </indexterm>
58746 For ACLs that are triggered by SMTP commands, the message is returned as part
58747 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
58748 is meaningful only for SMTP, as no message is returned when a non-SMTP message
58749 is accepted. In the case of the connect ACL, accepting with a message modifier
58750 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
58751 accept message may not contain more than one line (otherwise it will be
58752 truncated at the first newline and a panic logged), and it cannot affect the
58753 EHLO options.
58754 </para>
58755 <para>
58756 When SMTP is involved, the message may begin with an overriding response code,
58757 consisting of three digits optionally followed by an <quote>extended response code</quote>
58758 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
58759 </para>
58760 <literallayout class="monospaced">
58761 deny  message = 599 1.2.3 Host not welcome
58762       hosts = 192.168.34.0/24
58763 </literallayout>
58764 <para>
58765 The first digit of the supplied response code must be the same as would be sent
58766 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
58767 access, but for the predata ACL, note that the default success code is 354, not
58768 2<emphasis>xx</emphasis>.
58769 </para>
58770 <para>
58771 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
58772 the message modifier cannot override the 221 response code.
58773 </para>
58774 <para>
58775 The text in a <option>message</option> modifier is literal; any quotes are taken as
58776 literals, but because the string is expanded, backslash escapes are processed
58777 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
58778 response.
58779 </para>
58780 <para>
58781 <indexterm role="variable">
58782 <primary><varname>$acl_verify_message</varname></primary>
58783 </indexterm>
58784 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
58785 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
58786 </para>
58787 <para>
58788 If <option>message</option> is used on a statement that verifies an address, the message
58789 specified overrides any message that is generated by the verification process.
58790 However, the original message is available in the variable
58791 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
58792 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
58793 routers to be passed back as part of the SMTP response, you should either not
58794 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
58795 </para>
58796 <para>
58797 For compatibility with previous releases of Exim, a <option>message</option> modifier that
58798 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
58799 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
58800 all the conditions are true, wherever it appears in an ACL command, whereas
58801 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
58802 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
58803 effect.
58804 </para>
58805 </listitem></varlistentry>
58806 <varlistentry>
58807 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58808 <listitem>
58809 <para>
58810 <indexterm role="concept">
58811 <primary><option>queue</option> ACL modifier</primary>
58812 </indexterm>
58813 <indexterm role="concept">
58814 <primary>named queues</primary>
58815 <secondary>selecting in ACL</secondary>
58816 </indexterm>
58817 This modifier specifies the use of a named queue for spool files
58818 for the message.
58819 It can only be used before the message is received (i.e. not in
58820 the DATA ACL).
58821 This could be used, for example, for known high-volume burst sources
58822 of traffic, or for quarantine of messages.
58823 Separate queue-runner processes will be needed for named queues.
58824 If the text after expansion is empty, the default queue is used.
58825 </para>
58826 </listitem></varlistentry>
58827 <varlistentry>
58828 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58829 <listitem>
58830 <para>
58831 This modifier specifies one or more header names in a colon-separated list
58832  that are to be removed from an incoming message, assuming, of course, that
58833 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
58834 </para>
58835 </listitem></varlistentry>
58836 <varlistentry>
58837 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
58838 <listitem>
58839 <para>
58840 <indexterm role="concept">
58841 <primary><option>set</option> ACL modifier</primary>
58842 </indexterm>
58843 This modifier puts a value into one of the ACL variables (see section
58844 <xref linkend="SECTaclvariables"/>).
58845 </para>
58846 </listitem></varlistentry>
58847 <varlistentry>
58848 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
58849 <listitem>
58850 <para>
58851 <indexterm role="concept">
58852 <primary>UDP communications</primary>
58853 </indexterm>
58854 This modifier sends a UDP packet, for purposes such as statistics
58855 collection or behaviour monitoring. The parameters are expanded, and
58856 the result of the expansion must be a colon-separated list consisting
58857 of a destination server, port number, and the packet contents. The
58858 server can be specified as a host name or IPv4 or IPv6 address. The
58859 separator can be changed with the usual angle bracket syntax. For
58860 example, you might want to collect information on which hosts connect
58861 when:
58862 </para>
58863 <literallayout class="monospaced">
58864 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
58865              $tod_zulu $sender_host_address
58866 </literallayout>
58867 </listitem></varlistentry>
58868 </variablelist>
58869 </section>
58870 <section id="SECTcontrols">
58871 <title>Use of the control modifier</title>
58872 <para>
58873 <indexterm role="concept">
58874 <primary><option>control</option> ACL modifier</primary>
58875 </indexterm>
58876 The <option>control</option> modifier supports the following settings:
58877 </para>
58878 <variablelist>
58879 <varlistentry>
58880 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
58881 <listitem>
58882 <para>
58883 This modifier allows a client host to use the SMTP AUTH command even when it
58884 has not been advertised in response to EHLO. Furthermore, because there are
58885 apparently some really broken clients that do this, Exim will accept AUTH after
58886 HELO (rather than EHLO) when this control is set. It should be used only if you
58887 really need it, and you should limit its use to those broken clients that do
58888 not work without it. For example:
58889 </para>
58890 <literallayout class="monospaced">
58891 warn hosts   = 192.168.34.25
58892      control = allow_auth_unadvertised
58893 </literallayout>
58894 <para>
58895 Normally, when an Exim server receives an AUTH command, it checks the name of
58896 the authentication mechanism that is given in the command to ensure that it
58897 matches an advertised mechanism. When this control is set, the check that a
58898 mechanism has been advertised is bypassed. Any configured mechanism can be used
58899 by the client. This control is permitted only in the connection and HELO ACLs.
58900 </para>
58901 </listitem></varlistentry>
58902 <varlistentry>
58903 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
58904 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
58905 <listitem>
58906 <para>
58907 <indexterm role="concept">
58908 <primary>access control lists (ACLs)</primary>
58909 <secondary>case of local part in</secondary>
58910 </indexterm>
58911 <indexterm role="concept">
58912 <primary>case of local parts</primary>
58913 </indexterm>
58914 <indexterm role="variable">
58915 <primary><varname>$local_part</varname></primary>
58916 </indexterm>
58917 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
58918 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
58919 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
58920 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
58921 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
58922 is encountered.
58923 </para>
58924 <para>
58925 These controls affect only the current recipient. Moreover, they apply only to
58926 local part handling that takes place directly in the ACL (for example, as a key
58927 in lookups). If a test to verify the recipient is obeyed, the case-related
58928 handling of the local part during the verification is controlled by the router
58929 configuration (see the <option>caseful_local_part</option> generic router option).
58930 </para>
58931 <para>
58932 This facility could be used, for example, to add a spam score to local parts
58933 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
58934 spam score:
58935 </para>
58936 <literallayout class="monospaced">
58937 warn  control = caseful_local_part
58938       set acl_m4 = ${eval:\
58939                      $acl_m4 + \
58940                      ${if match{$local_part}{[A-Z]}{1}{0}}\
58941                     }
58942       control = caselower_local_part
58943 </literallayout>
58944 <para>
58945 Notice that we put back the lower cased version afterwards, assuming that
58946 is what is wanted for subsequent tests.
58947 </para>
58948 </listitem></varlistentry>
58949 <varlistentry>
58950 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58951 <listitem>
58952 <para>
58953 <indexterm role="concept">
58954 <primary>access control lists (ACLs)</primary>
58955 <secondary>cutthrough routing</secondary>
58956 </indexterm>
58957 <indexterm role="concept">
58958 <primary>cutthrough</primary>
58959 <secondary>requesting</secondary>
58960 </indexterm>
58961 This option requests delivery be attempted while the item is being received.
58962 </para>
58963 <para>
58964 The option is usable in the RCPT ACL.
58965 If enabled for a message received via smtp and routed to an smtp transport,
58966 and only one transport, interface, destination host and port combination
58967 is used for all recipients of the message,
58968 then the delivery connection is made while the receiving connection is open
58969 and data is copied from one to the other.
58970 </para>
58971 <para>
58972 An attempt to set this option for any recipient but the first
58973 for a mail will be quietly ignored.
58974 If a recipient-verify callout
58975 (with use_sender)
58976 connection is subsequently
58977 requested in the same ACL it is held open and used for
58978 any subsequent recipients and the data,
58979 otherwise one is made after the initial RCPT ACL completes.
58980 </para>
58981 <para>
58982 Note that routers are used in verify mode,
58983 and cannot depend on content of received headers.
58984 Note also that headers cannot be
58985 modified by any of the post-data ACLs (DATA, MIME and DKIM).
58986 Headers may be modified by routers (subject to the above) and transports.
58987 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
58988 rather than the traditional time after the full message is received;
58989 this will affect the timestamp.
58990 </para>
58991 <para>
58992 All the usual ACLs are called; if one results in the message being
58993 rejected, all effort spent in delivery (including the costs on
58994 the ultimate destination) will be wasted.
58995 Note that in the case of data-time ACLs this includes the entire
58996 message body.
58997 </para>
58998 <para>
58999 Cutthrough delivery is not supported via transport-filters or when DKIM signing
59000 of outgoing messages is done, because it sends data to the ultimate destination
59001 before the entire message has been received from the source.
59002 It is not supported for messages received with the SMTP PRDR
59003 or CHUNKING
59004 options in use.
59005 </para>
59006 <para>
59007 Should the ultimate destination system positively accept or reject the mail,
59008 a corresponding indication is given to the source system and nothing is queued.
59009 If the item is successfully delivered in cutthrough mode
59010 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
59011 before the acceptance "&lt;=" line.
59012 </para>
59013 <para>
59014 If there is a temporary error the item is queued for later delivery in the
59015 usual fashion.
59016 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
59017 to the control; the default value is <quote>spool</quote> and the alternate value
59018 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
59019 and does not queue the message.
59020 Note that this is independent of any recipient verify conditions in the ACL.
59021 </para>
59022 <para>
59023 Delivery in this mode avoids the generation of a bounce mail to a
59024 (possibly faked)
59025 sender when the destination system is doing content-scan based rejection.
59026 </para>
59027 </listitem></varlistentry>
59028 <varlistentry>
59029 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
59030 <listitem>
59031 <para>
59032 <indexterm role="concept">
59033 <primary>access control lists (ACLs)</primary>
59034 <secondary>enabling debug logging</secondary>
59035 </indexterm>
59036 <indexterm role="concept">
59037 <primary>debugging</primary>
59038 <secondary>enabling from an ACL</secondary>
59039 </indexterm>
59040 This control turns on debug logging, almost as though Exim had been invoked
59041 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
59042 by default called <emphasis>debuglog</emphasis>.
59043 The filename can be adjusted with the <emphasis>tag</emphasis> option, which
59044 may access any variables already defined.  The logging may be adjusted with
59045 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
59046 option.
59047 Logging started this way may be stopped, and the file removed,
59048 with the <emphasis>kill</emphasis> option.
59049 Some examples (which depend on variables that don&#x2019;t exist in all
59050 contexts):
59051 </para>
59052 <literallayout class="monospaced">
59053       control = debug
59054       control = debug/tag=.$sender_host_address
59055       control = debug/opts=+expand+acl
59056       control = debug/tag=.$message_exim_id/opts=+expand
59057       control = debug/kill
59058 </literallayout>
59059 </listitem></varlistentry>
59060 <varlistentry>
59061 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
59062 <listitem>
59063 <para>
59064 <indexterm role="concept">
59065 <primary>disable DKIM verify</primary>
59066 </indexterm>
59067 <indexterm role="concept">
59068 <primary>DKIM</primary>
59069 <secondary>disable verify</secondary>
59070 </indexterm>
59071 This control turns off DKIM verification processing entirely.  For details on
59072 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
59073 </para>
59074 </listitem></varlistentry>
59075 <varlistentry>
59076 <term><emphasis role="bold">control&nbsp;=&nbsp;dmarc_disable_verify</emphasis></term>
59077 <listitem>
59078 <para>
59079 <indexterm role="concept">
59080 <primary>disable DMARC verify</primary>
59081 </indexterm>
59082 <indexterm role="concept">
59083 <primary>DMARC</primary>
59084 <secondary>disable verify</secondary>
59085 </indexterm>
59086 This control turns off DMARC verification processing entirely.  For details on
59087 the operation and configuration of DMARC, see section <xref linkend="SECDMARC"/>.
59088 </para>
59089 </listitem></varlistentry>
59090 <varlistentry>
59091 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
59092 <listitem>
59093 <para>
59094 <indexterm role="concept">
59095 <primary>access control lists (ACLs)</primary>
59096 <secondary>setting DSCP value</secondary>
59097 </indexterm>
59098 <indexterm role="concept">
59099 <primary>DSCP</primary>
59100 <secondary>inbound</secondary>
59101 </indexterm>
59102 This option causes the DSCP value associated with the socket for the inbound
59103 connection to be adjusted to a given value, given as one of a number of fixed
59104 strings or to numeric value.
59105 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
59106 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
59107 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
59108 </para>
59109 <para>
59110 The outbound packets from Exim will be marked with this value in the header
59111 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
59112 that these values will have any effect, not be stripped by networking
59113 equipment, or do much of anything without cooperation with your Network
59114 Engineer and those of all network operators between the source and destination.
59115 </para>
59116 </listitem></varlistentry>
59117 <varlistentry>
59118 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
59119 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
59120 <listitem>
59121 <para>
59122 <indexterm role="concept">
59123 <primary>SMTP</primary>
59124 <secondary>synchronization checking</secondary>
59125 </indexterm>
59126 <indexterm role="concept">
59127 <primary>synchronization checking in SMTP</primary>
59128 </indexterm>
59129 These controls make it possible to be selective about when SMTP synchronization
59130 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
59131 state of the switch (it is true by default). See the description of this option
59132 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
59133 </para>
59134 <para>
59135 The effect of these two controls lasts for the remainder of the SMTP
59136 connection. They can appear in any ACL except the one for the non-SMTP
59137 messages. The most straightforward place to put them is in the ACL defined by
59138 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
59139 before the first synchronization check. The expected use is to turn off the
59140 synchronization checks for badly-behaved hosts that you nevertheless need to
59141 work with.
59142 </para>
59143 </listitem></varlistentry>
59144 <varlistentry>
59145 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
59146 <listitem>
59147 <para>
59148 <indexterm role="concept">
59149 <primary>fake defer</primary>
59150 </indexterm>
59151 <indexterm role="concept">
59152 <primary>defer, fake</primary>
59153 </indexterm>
59154 This control works in exactly the same way as <option>fakereject</option> (described below)
59155 except that it causes an SMTP 450 response after the message data instead of a
59156 550 response. You must take care when using <option>fakedefer</option> because it causes the
59157 messages to be duplicated when the sender retries. Therefore, you should not
59158 use <option>fakedefer</option> if the message is to be delivered normally.
59159 </para>
59160 </listitem></varlistentry>
59161 <varlistentry>
59162 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
59163 <listitem>
59164 <para>
59165 <indexterm role="concept">
59166 <primary>fake rejection</primary>
59167 </indexterm>
59168 <indexterm role="concept">
59169 <primary>rejection, fake</primary>
59170 </indexterm>
59171 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
59172 words, only when an SMTP message is being received. If Exim accepts the
59173 message, instead the final 250 response, a 550 rejection message is sent.
59174 However, Exim proceeds to deliver the message as normal. The control applies
59175 only to the current message, not to any subsequent ones that may be received in
59176 the same SMTP connection.
59177 </para>
59178 <para>
59179 The text for the 550 response is taken from the <option>control</option> modifier. If no
59180 message is supplied, the following is used:
59181 </para>
59182 <literallayout class="monospaced">
59183 550-Your message has been rejected but is being
59184 550-kept for evaluation.
59185 550-If it was a legitimate message, it may still be
59186 550 delivered to the target recipient(s).
59187 </literallayout>
59188 <para>
59189 This facility should be used with extreme caution.
59190 </para>
59191 </listitem></varlistentry>
59192 <varlistentry>
59193 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
59194 <listitem>
59195 <para>
59196 <indexterm role="concept">
59197 <primary>frozen messages</primary>
59198 <secondary>forcing in ACL</secondary>
59199 </indexterm>
59200 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
59201 other words, only when a message is being received. If the message is accepted,
59202 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
59203 current message, not to any subsequent ones that may be received in the same
59204 SMTP connection.
59205 </para>
59206 <para>
59207 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
59208 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
59209 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
59210 are obeyed for the current message have the <literal>/no_tell</literal> option.
59211 </para>
59212 </listitem></varlistentry>
59213 <varlistentry>
59214 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
59215 <listitem>
59216 <para>
59217 <indexterm role="concept">
59218 <primary>SMTP</primary>
59219 <secondary>output flushing, disabling for delay</secondary>
59220 </indexterm>
59221 Exim normally flushes SMTP output before implementing a delay in an ACL, to
59222 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
59223 use. This control, as long as it is encountered before the <option>delay</option> modifier,
59224 disables such output flushing.
59225 </para>
59226 </listitem></varlistentry>
59227 <varlistentry>
59228 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
59229 <listitem>
59230 <para>
59231 <indexterm role="concept">
59232 <primary>SMTP</primary>
59233 <secondary>output flushing, disabling for callout</secondary>
59234 </indexterm>
59235 Exim normally flushes SMTP output before performing a callout in an ACL, to
59236 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
59237 use. This control, as long as it is encountered before the <option>verify</option> condition
59238 that causes the callout, disables such output flushing.
59239 </para>
59240 </listitem></varlistentry>
59241 <varlistentry>
59242 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
59243 <listitem>
59244 <para>
59245 This control is available when Exim is compiled with the content scanning
59246 extension. Content scanning may require a copy of the current message, or parts
59247 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
59248 or spam scanner. Normally, such copies are deleted when they are no longer
59249 needed. If this control is set, the copies are not deleted. The control applies
59250 only to the current message, not to any subsequent ones that may be received in
59251 the same SMTP connection. It is provided for debugging purposes and is unlikely
59252 to be useful in production.
59253 </para>
59254 </listitem></varlistentry>
59255 <varlistentry>
59256 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
59257 <listitem>
59258 <para>
59259 <indexterm role="concept">
59260 <primary>multiline responses, suppressing</primary>
59261 </indexterm>
59262 This control is permitted for any ACL except the one for non-SMTP messages.
59263 It seems that there are broken clients in use that cannot handle multiline
59264 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
59265 </para>
59266 <para>
59267 If this control is set, multiline SMTP responses from ACL rejections are
59268 suppressed. One way of doing this would have been to put out these responses as
59269 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
59270 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
59271 responses might get close to that. So this facility, which is after all only a
59272 sop to broken clients, is implemented by doing two very easy things:
59273 </para>
59274 <itemizedlist>
59275 <listitem>
59276 <para>
59277 Extra information that is normally output as part of a rejection caused by
59278 sender verification failure is omitted. Only the final line (typically <quote>sender
59279 verification failed</quote>) is sent.
59280 </para>
59281 </listitem>
59282 <listitem>
59283 <para>
59284 If a <option>message</option> modifier supplies a multiline response, only the first
59285 line is output.
59286 </para>
59287 </listitem>
59288 </itemizedlist>
59289 <para>
59290 The setting of the switch can, of course, be made conditional on the
59291 calling host. Its effect lasts until the end of the SMTP connection.
59292 </para>
59293 </listitem></varlistentry>
59294 <varlistentry>
59295 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
59296 <listitem>
59297 <para>
59298 <indexterm role="concept">
59299 <primary>PIPELINING</primary>
59300 <secondary>suppressing advertising</secondary>
59301 </indexterm>
59302 <indexterm role="concept">
59303 <primary>ESMTP extensions</primary>
59304 <secondary>PIPELINING</secondary>
59305 </indexterm>
59306 This control turns off the advertising of the PIPELINING extension to SMTP in
59307 the current session. To be useful, it must be obeyed before Exim sends its
59308 response to an EHLO command. Therefore, it should normally appear in an ACL
59309 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
59310 <option>pipelining_advertise_hosts</option>.
59311 </para>
59312 </listitem></varlistentry>
59313 <varlistentry revisionflag="changed">
59314 <term><emphasis role="bold">control&nbsp;=&nbsp;queue/</emphasis>&lt;<emphasis>options</emphasis>&gt;*</term>
59315 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
59316 <listitem>
59317 <para revisionflag="changed">
59318 <indexterm role="option">
59319 <primary><option>queue</option></primary>
59320 </indexterm>
59321 <indexterm role="option">
59322 <primary><option>queue_only</option></primary>
59323 </indexterm>
59324 <indexterm role="concept">
59325 <primary>queueing incoming messages</primary>
59326 </indexterm>
59327 <indexterm role="concept">
59328 <primary>queueing</primary>
59329 <secondary>forcing in ACL</secondary>
59330 </indexterm>
59331 <indexterm role="concept">
59332 <primary>first pass routing</primary>
59333 </indexterm>
59334 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
59335 other words, only when a message is being received. If the message is accepted,
59336 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
59337 runner.
59338 If used with no options set,
59339 no immediate delivery process is started. In other words, it has the
59340 effect as the <option>queue_only</option> global option or <emphasis>-odq</emphasis> command-line option.
59341 </para>
59342 <para revisionflag="changed">
59343 If the <emphasis>first_pass_route</emphasis> option is given then
59344 the behaviour is like the command-line <emphasis>-oqds</emphasis> option;
59345 a delivery process is started which stops short of making
59346 any SMTP delivery.  The benefit is that the hints database will be updated for
59347 the message being waiting for a specific host, and a later queue run will be
59348 able to send all such messages on a single connection.
59349 </para>
59350 <para revisionflag="changed">
59351 The control only applies to the current message, not to any subsequent ones that
59352  may be received in the same SMTP connection.
59353 </para>
59354 </listitem></varlistentry>
59355 <varlistentry>
59356 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
59357 <listitem>
59358 <para>
59359 <indexterm role="concept">
59360 <primary>message</primary>
59361 <secondary>submission</secondary>
59362 </indexterm>
59363 <indexterm role="concept">
59364 <primary>submission mode</primary>
59365 </indexterm>
59366 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
59367 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
59368 the current message is a submission from a local MUA. In this case, Exim
59369 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
59370 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
59371 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
59372 late (the message has already been created).
59373 </para>
59374 <para>
59375 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
59376 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
59377 submission mode; the available options for this control are described there.
59378 The control applies only to the current message, not to any subsequent ones
59379 that may be received in the same SMTP connection.
59380 </para>
59381 </listitem></varlistentry>
59382 <varlistentry>
59383 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
59384 <listitem>
59385 <para>
59386 <indexterm role="concept">
59387 <primary>submission fixups, suppressing</primary>
59388 </indexterm>
59389 This control applies to locally submitted (non TCP/IP) messages, and is the
59390 complement of <literal>control = submission</literal>. It disables the fixups that are
59391 normally applied to locally-submitted messages. Specifically:
59392 </para>
59393 <itemizedlist>
59394 <listitem>
59395 <para>
59396 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
59397 dynamic version of <option>local_sender_retain</option>).
59398 </para>
59399 </listitem>
59400 <listitem>
59401 <para>
59402 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
59403 </para>
59404 </listitem>
59405 <listitem>
59406 <para>
59407 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
59408 </para>
59409 </listitem>
59410 </itemizedlist>
59411 <para>
59412 This control may be useful when a remotely-originated message is accepted,
59413 passed to some scanning program, and then re-submitted for delivery. It can be
59414 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
59415 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
59416 data is read.
59417 </para>
59418 <para>
59419 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
59420 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
59421 </para>
59422 </listitem></varlistentry>
59423 <varlistentry>
59424 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
59425 <listitem>
59426 <para>
59427 This control enables conversion of UTF-8 in message envelope addresses
59428 to a-label form.
59429 For details see section <xref linkend="SECTi18nMTA"/>.
59430 </para>
59431 </listitem></varlistentry>
59432 </variablelist>
59433 </section>
59434 <section id="SECTsummesfix">
59435 <title>Summary of message fixup control</title>
59436 <para>
59437 All four possibilities for message fixups can be specified:
59438 </para>
59439 <itemizedlist>
59440 <listitem>
59441 <para>
59442 Locally submitted, fixups applied: the default.
59443 </para>
59444 </listitem>
59445 <listitem>
59446 <para>
59447 Locally submitted, no fixups applied: use
59448 <literal>control = suppress_local_fixups</literal>.
59449 </para>
59450 </listitem>
59451 <listitem>
59452 <para>
59453 Remotely submitted, no fixups applied: the default.
59454 </para>
59455 </listitem>
59456 <listitem>
59457 <para>
59458 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
59459 </para>
59460 </listitem>
59461 </itemizedlist>
59462 </section>
59463 <section id="SECTaddheadacl">
59464 <title>Adding header lines in ACLs</title>
59465 <para>
59466 <indexterm role="concept">
59467 <primary>header lines</primary>
59468 <secondary>adding in an ACL</secondary>
59469 </indexterm>
59470 <indexterm role="concept">
59471 <primary>header lines</primary>
59472 <secondary>position of added lines</secondary>
59473 </indexterm>
59474 <indexterm role="concept">
59475 <primary><option>add_header</option> ACL modifier</primary>
59476 </indexterm>
59477 The <option>add_header</option> modifier can be used to add one or more extra header lines
59478 to an incoming message, as in this example:
59479 </para>
59480 <literallayout class="monospaced">
59481 warn dnslists = sbl.spamhaus.org : \
59482                 dialup.mail-abuse.org
59483      add_header = X-blacklisted-at: $dnslist_domain
59484 </literallayout>
59485 <para>
59486 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
59487 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
59488 receiving a message). The message must ultimately be accepted for
59489 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
59490 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
59491 RCPT ACL).
59492 </para>
59493 <para>
59494 Headers will not be added to the message if the modifier is used in
59495 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
59496 </para>
59497 <para>
59498 Leading and trailing newlines are removed from
59499 the data for the <option>add_header</option> modifier; if it then
59500 contains one or more newlines that
59501 are not followed by a space or a tab, it is assumed to contain multiple header
59502 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
59503 front of any line that is not a valid header line.
59504 </para>
59505 <para>
59506 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
59507 They are added to the message before processing the DATA and MIME ACLs.
59508 However, if an identical header line is requested more than once, only one copy
59509 is actually added to the message. Further header lines may be accumulated
59510 during the DATA and MIME ACLs, after which they are added to the message, again
59511 with duplicates suppressed. Thus, it is possible to add two identical header
59512 lines to an SMTP message, but only if one is added before DATA and one after.
59513 In the case of non-SMTP messages, new headers are accumulated during the
59514 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
59515 message is rejected after DATA or by the non-SMTP ACL, all added header lines
59516 are included in the entry that is written to the reject log.
59517 </para>
59518 <para>
59519 <indexterm role="concept">
59520 <primary>header lines</primary>
59521 <secondary>added; visibility of</secondary>
59522 </indexterm>
59523 Header lines are not visible in string expansions
59524 of message headers
59525 until they are added to the
59526 message. It follows that header lines defined in the MAIL, RCPT, and predata
59527 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
59528 header lines that are added by the DATA or MIME ACLs are not visible in those
59529 ACLs. Because of this restriction, you cannot use header lines as a way of
59530 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
59531 this, you can use ACL variables, as described in section
59532 <xref linkend="SECTaclvariables"/>.
59533 </para>
59534 <para>
59535 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
59536 </para>
59537 <para>
59538 The <option>add_header</option> modifier acts immediately as it is encountered during the
59539 processing of an ACL. Notice the difference between these two cases:
59540 </para>
59541 <literallayout>
59542 <literal>accept add_header = ADDED: some text</literal>
59543 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
59544
59545 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
59546 <literal>       add_header = ADDED: some text</literal>
59547 </literallayout>
59548 <para>
59549 In the first case, the header line is always added, whether or not the
59550 condition is true. In the second case, the header line is added only if the
59551 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
59552 ACL statement. All those that are encountered before a condition fails are
59553 honoured.
59554 </para>
59555 <para>
59556 <indexterm role="concept">
59557 <primary><option>warn</option> ACL verb</primary>
59558 </indexterm>
59559 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
59560 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
59561 effect only if all the conditions are true, even if it appears before some of
59562 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
59563 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
59564 are present on a <option>warn</option> verb, both are processed according to their
59565 specifications.
59566 </para>
59567 <para>
59568 By default, new header lines are added to a message at the end of the existing
59569 header lines. However, you can specify that any particular header line should
59570 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
59571 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
59572 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
59573 </para>
59574 <para>
59575 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
59576 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
59577 header line, respectively. (Header text cannot start with a colon, as there has
59578 to be a header name first.) For example:
59579 </para>
59580 <literallayout class="monospaced">
59581 warn add_header = \
59582        :after_received:X-My-Header: something or other...
59583 </literallayout>
59584 <para>
59585 If more than one header line is supplied in a single <option>add_header</option> modifier,
59586 each one is treated independently and can therefore be placed differently. If
59587 you add more than one line at the start, or after the Received: block, they end
59588 up in reverse order.
59589 </para>
59590 <para>
59591 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
59592 added in an ACL. It does NOT work for header lines that are added in a
59593 system filter or in a router or transport.
59594 </para>
59595 </section>
59596 <section id="SECTremoveheadacl">
59597 <title>Removing header lines in ACLs</title>
59598 <para>
59599 <indexterm role="concept">
59600 <primary>header lines</primary>
59601 <secondary>removing in an ACL</secondary>
59602 </indexterm>
59603 <indexterm role="concept">
59604 <primary>header lines</primary>
59605 <secondary>position of removed lines</secondary>
59606 </indexterm>
59607 <indexterm role="concept">
59608 <primary><option>remove_header</option> ACL modifier</primary>
59609 </indexterm>
59610 The <option>remove_header</option> modifier can be used to remove one or more header lines
59611 from an incoming message, as in this example:
59612 </para>
59613 <literallayout class="monospaced">
59614 warn   message        = Remove internal headers
59615        remove_header  = x-route-mail1 : x-route-mail2
59616 </literallayout>
59617 <para>
59618 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
59619 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
59620 receiving a message). The message must ultimately be accepted for
59621 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
59622 with any ACL verb, including <option>deny</option>, though this is really not useful for
59623 any verb that doesn&#x2019;t result in a delivered message.
59624 </para>
59625 <para>
59626 Headers will not be removed from the message if the modifier is used in
59627 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
59628 </para>
59629 <para>
59630 More than one header can be removed at the same time by using a colon separated
59631 list of header names. The header matching is case insensitive. Wildcards are
59632 not permitted, nor is list expansion performed, so you cannot use hostlists to
59633 create a list of headers, however both connection and message variable expansion
59634 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
59635 </para>
59636 <literallayout class="monospaced">
59637 warn   hosts           = +internal_hosts
59638        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
59639 warn   message         = Remove internal headers
59640        remove_header   = $acl_c_ihdrs
59641 </literallayout>
59642 <para>
59643 Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs.
59644 Matching header lines are removed from the message before processing the DATA and MIME ACLs.
59645 If multiple header lines match, all are removed.
59646 There is no harm in attempting to remove the same header twice nor in removing
59647 a non-existent header. Further header lines to be removed may be accumulated
59648 during the DATA and MIME ACLs, after which they are removed from the message,
59649 if present. In the case of non-SMTP messages, headers to be removed are
59650 accumulated during the non-SMTP ACLs, and are removed from the message after
59651 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
59652 ACL, there really is no effect because there is no logging of what headers
59653 would have been removed.
59654 </para>
59655 <para>
59656 <indexterm role="concept">
59657 <primary>header lines</primary>
59658 <secondary>removed; visibility of</secondary>
59659 </indexterm>
59660 Header lines are not visible in string expansions until the DATA phase when it
59661 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
59662 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
59663 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
59664 this restriction, you cannot use header lines as a way of controlling data
59665 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
59666 you should instead use ACL variables, as described in section
59667 <xref linkend="SECTaclvariables"/>.
59668 </para>
59669 <para>
59670 The <option>remove_header</option> modifier acts immediately as it is encountered during the
59671 processing of an ACL. Notice the difference between these two cases:
59672 </para>
59673 <literallayout>
59674 <literal>accept remove_header = X-Internal</literal>
59675 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
59676
59677 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
59678 <literal>       remove_header = X-Internal</literal>
59679 </literallayout>
59680 <para>
59681 In the first case, the header line is always removed, whether or not the
59682 condition is true. In the second case, the header line is removed only if the
59683 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
59684 same ACL statement. All those that are encountered before a condition fails
59685 are honoured.
59686 </para>
59687 <para>
59688 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
59689 present during ACL processing. It does NOT remove header lines that are added
59690 in a system filter or in a router or transport.
59691 </para>
59692 </section>
59693 <section id="SECTaclconditions">
59694 <title>ACL conditions</title>
59695 <para>
59696 <indexterm role="concept">
59697 <primary>access control lists (ACLs)</primary>
59698 <secondary>conditions; list of</secondary>
59699 </indexterm>
59700 Some of the conditions listed in this section are available only when Exim is
59701 compiled with the content-scanning extension. They are included here briefly
59702 for completeness. More detailed descriptions can be found in the discussion on
59703 content scanning in chapter <xref linkend="CHAPexiscan"/>.
59704 </para>
59705 <para>
59706 Not all conditions are relevant in all circumstances. For example, testing
59707 senders and recipients does not make sense in an ACL that is being run as the
59708 result of the arrival of an ETRN command, and checks on message headers can be
59709 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
59710 can use the same condition (with different parameters) more than once in the
59711 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
59712 The conditions are as follows:
59713 </para>
59714 <variablelist>
59715 <varlistentry>
59716 <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>
59717 <listitem>
59718 <para>
59719 <indexterm role="concept">
59720 <primary>access control lists (ACLs)</primary>
59721 <secondary>nested</secondary>
59722 </indexterm>
59723 <indexterm role="concept">
59724 <primary>access control lists (ACLs)</primary>
59725 <secondary>indirect</secondary>
59726 </indexterm>
59727 <indexterm role="concept">
59728 <primary>access control lists (ACLs)</primary>
59729 <secondary>arguments</secondary>
59730 </indexterm>
59731 <indexterm role="concept">
59732 <primary><option>acl</option> ACL condition</primary>
59733 </indexterm>
59734 The possible values of the argument are the same as for the
59735 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
59736 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
59737 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
59738 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
59739 condition false. This means that further processing of the <option>warn</option> verb
59740 ceases, but processing of the ACL continues.
59741 </para>
59742 <para>
59743 If the argument is a named ACL, up to nine space-separated optional values
59744 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
59745 and $acl_narg is set to the count of values.
59746 Previous values of these variables are restored after the call returns.
59747 The name and values are expanded separately.
59748 Note that spaces in complex expansions which are used as arguments
59749 will act as argument separators.
59750 </para>
59751 <para>
59752 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
59753 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
59754 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
59755 conditions are tested.
59756 </para>
59757 <para>
59758 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
59759 loops. This condition allows you to use different ACLs in different
59760 circumstances. For example, different ACLs can be used to handle RCPT commands
59761 for different local users or different local domains.
59762 </para>
59763 </listitem></varlistentry>
59764 <varlistentry>
59765 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
59766 <listitem>
59767 <para>
59768 <indexterm role="concept">
59769 <primary><option>authenticated</option> ACL condition</primary>
59770 </indexterm>
59771 <indexterm role="concept">
59772 <primary>authentication</primary>
59773 <secondary>ACL checking</secondary>
59774 </indexterm>
59775 <indexterm role="concept">
59776 <primary>access control lists (ACLs)</primary>
59777 <secondary>testing for authentication</secondary>
59778 </indexterm>
59779 If the SMTP connection is not authenticated, the condition is false. Otherwise,
59780 the name of the authenticator is tested against the list. To test for
59781 authentication by any authenticator, you can set
59782 </para>
59783 <literallayout class="monospaced">
59784 authenticated = *
59785 </literallayout>
59786 </listitem></varlistentry>
59787 <varlistentry>
59788 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
59789 <listitem>
59790 <para>
59791 <indexterm role="concept">
59792 <primary><option>condition</option> ACL condition</primary>
59793 </indexterm>
59794 <indexterm role="concept">
59795 <primary>customizing</primary>
59796 <secondary>ACL condition</secondary>
59797 </indexterm>
59798 <indexterm role="concept">
59799 <primary>access control lists (ACLs)</primary>
59800 <secondary>customized test</secondary>
59801 </indexterm>
59802 <indexterm role="concept">
59803 <primary>access control lists (ACLs)</primary>
59804 <secondary>testing, customized</secondary>
59805 </indexterm>
59806 This feature allows you to make up custom conditions. If the result of
59807 expanding the string is an empty string, the number zero, or one of the strings
59808 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
59809 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
59810 any other value, some error is assumed to have occurred, and the ACL returns
59811 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
59812 ignored. The effect is to treat it as true, whether it is positive or
59813 negative.
59814 </para>
59815 </listitem></varlistentry>
59816 <varlistentry>
59817 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
59818 <listitem>
59819 <para>
59820 <indexterm role="concept">
59821 <primary><option>decode</option> ACL condition</primary>
59822 </indexterm>
59823 This condition is available only when Exim is compiled with the
59824 content-scanning extension, and it is allowed only in the ACL defined by
59825 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
59826 If all goes well, the condition is true. It is false only if there are
59827 problems such as a syntax error or a memory shortage. For more details, see
59828 chapter <xref linkend="CHAPexiscan"/>.
59829 </para>
59830 </listitem></varlistentry>
59831 <varlistentry>
59832 <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>
59833 <listitem>
59834 <para>
59835 <indexterm role="concept">
59836 <primary><option>dnslists</option> ACL condition</primary>
59837 </indexterm>
59838 <indexterm role="concept">
59839 <primary>DNS list</primary>
59840 <secondary>in ACL</secondary>
59841 </indexterm>
59842 <indexterm role="concept">
59843 <primary>black list (DNS)</primary>
59844 </indexterm>
59845 <indexterm role="concept">
59846 <primary>access control lists (ACLs)</primary>
59847 <secondary>testing a DNS list</secondary>
59848 </indexterm>
59849 This condition checks for entries in DNS black lists. These are also known as
59850 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
59851 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
59852 different variants of this condition to describe briefly here. See sections
59853 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
59854 </para>
59855 </listitem></varlistentry>
59856 <varlistentry>
59857 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
59858 <listitem>
59859 <para>
59860 <indexterm role="concept">
59861 <primary><option>domains</option> ACL condition</primary>
59862 </indexterm>
59863 <indexterm role="concept">
59864 <primary>domain</primary>
59865 <secondary>ACL checking</secondary>
59866 </indexterm>
59867 <indexterm role="concept">
59868 <primary>access control lists (ACLs)</primary>
59869 <secondary>testing a recipient domain</secondary>
59870 </indexterm>
59871 <indexterm role="variable">
59872 <primary><varname>$domain_data</varname></primary>
59873 </indexterm>
59874 This condition is relevant only after a RCPT command. It checks that the domain
59875 of the recipient address is in the domain list. If percent-hack processing is
59876 enabled, it is done before this test is done. If the check succeeds with a
59877 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
59878 <option>domains</option> test.
59879 </para>
59880 <para>
59881 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
59882 use <option>domains</option> in a DATA ACL.
59883 </para>
59884 </listitem></varlistentry>
59885 <varlistentry>
59886 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
59887 <listitem>
59888 <para>
59889 <indexterm role="concept">
59890 <primary><option>encrypted</option> ACL condition</primary>
59891 </indexterm>
59892 <indexterm role="concept">
59893 <primary>encryption</primary>
59894 <secondary>checking in an ACL</secondary>
59895 </indexterm>
59896 <indexterm role="concept">
59897 <primary>access control lists (ACLs)</primary>
59898 <secondary>testing for encryption</secondary>
59899 </indexterm>
59900 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
59901 name of the cipher suite in use is tested against the list. To test for
59902 encryption without testing for any specific cipher suite(s), set
59903 </para>
59904 <literallayout class="monospaced">
59905 encrypted = *
59906 </literallayout>
59907 </listitem></varlistentry>
59908 <varlistentry>
59909 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
59910 <listitem>
59911 <para>
59912 <indexterm role="concept">
59913 <primary><option>hosts</option> ACL condition</primary>
59914 </indexterm>
59915 <indexterm role="concept">
59916 <primary>host</primary>
59917 <secondary>ACL checking</secondary>
59918 </indexterm>
59919 <indexterm role="concept">
59920 <primary>access control lists (ACLs)</primary>
59921 <secondary>testing the client host</secondary>
59922 </indexterm>
59923 This condition tests that the calling host matches the host list. If you have
59924 name lookups or wildcarded host names and IP addresses in the same host list,
59925 you should normally put the IP addresses first. For example, you could have:
59926 </para>
59927 <literallayout class="monospaced">
59928 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
59929 </literallayout>
59930 <para>
59931 The lookup in this example uses the host name for its key. This is implied by
59932 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
59933 and it wouldn&#x2019;t matter which way round you had these two items.)
59934 </para>
59935 <para>
59936 The reason for the problem with host names lies in the left-to-right way that
59937 Exim processes lists. It can test IP addresses without doing any DNS lookups,
59938 but when it reaches an item that requires a host name, it fails if it cannot
59939 find a host name to compare with the pattern. If the above list is given in the
59940 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
59941 found, even if its IP address is 10.9.8.7.
59942 </para>
59943 <para>
59944 If you really do want to do the name check first, and still recognize the IP
59945 address even if the name lookup fails, you can rewrite the ACL like this:
59946 </para>
59947 <literallayout class="monospaced">
59948 accept hosts = dbm;/etc/friendly/hosts
59949 accept hosts = 10.9.8.7
59950 </literallayout>
59951 <para>
59952 The default action on failing to find the host name is to assume that the host
59953 is not in the list, so the first <option>accept</option> statement fails. The second
59954 statement can then check the IP address.
59955 </para>
59956 <para>
59957 <indexterm role="variable">
59958 <primary><varname>$host_data</varname></primary>
59959 </indexterm>
59960 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
59961 of the lookup is made available in the <varname>$host_data</varname> variable. This
59962 allows you, for example, to set up a statement like this:
59963 </para>
59964 <literallayout class="monospaced">
59965 deny  hosts = net-lsearch;/some/file
59966       message = $host_data
59967 </literallayout>
59968 <para>
59969 which gives a custom error message for each denied host.
59970 </para>
59971 </listitem></varlistentry>
59972 <varlistentry>
59973 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
59974 <listitem>
59975 <para>
59976 <indexterm role="concept">
59977 <primary><option>local_parts</option> ACL condition</primary>
59978 </indexterm>
59979 <indexterm role="concept">
59980 <primary>local part</primary>
59981 <secondary>ACL checking</secondary>
59982 </indexterm>
59983 <indexterm role="concept">
59984 <primary>access control lists (ACLs)</primary>
59985 <secondary>testing a local part</secondary>
59986 </indexterm>
59987 <indexterm role="variable">
59988 <primary><varname>$local_part_data</varname></primary>
59989 </indexterm>
59990 This condition is relevant only after a RCPT command. It checks that the local
59991 part of the recipient address is in the list. If percent-hack processing is
59992 enabled, it is done before this test. If the check succeeds with a lookup, the
59993 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
59994 the next <option>local_parts</option> test.
59995 </para>
59996 </listitem></varlistentry>
59997 <varlistentry>
59998 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
59999 <listitem>
60000 <para>
60001 <indexterm role="concept">
60002 <primary><option>malware</option> ACL condition</primary>
60003 </indexterm>
60004 <indexterm role="concept">
60005 <primary>access control lists (ACLs)</primary>
60006 <secondary>virus scanning</secondary>
60007 </indexterm>
60008 <indexterm role="concept">
60009 <primary>access control lists (ACLs)</primary>
60010 <secondary>scanning for viruses</secondary>
60011 </indexterm>
60012 This condition is available only when Exim is compiled with the
60013 content-scanning extension
60014 and only after a DATA command.
60015 It causes the incoming message to be scanned for
60016 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
60017 </para>
60018 </listitem></varlistentry>
60019 <varlistentry>
60020 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
60021 <listitem>
60022 <para>
60023 <indexterm role="concept">
60024 <primary><option>mime_regex</option> ACL condition</primary>
60025 </indexterm>
60026 <indexterm role="concept">
60027 <primary>access control lists (ACLs)</primary>
60028 <secondary>testing by regex matching</secondary>
60029 </indexterm>
60030 This condition is available only when Exim is compiled with the
60031 content-scanning extension, and it is allowed only in the ACL defined by
60032 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
60033 with any of the regular expressions. For details, see chapter
60034 <xref linkend="CHAPexiscan"/>.
60035 </para>
60036 </listitem></varlistentry>
60037 <varlistentry>
60038 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
60039 <listitem>
60040 <para>
60041 <indexterm role="concept">
60042 <primary>rate limiting</primary>
60043 </indexterm>
60044 This condition can be used to limit the rate at which a user or host submits
60045 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
60046 </para>
60047 </listitem></varlistentry>
60048 <varlistentry>
60049 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
60050 <listitem>
60051 <para>
60052 <indexterm role="concept">
60053 <primary><option>recipients</option> ACL condition</primary>
60054 </indexterm>
60055 <indexterm role="concept">
60056 <primary>recipient</primary>
60057 <secondary>ACL checking</secondary>
60058 </indexterm>
60059 <indexterm role="concept">
60060 <primary>access control lists (ACLs)</primary>
60061 <secondary>testing a recipient</secondary>
60062 </indexterm>
60063 This condition is relevant only after a RCPT command. It checks the entire
60064 recipient address against a list of recipients.
60065 </para>
60066 </listitem></varlistentry>
60067 <varlistentry>
60068 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
60069 <listitem>
60070 <para>
60071 <indexterm role="concept">
60072 <primary><option>regex</option> ACL condition</primary>
60073 </indexterm>
60074 <indexterm role="concept">
60075 <primary>access control lists (ACLs)</primary>
60076 <secondary>testing by regex matching</secondary>
60077 </indexterm>
60078 This condition is available only when Exim is compiled with the
60079 content-scanning extension, and is available only in the DATA, MIME, and
60080 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
60081 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
60082 </para>
60083 </listitem></varlistentry>
60084 <varlistentry>
60085 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
60086 <listitem>
60087 <para>
60088 <indexterm role="concept">
60089 <primary><option>sender_domains</option> ACL condition</primary>
60090 </indexterm>
60091 <indexterm role="concept">
60092 <primary>sender</primary>
60093 <secondary>ACL checking</secondary>
60094 </indexterm>
60095 <indexterm role="concept">
60096 <primary>access control lists (ACLs)</primary>
60097 <secondary>testing a sender domain</secondary>
60098 </indexterm>
60099 <indexterm role="variable">
60100 <primary><varname>$domain</varname></primary>
60101 </indexterm>
60102 <indexterm role="variable">
60103 <primary><varname>$sender_address_domain</varname></primary>
60104 </indexterm>
60105 This condition tests the domain of the sender of the message against the given
60106 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
60107 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
60108 of this condition. This is an exception to the general rule for testing domain
60109 lists. It is done this way so that, if this condition is used in an ACL for a
60110 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
60111 influence the sender checking.
60112 </para>
60113 <para>
60114 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
60115 relaying, because sender addresses are easily, and commonly, forged.
60116 </para>
60117 </listitem></varlistentry>
60118 <varlistentry>
60119 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
60120 <listitem>
60121 <para>
60122 <indexterm role="concept">
60123 <primary><option>senders</option> ACL condition</primary>
60124 </indexterm>
60125 <indexterm role="concept">
60126 <primary>sender</primary>
60127 <secondary>ACL checking</secondary>
60128 </indexterm>
60129 <indexterm role="concept">
60130 <primary>access control lists (ACLs)</primary>
60131 <secondary>testing a sender</secondary>
60132 </indexterm>
60133 This condition tests the sender of the message against the given list. To test
60134 for a bounce message, which has an empty sender, set
60135 </para>
60136 <literallayout class="monospaced">
60137 senders = :
60138 </literallayout>
60139 <para>
60140 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
60141 relaying, because sender addresses are easily, and commonly, forged.
60142 </para>
60143 </listitem></varlistentry>
60144 <varlistentry>
60145 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
60146 <listitem>
60147 <para>
60148 <indexterm role="concept">
60149 <primary><option>spam</option> ACL condition</primary>
60150 </indexterm>
60151 <indexterm role="concept">
60152 <primary>access control lists (ACLs)</primary>
60153 <secondary>scanning for spam</secondary>
60154 </indexterm>
60155 This condition is available only when Exim is compiled with the
60156 content-scanning extension. It causes the incoming message to be scanned by
60157 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
60158 </para>
60159 </listitem></varlistentry>
60160 <varlistentry>
60161 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
60162 <listitem>
60163 <para>
60164 <indexterm role="concept">
60165 <primary><option>verify</option> ACL condition</primary>
60166 </indexterm>
60167 <indexterm role="concept">
60168 <primary>TLS</primary>
60169 <secondary>client certificate verification</secondary>
60170 </indexterm>
60171 <indexterm role="concept">
60172 <primary>certificate</primary>
60173 <secondary>verification of client</secondary>
60174 </indexterm>
60175 <indexterm role="concept">
60176 <primary>access control lists (ACLs)</primary>
60177 <secondary>certificate verification</secondary>
60178 </indexterm>
60179 <indexterm role="concept">
60180 <primary>access control lists (ACLs)</primary>
60181 <secondary>testing a TLS certificate</secondary>
60182 </indexterm>
60183 This condition is true in an SMTP session if the session is encrypted, and a
60184 certificate was received from the client, and the certificate was verified. The
60185 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
60186 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
60187 </para>
60188 </listitem></varlistentry>
60189 <varlistentry>
60190 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
60191 <listitem>
60192 <para>
60193 <indexterm role="concept">
60194 <primary>CSA verification</primary>
60195 </indexterm>
60196 This condition checks whether the sending host (the client) is authorized to
60197 send email. Details of how this works are given in section
60198 <xref linkend="SECTverifyCSA"/>.
60199 </para>
60200 </listitem></varlistentry>
60201 <varlistentry>
60202 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
60203 <listitem>
60204 <para>
60205 <indexterm role="concept">
60206 <primary><option>verify</option> ACL condition</primary>
60207 </indexterm>
60208 <indexterm role="concept">
60209 <primary>access control lists (ACLs)</primary>
60210 <secondary>verifying header names only ASCII</secondary>
60211 </indexterm>
60212 <indexterm role="concept">
60213 <primary>header lines</primary>
60214 <secondary>verifying header names only ASCII</secondary>
60215 </indexterm>
60216 <indexterm role="concept">
60217 <primary>verifying</primary>
60218 <secondary>header names only ASCII</secondary>
60219 </indexterm>
60220 This condition is relevant only in an ACL that is run after a message has been
60221 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60222 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
60223 there are no non-ASCII characters, also excluding control characters.  The
60224 allowable characters are decimal ASCII values 33 through 126.
60225 </para>
60226 <para>
60227 Exim itself will handle headers with non-ASCII characters, but it can cause
60228 problems for downstream applications, so this option will allow their
60229 detection and rejection in the DATA ACL&#x2019;s.
60230 </para>
60231 </listitem></varlistentry>
60232 <varlistentry>
60233 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60234 <listitem>
60235 <para>
60236 <indexterm role="concept">
60237 <primary><option>verify</option> ACL condition</primary>
60238 </indexterm>
60239 <indexterm role="concept">
60240 <primary>access control lists (ACLs)</primary>
60241 <secondary>verifying sender in the header</secondary>
60242 </indexterm>
60243 <indexterm role="concept">
60244 <primary>header lines</primary>
60245 <secondary>verifying the sender in</secondary>
60246 </indexterm>
60247 <indexterm role="concept">
60248 <primary>sender</primary>
60249 <secondary>verifying in header</secondary>
60250 </indexterm>
60251 <indexterm role="concept">
60252 <primary>verifying</primary>
60253 <secondary>sender in header</secondary>
60254 </indexterm>
60255 This condition is relevant only in an ACL that is run after a message has been
60256 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60257 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
60258 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
60259 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
60260 However, an address that appears in one of these headers need not be an address
60261 that accepts bounce messages; only sender addresses in envelopes are required
60262 to accept bounces. Therefore, if you use the callout option on this check, you
60263 might want to arrange for a non-empty address in the MAIL command.
60264 </para>
60265 <para>
60266 Details of address verification and the options are given later, starting at
60267 section <xref linkend="SECTaddressverification"/> (callouts are described in section
60268 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
60269 condition to restrict it to bounce messages only:
60270 </para>
60271 <literallayout class="monospaced">
60272 deny    senders = :
60273        !verify  = header_sender
60274         message = A valid sender header is required for bounces
60275 </literallayout>
60276 </listitem></varlistentry>
60277 <varlistentry>
60278 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
60279 <listitem>
60280 <para>
60281 <indexterm role="concept">
60282 <primary><option>verify</option> ACL condition</primary>
60283 </indexterm>
60284 <indexterm role="concept">
60285 <primary>access control lists (ACLs)</primary>
60286 <secondary>verifying header syntax</secondary>
60287 </indexterm>
60288 <indexterm role="concept">
60289 <primary>header lines</primary>
60290 <secondary>verifying syntax</secondary>
60291 </indexterm>
60292 <indexterm role="concept">
60293 <primary>verifying</primary>
60294 <secondary>header syntax</secondary>
60295 </indexterm>
60296 This condition is relevant only in an ACL that is run after a message has been
60297 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60298 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
60299 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
60300 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
60301 Unqualified addresses (local parts without domains) are
60302 permitted only in locally generated messages and from hosts that match
60303 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
60304 appropriate.
60305 </para>
60306 <para>
60307 Note that this condition is a syntax check only. However, a common spamming
60308 ploy used to be to send syntactically invalid headers such as
60309 </para>
60310 <literallayout class="monospaced">
60311 To: @
60312 </literallayout>
60313 <para>
60314 and this condition can be used to reject such messages, though they are not as
60315 common as they used to be.
60316 </para>
60317 </listitem></varlistentry>
60318 <varlistentry>
60319 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
60320 <listitem>
60321 <para>
60322 <indexterm role="concept">
60323 <primary><option>verify</option> ACL condition</primary>
60324 </indexterm>
60325 <indexterm role="concept">
60326 <primary>access control lists (ACLs)</primary>
60327 <secondary>verifying HELO/EHLO</secondary>
60328 </indexterm>
60329 <indexterm role="concept">
60330 <primary>HELO</primary>
60331 <secondary>verifying</secondary>
60332 </indexterm>
60333 <indexterm role="concept">
60334 <primary>EHLO</primary>
60335 <secondary>verifying</secondary>
60336 </indexterm>
60337 <indexterm role="concept">
60338 <primary>verifying</primary>
60339 <secondary>EHLO</secondary>
60340 </indexterm>
60341 <indexterm role="concept">
60342 <primary>verifying</primary>
60343 <secondary>HELO</secondary>
60344 </indexterm>
60345 This condition is true if a HELO or EHLO command has been received from the
60346 client host, and its contents have been verified. If there has been no previous
60347 attempt to verify the HELO/EHLO contents, it is carried out when this
60348 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
60349 <option>helo_try_verify_hosts</option> options for details of how to request verification
60350 independently of this condition, and for detail of the verification.
60351 </para>
60352 <para>
60353 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
60354 option), this condition is always true.
60355 </para>
60356 </listitem></varlistentry>
60357 <varlistentry>
60358 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60359 <listitem>
60360 <para>
60361 <indexterm role="concept">
60362 <primary>verifying</primary>
60363 <secondary>not blind</secondary>
60364 </indexterm>
60365 <indexterm role="concept">
60366 <primary>bcc recipients, verifying none</primary>
60367 </indexterm>
60368 This condition checks that there are no blind (bcc) recipients in the message.
60369 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
60370 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
60371 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
60372 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
60373 used only in a DATA or non-SMTP ACL.
60374 </para>
60375 <para>
60376 There is one possible option, <literal>case_insensitive</literal>.  If this is present then
60377 local parts are checked case-insensitively.
60378 </para>
60379 <para>
60380 There are, of course, many legitimate messages that make use of blind (bcc)
60381 recipients. This check should not be used on its own for blocking messages.
60382 </para>
60383 </listitem></varlistentry>
60384 <varlistentry>
60385 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60386 <listitem>
60387 <para>
60388 <indexterm role="concept">
60389 <primary><option>verify</option> ACL condition</primary>
60390 </indexterm>
60391 <indexterm role="concept">
60392 <primary>access control lists (ACLs)</primary>
60393 <secondary>verifying recipient</secondary>
60394 </indexterm>
60395 <indexterm role="concept">
60396 <primary>recipient</primary>
60397 <secondary>verifying</secondary>
60398 </indexterm>
60399 <indexterm role="concept">
60400 <primary>verifying</primary>
60401 <secondary>recipient</secondary>
60402 </indexterm>
60403 <indexterm role="variable">
60404 <primary><varname>$address_data</varname></primary>
60405 </indexterm>
60406 This condition is relevant only after a RCPT command. It verifies the current
60407 recipient. Details of address verification are given later, starting at section
60408 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
60409 of <varname>$address_data</varname> is the last value that was set while routing the address.
60410 This applies even if the verification fails. When an address that is being
60411 verified is redirected to a single address, verification continues with the new
60412 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
60413 value for the child address.
60414 </para>
60415 </listitem></varlistentry>
60416 <varlistentry>
60417 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60418 <listitem>
60419 <para>
60420 <indexterm role="concept">
60421 <primary><option>verify</option> ACL condition</primary>
60422 </indexterm>
60423 <indexterm role="concept">
60424 <primary>access control lists (ACLs)</primary>
60425 <secondary>verifying host reverse lookup</secondary>
60426 </indexterm>
60427 <indexterm role="concept">
60428 <primary>host</primary>
60429 <secondary>verifying reverse lookup</secondary>
60430 </indexterm>
60431 This condition ensures that a verified host name has been looked up from the IP
60432 address of the client host. (This may have happened already if the host name
60433 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
60434 Verification ensures that the host name obtained from a reverse DNS lookup, or
60435 one of its aliases, does, when it is itself looked up in the DNS, yield the
60436 original IP address.
60437 </para>
60438 <para>
60439 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
60440 DNS operation returns a temporary error, the verify condition succeeds.
60441 </para>
60442 <para>
60443 If this condition is used for a locally generated message (that is, when there
60444 is no client host involved), it always succeeds.
60445 </para>
60446 </listitem></varlistentry>
60447 <varlistentry>
60448 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60449 <listitem>
60450 <para>
60451 <indexterm role="concept">
60452 <primary><option>verify</option> ACL condition</primary>
60453 </indexterm>
60454 <indexterm role="concept">
60455 <primary>access control lists (ACLs)</primary>
60456 <secondary>verifying sender</secondary>
60457 </indexterm>
60458 <indexterm role="concept">
60459 <primary>sender</primary>
60460 <secondary>verifying</secondary>
60461 </indexterm>
60462 <indexterm role="concept">
60463 <primary>verifying</primary>
60464 <secondary>sender</secondary>
60465 </indexterm>
60466 This condition is relevant only after a MAIL or RCPT command, or after a
60467 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
60468 the message&#x2019;s sender is empty (that is, this is a bounce message), the
60469 condition is true. Otherwise, the sender address is verified.
60470 </para>
60471 <para>
60472 <indexterm role="variable">
60473 <primary><varname>$address_data</varname></primary>
60474 </indexterm>
60475 <indexterm role="variable">
60476 <primary><varname>$sender_address_data</varname></primary>
60477 </indexterm>
60478 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
60479 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
60480 value can be used in subsequent conditions and modifiers in the same ACL
60481 statement. It does not persist after the end of the current statement. If you
60482 want to preserve the value for longer, you can save it in an ACL variable.
60483 </para>
60484 <para>
60485 Details of verification are given later, starting at section
60486 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
60487 to avoid doing it more than once per message.
60488 </para>
60489 </listitem></varlistentry>
60490 <varlistentry>
60491 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60492 <listitem>
60493 <para>
60494 <indexterm role="concept">
60495 <primary><option>verify</option> ACL condition</primary>
60496 </indexterm>
60497 This is a variation of the previous option, in which a modified address is
60498 verified as a sender.
60499 </para>
60500 <para>
60501 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
60502 (eg. is generated from the received message)
60503 they must be protected from the options parsing by doubling:
60504 </para>
60505 <literallayout class="monospaced">
60506 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
60507 </literallayout>
60508 </listitem></varlistentry>
60509 </variablelist>
60510 </section>
60511 <section id="SECTmorednslists">
60512 <title>Using DNS lists</title>
60513 <para>
60514 <indexterm role="concept">
60515 <primary>DNS list</primary>
60516 <secondary>in ACL</secondary>
60517 </indexterm>
60518 <indexterm role="concept">
60519 <primary>black list (DNS)</primary>
60520 </indexterm>
60521 <indexterm role="concept">
60522 <primary>access control lists (ACLs)</primary>
60523 <secondary>testing a DNS list</secondary>
60524 </indexterm>
60525 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
60526 is on at least one of a number of DNS lists by looking up the inverted IP
60527 address in one or more DNS domains. (Note that DNS list domains are not mail
60528 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
60529 special options instead.) For example, if the calling host&#x2019;s IP
60530 address is 192.168.62.43, and the ACL statement is
60531 </para>
60532 <literallayout class="monospaced">
60533 deny dnslists = blackholes.mail-abuse.org : \
60534                 dialups.mail-abuse.org
60535 </literallayout>
60536 <para>
60537 the following records are looked up:
60538 </para>
60539 <literallayout class="monospaced">
60540 43.62.168.192.blackholes.mail-abuse.org
60541 43.62.168.192.dialups.mail-abuse.org
60542 </literallayout>
60543 <para>
60544 As soon as Exim finds an existing DNS record, processing of the list stops.
60545 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
60546 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
60547 use two separate conditions:
60548 </para>
60549 <literallayout class="monospaced">
60550 deny dnslists = blackholes.mail-abuse.org
60551      dnslists = dialups.mail-abuse.org
60552 </literallayout>
60553 <para>
60554 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
60555 behaves as if the host does not match the list item, that is, as if the DNS
60556 record does not exist. If there are further items in the DNS list, they are
60557 processed.
60558 </para>
60559 <para>
60560 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
60561 (which is the most common usage), because it prevents a DNS failure from
60562 blocking mail. However, you can change this behaviour by putting one of the
60563 following special items in the list:
60564 </para>
60565 <literallayout>
60566 <literal>+include_unknown </literal>   behave as if the item is on the list
60567 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
60568 <literal>+defer_unknown   </literal>   give a temporary error
60569 </literallayout>
60570 <para>
60571 <indexterm role="concept">
60572 <primary><literal>+include_unknown</literal></primary>
60573 </indexterm>
60574 <indexterm role="concept">
60575 <primary><literal>+exclude_unknown</literal></primary>
60576 </indexterm>
60577 <indexterm role="concept">
60578 <primary><literal>+defer_unknown</literal></primary>
60579 </indexterm>
60580 Each of these applies to any subsequent items on the list. For example:
60581 </para>
60582 <literallayout class="monospaced">
60583 deny dnslists = +defer_unknown : foo.bar.example
60584 </literallayout>
60585 <para>
60586 Testing the list of domains stops as soon as a match is found. If you want to
60587 warn for one list and block for another, you can use two different statements:
60588 </para>
60589 <literallayout class="monospaced">
60590 deny  dnslists = blackholes.mail-abuse.org
60591 warn  dnslists = dialups.mail-abuse.org
60592       message  = X-Warn: sending host is on dialups list
60593 </literallayout>
60594 <para>
60595 <indexterm role="concept">
60596 <primary>caching</primary>
60597 <secondary>of dns lookup</secondary>
60598 </indexterm>
60599 <indexterm role="concept">
60600 <primary>DNS</primary>
60601 <secondary>TTL</secondary>
60602 </indexterm>
60603 DNS list lookups are cached by Exim for the duration of the SMTP session
60604 (but limited by the DNS return TTL value),
60605 so a lookup based on the IP address is done at most once for any incoming
60606 connection (assuming long-enough TTL).
60607 Exim does not share information between multiple incoming
60608 connections (but your local name server cache should be active).
60609 </para>
60610 <para>
60611 There are a number of DNS lists to choose from, some commercial, some free,
60612 or free for small deployments.  An overview can be found at
60613 <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>.
60614 </para>
60615 </section>
60616 <section id="SECID201">
60617 <title>Specifying the IP address for a DNS list lookup</title>
60618 <para>
60619 <indexterm role="concept">
60620 <primary>DNS list</primary>
60621 <secondary>keyed by explicit IP address</secondary>
60622 </indexterm>
60623 By default, the IP address that is used in a DNS list lookup is the IP address
60624 of the calling host. However, you can specify another IP address by listing it
60625 after the domain name, introduced by a slash. For example:
60626 </para>
60627 <literallayout class="monospaced">
60628 deny dnslists = black.list.tld/192.168.1.2
60629 </literallayout>
60630 <para>
60631 This feature is not very helpful with explicit IP addresses; it is intended for
60632 use with IP addresses that are looked up, for example, the IP addresses of the
60633 MX hosts or nameservers of an email sender address. For an example, see section
60634 <xref linkend="SECTmulkeyfor"/> below.
60635 </para>
60636 </section>
60637 <section id="SECID202">
60638 <title>DNS lists keyed on domain names</title>
60639 <para>
60640 <indexterm role="concept">
60641 <primary>DNS list</primary>
60642 <secondary>keyed by domain name</secondary>
60643 </indexterm>
60644 There are some lists that are keyed on domain names rather than inverted IP
60645 addresses (see, e.g., the <emphasis>domain based zones</emphasis> link at
60646 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
60647 with these lists. You can change the name that is looked up in a DNS list by
60648 listing it after the domain name, introduced by a slash. For example,
60649 </para>
60650 <literallayout class="monospaced">
60651 deny  dnslists = dsn.rfc-ignorant.org/$sender_address_domain
60652       message  = Sender's domain is listed at $dnslist_domain
60653 </literallayout>
60654 <para>
60655 This particular example is useful only in ACLs that are obeyed after the
60656 RCPT or DATA commands, when a sender address is available. If (for
60657 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
60658 up by this example is
60659 </para>
60660 <literallayout class="monospaced">
60661 tld.example.dsn.rfc-ignorant.org
60662 </literallayout>
60663 <para>
60664 A single <option>dnslists</option> condition can contain entries for both names and IP
60665 addresses. For example:
60666 </para>
60667 <literallayout class="monospaced">
60668 deny dnslists = sbl.spamhaus.org : \
60669                 dsn.rfc-ignorant.org/$sender_address_domain
60670 </literallayout>
60671 <para>
60672 The first item checks the sending host&#x2019;s IP address; the second checks a domain
60673 name. The whole condition is true if either of the DNS lookups succeeds.
60674 </para>
60675 </section>
60676 <section id="SECTmulkeyfor">
60677 <title>Multiple explicit keys for a DNS list</title>
60678 <para>
60679 <indexterm role="concept">
60680 <primary>DNS list</primary>
60681 <secondary>multiple keys for</secondary>
60682 </indexterm>
60683 The syntax described above for looking up explicitly-defined values (either
60684 names or IP addresses) in a DNS blacklist is a simplification. After the domain
60685 name for the DNS list, what follows the slash can in fact be a list of items.
60686 As with all lists in Exim, the default separator is a colon. However, because
60687 this is a sublist within the list of DNS blacklist domains, it is necessary
60688 either to double the separators like this:
60689 </para>
60690 <literallayout class="monospaced">
60691 dnslists = black.list.tld/name.1::name.2
60692 </literallayout>
60693 <para>
60694 or to change the separator character, like this:
60695 </para>
60696 <literallayout class="monospaced">
60697 dnslists = black.list.tld/&lt;;name.1;name.2
60698 </literallayout>
60699 <para>
60700 If an item in the list is an IP address, it is inverted before the DNS
60701 blacklist domain is appended. If it is not an IP address, no inversion
60702 occurs. Consider this condition:
60703 </para>
60704 <literallayout class="monospaced">
60705 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
60706 </literallayout>
60707 <para>
60708 The DNS lookups that occur are:
60709 </para>
60710 <literallayout class="monospaced">
60711 2.1.168.192.black.list.tld
60712 a.domain.black.list.tld
60713 </literallayout>
60714 <para>
60715 Once a DNS record has been found (that matches a specific IP return
60716 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
60717 are done. If there is a temporary DNS error, the rest of the sublist of domains
60718 or IP addresses is tried. A temporary error for the whole dnslists item occurs
60719 only if no other DNS lookup in this sublist succeeds. In other words, a
60720 successful lookup for any of the items in the sublist overrides a temporary
60721 error for a previous item.
60722 </para>
60723 <para>
60724 The ability to supply a list of items after the slash is in some sense just a
60725 syntactic convenience. These two examples have the same effect:
60726 </para>
60727 <literallayout class="monospaced">
60728 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
60729 dnslists = black.list.tld/a.domain::b.domain
60730 </literallayout>
60731 <para>
60732 However, when the data for the list is obtained from a lookup, the second form
60733 is usually much more convenient. Consider this example:
60734 </para>
60735 <literallayout class="monospaced">
60736 deny dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
60737                                    ${lookup dnsdb {&gt;|mxh=\
60738                                    $sender_address_domain} }} }
60739      message  = The mail servers for the domain \
60740                 $sender_address_domain \
60741                 are listed at $dnslist_domain ($dnslist_value); \
60742                 see $dnslist_text.
60743 </literallayout>
60744 <para>
60745 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
60746 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
60747 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
60748 of expanding the condition might be something like this:
60749 </para>
60750 <literallayout class="monospaced">
60751 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
60752 </literallayout>
60753 <para>
60754 Thus, this example checks whether or not the IP addresses of the sender
60755 domain&#x2019;s mail servers are on the Spamhaus black list.
60756 </para>
60757 <para>
60758 The key that was used for a successful DNS list lookup is put into the variable
60759 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
60760 </para>
60761 </section>
60762 <section id="SECID203">
60763 <title>Data returned by DNS lists</title>
60764 <para>
60765 <indexterm role="concept">
60766 <primary>DNS list</primary>
60767 <secondary>data returned from</secondary>
60768 </indexterm>
60769 DNS lists are constructed using address records in the DNS. The original RBL
60770 just used the address 127.0.0.1 on the right hand side of each record, but the
60771 RBL+ list and some other lists use a number of values with different meanings.
60772 The values used on the RBL+ list are:
60773 </para>
60774 <literallayout>
60775 127.1.0.1  RBL
60776 127.1.0.2  DUL
60777 127.1.0.3  DUL and RBL
60778 127.1.0.4  RSS
60779 127.1.0.5  RSS and RBL
60780 127.1.0.6  RSS and DUL
60781 127.1.0.7  RSS and DUL and RBL
60782 </literallayout>
60783 <para>
60784 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
60785 different values. Some DNS lists may return more than one address record;
60786 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
60787 </para>
60788 </section>
60789 <section id="SECID204">
60790 <title>Variables set from DNS lists</title>
60791 <para>
60792 <indexterm role="concept">
60793 <primary>expansion</primary>
60794 <secondary>variables, set from DNS list</secondary>
60795 </indexterm>
60796 <indexterm role="concept">
60797 <primary>DNS list</primary>
60798 <secondary>variables set from</secondary>
60799 </indexterm>
60800 <indexterm role="variable">
60801 <primary><varname>$dnslist_domain</varname></primary>
60802 </indexterm>
60803 <indexterm role="variable">
60804 <primary><varname>$dnslist_matched</varname></primary>
60805 </indexterm>
60806 <indexterm role="variable">
60807 <primary><varname>$dnslist_text</varname></primary>
60808 </indexterm>
60809 <indexterm role="variable">
60810 <primary><varname>$dnslist_value</varname></primary>
60811 </indexterm>
60812 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
60813 the name of the overall domain that matched (for example,
60814 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
60815 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
60816 the DNS record. When the key is an IP address, it is not reversed in
60817 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
60818 cases, for example:
60819 </para>
60820 <literallayout class="monospaced">
60821 deny dnslists = spamhaus.example
60822 </literallayout>
60823 <para>
60824 the key is also available in another variable (in this case,
60825 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
60826 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
60827 might generate a dnslists lookup like this:
60828 </para>
60829 <literallayout class="monospaced">
60830 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
60831 </literallayout>
60832 <para>
60833 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
60834 <literal>192.168.6.7</literal> (for example).
60835 </para>
60836 <para>
60837 If more than one address record is returned by the DNS lookup, all the IP
60838 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
60839 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
60840 record. For lists such as RBL+ the TXT record for a merged entry is often not
60841 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
60842 information.
60843 </para>
60844 <para>
60845 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
60846 &ndash; even if these appear before the condition in the ACL, they are not
60847 expanded until after it has failed. For example:
60848 </para>
60849 <literallayout class="monospaced">
60850 deny    hosts = !+local_networks
60851         message = $sender_host_address is listed \
60852                   at $dnslist_domain
60853         dnslists = rbl-plus.mail-abuse.example
60854 </literallayout>
60855 </section>
60856 <section id="SECTaddmatcon">
60857 <title>Additional matching conditions for DNS lists</title>
60858 <para>
60859 <indexterm role="concept">
60860 <primary>DNS list</primary>
60861 <secondary>matching specific returned data</secondary>
60862 </indexterm>
60863 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
60864 in order to restrict its action to DNS records with a matching right hand side.
60865 For example,
60866 </para>
60867 <literallayout class="monospaced">
60868 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
60869 </literallayout>
60870 <para>
60871 rejects only those hosts that yield 127.0.0.2. Without this additional data,
60872 any address record is considered to be a match. For the moment, we assume
60873 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
60874 describes how multiple records are handled.
60875 </para>
60876 <para>
60877 More than one IP address may be given for checking, using a comma as a
60878 separator. These are alternatives &ndash; if any one of them matches, the
60879 <option>dnslists</option> condition is true. For example:
60880 </para>
60881 <literallayout class="monospaced">
60882 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
60883 </literallayout>
60884 <para>
60885 If you want to specify a constraining address list and also specify names or IP
60886 addresses to be looked up, the constraining address list must be specified
60887 first. For example:
60888 </para>
60889 <literallayout class="monospaced">
60890 deny dnslists = dsn.rfc-ignorant.org\
60891                 =127.0.0.2/$sender_address_domain
60892 </literallayout>
60893 <para>
60894 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
60895 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
60896 In other words, the listed addresses are used as bit masks. The comparison is
60897 true if all the bits in the mask are present in the address that is being
60898 tested. For example:
60899 </para>
60900 <literallayout class="monospaced">
60901 dnslists = a.b.c&amp;0.0.0.3
60902 </literallayout>
60903 <para>
60904 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
60905 want to test whether one bit or another bit is present (as opposed to both
60906 being present), you must use multiple values. For example:
60907 </para>
60908 <literallayout class="monospaced">
60909 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
60910 </literallayout>
60911 <para>
60912 matches if the final component of the address is an odd number or two times
60913 an odd number.
60914 </para>
60915 </section>
60916 <section id="SECID205">
60917 <title>Negated DNS matching conditions</title>
60918 <para>
60919 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
60920 condition. Whereas
60921 </para>
60922 <literallayout class="monospaced">
60923 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
60924 </literallayout>
60925 <para>
60926 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
60927 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
60928 </para>
60929 <literallayout class="monospaced">
60930 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
60931 </literallayout>
60932 <para>
60933 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
60934 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
60935 words, the result of the test is inverted if an exclamation mark appears before
60936 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
60937 </para>
60938 <para>
60939 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
60940 host, or address list (which is why the syntax is different).
60941 </para>
60942 <para>
60943 If you are using just one list, the negation syntax does not gain you much. The
60944 previous example is precisely equivalent to
60945 </para>
60946 <literallayout class="monospaced">
60947 deny  dnslists = a.b.c
60948      !dnslists = a.b.c=127.0.0.2,127.0.0.3
60949 </literallayout>
60950 <para>
60951 However, if you are using multiple lists, the negation syntax is clearer.
60952 Consider this example:
60953 </para>
60954 <literallayout class="monospaced">
60955 deny  dnslists = sbl.spamhaus.org : \
60956                  list.dsbl.org : \
60957                  dnsbl.njabl.org!=127.0.0.3 : \
60958                  relays.ordb.org
60959 </literallayout>
60960 <para>
60961 Using only positive lists, this would have to be:
60962 </para>
60963 <literallayout class="monospaced">
60964 deny  dnslists = sbl.spamhaus.org : \
60965                  list.dsbl.org
60966 deny  dnslists = dnsbl.njabl.org
60967      !dnslists = dnsbl.njabl.org=127.0.0.3
60968 deny  dnslists = relays.ordb.org
60969 </literallayout>
60970 <para>
60971 which is less clear, and harder to maintain.
60972 </para>
60973 </section>
60974 <section id="SECThanmuldnsrec">
60975 <title>Handling multiple DNS records from a DNS list</title>
60976 <para>
60977 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
60978 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
60979 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
60980 the match to specific results from the DNS lookup, there are two ways in which
60981 the checking can be handled. For example, consider the condition:
60982 </para>
60983 <literallayout class="monospaced">
60984 dnslists = a.b.c=127.0.0.1
60985 </literallayout>
60986 <para>
60987 What happens if the DNS lookup for the incoming IP address yields both
60988 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
60989 condition true because at least one given value was found, or is it false
60990 because at least one of the found values was not listed? And how does this
60991 affect negated conditions? Both possibilities are provided for with the help of
60992 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
60993 </para>
60994 <itemizedlist>
60995 <listitem>
60996 <para>
60997 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
60998 IP addresses matches one of the listed addresses. For the example above, the
60999 condition is true because 127.0.0.1 matches.
61000 </para>
61001 </listitem>
61002 <listitem>
61003 <para>
61004 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
61005 looked up IP addresses matches one of the listed addresses. If the condition is
61006 changed to:
61007 </para>
61008 <literallayout class="monospaced">
61009 dnslists = a.b.c==127.0.0.1
61010 </literallayout>
61011 <para>
61012 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61013 false because 127.0.0.2 is not listed. You would need to have:
61014 </para>
61015 <literallayout class="monospaced">
61016 dnslists = a.b.c==127.0.0.1,127.0.0.2
61017 </literallayout>
61018 <para>
61019 for the condition to be true.
61020 </para>
61021 </listitem>
61022 </itemizedlist>
61023 <para>
61024 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
61025 the precise opposite of the behaviour above. Thus:
61026 </para>
61027 <itemizedlist>
61028 <listitem>
61029 <para>
61030 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
61031 addresses matches one of the listed addresses. Consider:
61032 </para>
61033 <literallayout class="monospaced">
61034 dnslists = a.b.c!&amp;0.0.0.1
61035 </literallayout>
61036 <para>
61037 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61038 false because 127.0.0.1 matches.
61039 </para>
61040 </listitem>
61041 <listitem>
61042 <para>
61043 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
61044 looked up IP address that does not match. Consider:
61045 </para>
61046 <literallayout class="monospaced">
61047 dnslists = a.b.c!=&amp;0.0.0.1
61048 </literallayout>
61049 <para>
61050 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61051 true, because 127.0.0.2 does not match. You would need to have:
61052 </para>
61053 <literallayout class="monospaced">
61054 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
61055 </literallayout>
61056 <para>
61057 for the condition to be false.
61058 </para>
61059 </listitem>
61060 </itemizedlist>
61061 <para>
61062 When the DNS lookup yields only a single IP address, there is no difference
61063 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
61064 </para>
61065 </section>
61066 <section id="SECTmordetinf">
61067 <title>Detailed information from merged DNS lists</title>
61068 <para>
61069 <indexterm role="concept">
61070 <primary>DNS list</primary>
61071 <secondary>information from merged</secondary>
61072 </indexterm>
61073 When the facility for restricting the matching IP values in a DNS list is used,
61074 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
61075 the true reason for rejection. This happens when lists are merged and the IP
61076 address in the A record is used to distinguish them; unfortunately there is
61077 only one TXT record. One way round this is not to use merged lists, but that
61078 can be inefficient because it requires multiple DNS lookups where one would do
61079 in the vast majority of cases when the host of interest is not on any of the
61080 lists.
61081 </para>
61082 <para>
61083 A less inefficient way of solving this problem is available. If
61084 two domain names, comma-separated, are given, the second is used first to
61085 do an initial check, making use of any IP value restrictions that are set.
61086 If there is a match, the first domain is used, without any IP value
61087 restrictions, to get the TXT record. As a byproduct of this, there is also
61088 a check that the IP being tested is indeed on the first list. The first
61089 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
61090 </para>
61091 <literallayout class="monospaced">
61092 deny   dnslists = \
61093          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
61094          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
61095        message  = \
61096          rejected because $sender_host_address is blacklisted \
61097          at $dnslist_domain\n$dnslist_text
61098 </literallayout>
61099 <para>
61100 For the first blacklist item, this starts by doing a lookup in
61101 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
61102 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
61103 value, and as long as something is found, it looks for the corresponding TXT
61104 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
61105 The second blacklist item is processed similarly.
61106 </para>
61107 <para>
61108 If you are interested in more than one merged list, the same list must be
61109 given several times, but because the results of the DNS lookups are cached,
61110 the DNS calls themselves are not repeated. For example:
61111 </para>
61112 <literallayout class="monospaced">
61113 deny dnslists = \
61114          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
61115          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
61116          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
61117          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
61118 </literallayout>
61119 <para>
61120 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
61121 values matches (or if no record is found), this is the only lookup that is
61122 done. Only if there is a match is one of the more specific lists consulted.
61123 </para>
61124 </section>
61125 <section id="SECTmorednslistslast">
61126 <title>DNS lists and IPv6</title>
61127 <para>
61128 <indexterm role="concept">
61129 <primary>IPv6</primary>
61130 <secondary>DNS black lists</secondary>
61131 </indexterm>
61132 <indexterm role="concept">
61133 <primary>DNS list</primary>
61134 <secondary>IPv6 usage</secondary>
61135 </indexterm>
61136 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
61137 nibble by nibble. For example, if the calling host&#x2019;s IP address is
61138 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
61139 </para>
61140 <literallayout class="monospaced">
61141 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
61142   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
61143 </literallayout>
61144 <para>
61145 (split over two lines here to fit on the page). Unfortunately, some of the DNS
61146 lists contain wildcard records, intended for IPv4, that interact badly with
61147 IPv6. For example, the DNS entry
61148 </para>
61149 <literallayout class="monospaced">
61150 *.3.some.list.example.    A    127.0.0.1
61151 </literallayout>
61152 <para>
61153 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
61154 Unfortunately, it also matches the entire 3::/4 IPv6 network.
61155 </para>
61156 <para>
61157 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
61158 <option>condition</option> condition, as in this example:
61159 </para>
61160 <literallayout class="monospaced">
61161 deny   condition = ${if isip4{$sender_host_address}}
61162        dnslists  = some.list.example
61163 </literallayout>
61164 <para>
61165 If an explicit key is being used for a DNS lookup and it may be an IPv6
61166 address you should specify alternate list separators for both the outer
61167 (DNS list name) list and inner (lookup keys) list:
61168 </para>
61169 <literallayout class="monospaced">
61170        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
61171 </literallayout>
61172 </section>
61173 <section id="SECTratelimiting">
61174 <title>Rate limiting incoming messages</title>
61175 <para>
61176 <indexterm role="concept">
61177 <primary>rate limiting</primary>
61178 <secondary>client sending</secondary>
61179 </indexterm>
61180 <indexterm role="concept">
61181 <primary>limiting client sending rates</primary>
61182 </indexterm>
61183 <indexterm role="option">
61184 <primary><option>smtp_ratelimit_*</option></primary>
61185 </indexterm>
61186 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
61187 which clients can send email. This is more powerful than the
61188 <option>smtp_ratelimit_*</option> options, because those options control the rate of
61189 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
61190 works across all connections (concurrent and sequential) from the same client
61191 host. The syntax of the <option>ratelimit</option> condition is:
61192 </para>
61193 <literallayout>
61194 <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;
61195 </literallayout>
61196 <para>
61197 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
61198 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
61199 </para>
61200 <para>
61201 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
61202 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
61203 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
61204 of <emphasis>p</emphasis>.
61205 </para>
61206 <para>
61207 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
61208 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
61209 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
61210 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
61211 send in each time interval. It also specifies the number of messages permitted
61212 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
61213 constant, you can allow a client to send more messages in a burst without
61214 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
61215 both small, messages must be sent at an even rate.
61216 </para>
61217 <para>
61218 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
61219 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
61220 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
61221 instructions when it is run with no arguments.
61222 </para>
61223 <para>
61224 The key is used to look up the data for calculating the client&#x2019;s average
61225 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
61226 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
61227 which means Exim computes the sending rate of each client host IP address.
61228 By changing the key you can change how Exim identifies clients for the purpose
61229 of ratelimiting. For example, to limit the sending rate of each authenticated
61230 user, independent of the computer they are sending from, set the key to
61231 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
61232 example, <varname>$authenticated_id</varname> is only meaningful if the client has
61233 authenticated (which you can check with the <option>authenticated</option> ACL condition).
61234 </para>
61235 <para>
61236 The lookup key does not have to identify clients: If you want to limit the
61237 rate at which a recipient receives messages, you can use the key
61238 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
61239 ACL.
61240 </para>
61241 <para>
61242 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
61243 specifies what Exim measures the rate of, for example, messages or recipients
61244 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
61245 <option>count=</option> options. You can also control when Exim updates the recorded rate
61246 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
61247 separated by a slash, like the other parameters. They may appear in any order.
61248 </para>
61249 <para>
61250 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
61251 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
61252 stored, so you can alter the configured maximum rate and Exim will still
61253 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
61254 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
61255 behaviour. The lookup key is not affected by changes to the update mode and
61256 the <option>count=</option> option.
61257 </para>
61258 </section>
61259 <section id="ratoptmea">
61260 <title>Ratelimit options for what is being measured</title>
61261 <para>
61262 <indexterm role="concept">
61263 <primary>rate limiting</primary>
61264 <secondary>per_* options</secondary>
61265 </indexterm>
61266 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
61267 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
61268 <option>acl_not_smtp_start</option> ACLs.
61269 </para>
61270 <para>
61271 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
61272 the default if none of the <option>per_*</option> options is specified. It can be used in
61273 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
61274 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
61275 </para>
61276 <para>
61277 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
61278 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
61279 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
61280 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
61281 in its MAIL command, which may be inaccurate or completely missing. You can
61282 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
61283 in kilobytes, megabytes, or gigabytes, respectively.
61284 </para>
61285 <para>
61286 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
61287 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
61288 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
61289 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
61290 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
61291 in either case the rate limiting engine will see a message with many
61292 recipients as a large high-speed burst.
61293 </para>
61294 <para>
61295 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
61296 number of different recipients that the client has sent messages to in the
61297 last time period. That is, if the client repeatedly sends messages to the same
61298 recipient, its measured rate is not increased. This option can only be used in
61299 <option>acl_smtp_rcpt</option>.
61300 </para>
61301 <para>
61302 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
61303 condition is processed. This can be used to limit the rate of any SMTP
61304 command. If it is used in multiple ACLs it can limit the aggregate rate of
61305 multiple different commands.
61306 </para>
61307 <para>
61308 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
61309 measured rate. For example, the <option>per_byte</option> option is equivalent to
61310 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
61311 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
61312 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
61313 </para>
61314 <para>
61315 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
61316 </para>
61317 </section>
61318 <section id="ratoptupd">
61319 <title>Ratelimit update modes</title>
61320 <para>
61321 <indexterm role="concept">
61322 <primary>rate limiting</primary>
61323 <secondary>reading data without updating</secondary>
61324 </indexterm>
61325 You can specify one of three options with the <option>ratelimit</option> condition to
61326 control when its database is updated. This section describes the <option>readonly</option>
61327 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
61328 </para>
61329 <para>
61330 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
61331 previously-computed rate to check against the limit.
61332 </para>
61333 <para>
61334 For example, you can test the client&#x2019;s sending rate and deny it access (when
61335 it is too fast) in the connect ACL. If the client passes this check then it
61336 can go on to send a message, in which case its recorded rate will be updated
61337 in the MAIL ACL. Subsequent connections from the same client will check this
61338 new rate.
61339 </para>
61340 <literallayout class="monospaced">
61341 acl_check_connect:
61342  deny ratelimit = 100 / 5m / readonly
61343       log_message = RATE CHECK: $sender_rate/$sender_rate_period \
61344                   (max $sender_rate_limit)
61345 # ...
61346 acl_check_mail:
61347  warn ratelimit = 100 / 5m / strict
61348       log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
61349                   (max $sender_rate_limit)
61350 </literallayout>
61351 <para>
61352 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
61353 processing a message then it may increase the client&#x2019;s measured rate more than
61354 it should. For example, this will happen if you check the <option>per_rcpt</option> option
61355 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
61356 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
61357 multiple update problems by using the <option>readonly</option> option on later ratelimit
61358 checks.
61359 </para>
61360 <para>
61361 The <option>per_*</option> options described above do not make sense in some ACLs. If you
61362 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
61363 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
61364 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
61365 next section) so you must specify the <option>readonly</option> option explicitly.
61366 </para>
61367 </section>
61368 <section id="ratoptfast">
61369 <title>Ratelimit options for handling fast clients</title>
61370 <para>
61371 <indexterm role="concept">
61372 <primary>rate limiting</primary>
61373 <secondary>strict and leaky modes</secondary>
61374 </indexterm>
61375 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
61376 engine can react in two possible ways, depending on the presence of the
61377 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
61378 counter-measures (such as rejecting the message) that may be specified by the
61379 rest of the ACL.
61380 </para>
61381 <para>
61382 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
61383 updated if it is above the limit. The effect of this is that Exim measures the
61384 client&#x2019;s average rate of successfully sent email,
61385 up to the given limit.
61386 This is appropriate if the countermeasure when the condition is true
61387 consists of refusing the message, and
61388 is generally the better choice if you have clients that retry automatically.
61389 If the action when true is anything more complex then this option is
61390 likely not what is wanted.
61391 </para>
61392 <para>
61393 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
61394 updated. The effect of this is that Exim measures the client&#x2019;s average rate
61395 of attempts to send email, which can be much higher than the maximum it is
61396 actually allowed. If the client is over the limit it may be subjected to
61397 counter-measures by the ACL. It must slow down and allow sufficient time to
61398 pass that its computed rate falls below the maximum before it can send email
61399 again. The time (the number of smoothing periods) it must wait and not
61400 attempt to send mail can be calculated with this formula:
61401 </para>
61402 <literallayout class="monospaced">
61403         ln(peakrate/maxrate)
61404 </literallayout>
61405 </section>
61406 <section id="ratoptuniq">
61407 <title>Limiting the rate of different events</title>
61408 <para>
61409 <indexterm role="concept">
61410 <primary>rate limiting</primary>
61411 <secondary>counting unique events</secondary>
61412 </indexterm>
61413 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
61414 rate of different events. For example, the <option>per_addr</option> option uses this
61415 mechanism to count the number of different recipients that the client has
61416 sent messages to in the last time period; it is equivalent to
61417 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
61418 measure the rate that a client uses different sender addresses with the
61419 options <literal>per_mail/unique=$sender_address</literal>.
61420 </para>
61421 <para>
61422 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
61423 has seen for that key. The whole set is thrown away when it is older than the
61424 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
61425 per period. In the <option>leaky</option> update mode, an event that causes the client to
61426 go over the limit is not added to the set, in the same way that the client&#x2019;s
61427 recorded rate is not updated in the same situation.
61428 </para>
61429 <para>
61430 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
61431 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
61432 rate.
61433 </para>
61434 <para>
61435 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
61436 other <option>ratelimit</option> options in order to store the event set. The number of
61437 unique values is potentially as large as the rate limit, so the extra space
61438 required increases with larger limits.
61439 </para>
61440 <para>
61441 The uniqueification is not perfect: there is a small probability that Exim
61442 will think a new event has happened before. If the sender&#x2019;s rate is less than
61443 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
61444 the measured rate can go above the limit, in which case Exim may under-count
61445 events by a significant margin. Fortunately, if the rate is high enough (2.7
61446 times the limit) that the false positive rate goes above 9%, then Exim will
61447 throw away the over-full event set before the measured rate falls below the
61448 limit. Therefore the only harm should be that exceptionally high sending rates
61449 are logged incorrectly; any countermeasures you configure will be as effective
61450 as intended.
61451 </para>
61452 </section>
61453 <section id="useratlim">
61454 <title>Using rate limiting</title>
61455 <para>
61456 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
61457 when the rate limit is exceeded. This might be anything from logging a warning
61458 (for example, while measuring existing sending rates in order to define
61459 policy), through time delays to slow down fast senders, up to rejecting the
61460 message. For example:
61461 </para>
61462 <literallayout class="monospaced">
61463 # Log all senders' rates
61464 warn ratelimit = 0 / 1h / strict
61465      log_message = Sender rate $sender_rate / $sender_rate_period
61466
61467 # Slow down fast senders; note the need to truncate $sender_rate
61468 # at the decimal point.
61469 warn ratelimit = 100 / 1h / per_rcpt / strict
61470      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
61471                    $sender_rate_limit }s
61472
61473 # Keep authenticated users under control
61474 deny authenticated = *
61475      ratelimit = 100 / 1d / strict / $authenticated_id
61476
61477 # System-wide rate limit
61478 defer ratelimit = 10 / 1s / $primary_hostname
61479       message = Sorry, too busy. Try again later.
61480
61481 # Restrict incoming rate from each host, with a default
61482 # set using a macro and special cases looked up in a table.
61483 defer ratelimit = ${lookup {$sender_host_address} \
61484                    cdb {DB/ratelimits.cdb} \
61485                    {$value} {RATELIMIT} }
61486       message = Sender rate exceeds $sender_rate_limit \
61487                messages per $sender_rate_period
61488 </literallayout>
61489 <para>
61490 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
61491 especially with the <option>per_rcpt</option> option, you may suffer from a performance
61492 bottleneck caused by locking on the ratelimit hints database. Apart from
61493 making your ACLs less complicated, you can reduce the problem by using a
61494 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
61495 this means that Exim will lose its hints data after a reboot (including retry
61496 hints, the callout cache, and ratelimit data).
61497 </para>
61498 </section>
61499 <section id="SECTaddressverification">
61500 <title>Address verification</title>
61501 <para>
61502 <indexterm role="concept">
61503 <primary>verifying address</primary>
61504 <secondary>options for</secondary>
61505 </indexterm>
61506 <indexterm role="concept">
61507 <primary>policy control</primary>
61508 <secondary>address verification</secondary>
61509 </indexterm>
61510 Several of the <option>verify</option> conditions described in section
61511 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
61512 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
61513 The verification conditions can be followed by options that modify the
61514 verification process. The options are separated from the keyword and from each
61515 other by slashes, and some of them contain parameters. For example:
61516 </para>
61517 <literallayout class="monospaced">
61518 verify = sender/callout
61519 verify = recipient/defer_ok/callout=10s,defer_ok
61520 </literallayout>
61521 <para>
61522 The first stage of address verification, which always happens, is to run the
61523 address through the routers, in <quote>verify mode</quote>. Routers can detect the
61524 difference between verification and routing for delivery, and their actions can
61525 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
61526 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
61527 The available options are as follows:
61528 </para>
61529 <itemizedlist>
61530 <listitem>
61531 <para>
61532 If the <option>callout</option> option is specified, successful routing to one or more
61533 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
61534 check. Callouts and their sub-options are discussed in the next section.
61535 </para>
61536 </listitem>
61537 <listitem>
61538 <para>
61539 If there is a defer error while doing verification routing, the ACL
61540 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
61541 options, the condition is forced to be true instead. Note that this is a main
61542 verification option as well as a suboption for callouts.
61543 </para>
61544 </listitem>
61545 <listitem>
61546 <para>
61547 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
61548 discusses the reporting of sender address verification failures.
61549 </para>
61550 </listitem>
61551 <listitem>
61552 <para>
61553 The <option>success_on_redirect</option> option causes verification always to succeed
61554 immediately after a successful redirection. By default, if a redirection
61555 generates just one address, that address is also verified. See further
61556 discussion in section <xref linkend="SECTredirwhilveri"/>.
61557 </para>
61558 </listitem>
61559 </itemizedlist>
61560 <para>
61561 <indexterm role="concept">
61562 <primary>verifying address</primary>
61563 <secondary>differentiating failures</secondary>
61564 </indexterm>
61565 <indexterm role="variable">
61566 <primary><varname>$recipient_verify_failure</varname></primary>
61567 </indexterm>
61568 <indexterm role="variable">
61569 <primary><varname>$sender_verify_failure</varname></primary>
61570 </indexterm>
61571 <indexterm role="variable">
61572 <primary><varname>$acl_verify_message</varname></primary>
61573 </indexterm>
61574 After an address verification failure, <varname>$acl_verify_message</varname> contains the
61575 error message that is associated with the failure. It can be preserved by
61576 coding like this:
61577 </para>
61578 <literallayout class="monospaced">
61579 warn  !verify = sender
61580        set acl_m0 = $acl_verify_message
61581 </literallayout>
61582 <para>
61583 If you are writing your own custom rejection message or log message when
61584 denying access, you can use this variable to include information about the
61585 verification failure.
61586 </para>
61587 <para>
61588 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
61589 appropriate) contains one of the following words:
61590 </para>
61591 <itemizedlist>
61592 <listitem>
61593 <para>
61594 <option>qualify</option>: The address was unqualified (no domain), and the message
61595 was neither local nor came from an exempted host.
61596 </para>
61597 </listitem>
61598 <listitem>
61599 <para>
61600 <option>route</option>: Routing failed.
61601 </para>
61602 </listitem>
61603 <listitem>
61604 <para>
61605 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
61606 occurred at or before the MAIL command (that is, on initial
61607 connection, HELO, or MAIL).
61608 </para>
61609 </listitem>
61610 <listitem>
61611 <para>
61612 <option>recipient</option>: The RCPT command in a callout was rejected.
61613 </para>
61614 </listitem>
61615 <listitem>
61616 <para>
61617 <option>postmaster</option>: The postmaster check in a callout was rejected.
61618 </para>
61619 </listitem>
61620 </itemizedlist>
61621 <para>
61622 The main use of these variables is expected to be to distinguish between
61623 rejections of MAIL and rejections of RCPT in callouts.
61624 </para>
61625 <para>
61626 The above variables may also be set after a <emphasis role="bold">successful</emphasis>
61627 address verification to:
61628 </para>
61629 <itemizedlist>
61630 <listitem>
61631 <para>
61632 <option>random</option>: A random local-part callout succeeded
61633 </para>
61634 </listitem>
61635 </itemizedlist>
61636 </section>
61637 <section id="SECTcallver">
61638 <title>Callout verification</title>
61639 <para>
61640 <indexterm role="concept">
61641 <primary>verifying address</primary>
61642 <secondary>by callout</secondary>
61643 </indexterm>
61644 <indexterm role="concept">
61645 <primary>callout</primary>
61646 <secondary>verification</secondary>
61647 </indexterm>
61648 <indexterm role="concept">
61649 <primary>SMTP</primary>
61650 <secondary>callout verification</secondary>
61651 </indexterm>
61652 For non-local addresses, routing verifies the domain, but is unable to do any
61653 checking of the local part. There are situations where some means of verifying
61654 the local part is desirable. One way this can be done is to make an SMTP
61655 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
61656 a subsequent host for a recipient address, to see if the host accepts the
61657 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
61658 sender address, the callback is not to the client host that is trying to
61659 deliver the message, but to one of the hosts that accepts incoming mail for the
61660 sender&#x2019;s domain.
61661 </para>
61662 <para>
61663 Exim does not do callouts by default. If you want them to happen, you must
61664 request them by setting appropriate options on the <option>verify</option> condition, as
61665 described below. This facility should be used with care, because it can add a
61666 lot of resource usage to the cost of verifying an address. However, Exim does
61667 cache the results of callouts, which helps to reduce the cost. Details of
61668 caching are in section <xref linkend="SECTcallvercache"/>.
61669 </para>
61670 <para>
61671 Recipient callouts are usually used only between hosts that are controlled by
61672 the same administration. For example, a corporate gateway host could use
61673 callouts to check for valid recipients on an internal mailserver. A successful
61674 callout does not guarantee that a real delivery to the address would succeed;
61675 on the other hand, a failing callout does guarantee that a delivery would fail.
61676 </para>
61677 <para>
61678 If the <option>callout</option> option is present on a condition that verifies an address, a
61679 second stage of verification occurs if the address is successfully routed to
61680 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
61681 <command>manualroute</command> router, where the router specifies the hosts. However, if a
61682 router that does not set up hosts routes to an <command>smtp</command> transport with a
61683 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
61684 <option>hosts_override</option> set, its hosts are always used, whether or not the router
61685 supplies a host list.
61686 Callouts are only supported on <command>smtp</command> transports.
61687 </para>
61688 <para>
61689 The port that is used is taken from the transport, if it is specified and is a
61690 remote transport. (For routers that do verification only, no transport need be
61691 specified.) Otherwise, the default SMTP port is used. If a remote transport
61692 specifies an outgoing interface, this is used; otherwise the interface is not
61693 specified. Likewise, the text that is used for the HELO command is taken from
61694 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
61695 <varname>$smtp_active_hostname</varname> is used.
61696 </para>
61697 <para>
61698 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
61699 test whether a bounce message could be delivered to the sender address. The
61700 following SMTP commands are sent:
61701 </para>
61702 <literallayout>
61703 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
61704 <literal>MAIL FROM:&lt;&gt;</literal>
61705 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
61706 <literal>QUIT</literal>
61707 </literallayout>
61708 <para>
61709 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
61710 set to <quote>lmtp</quote>.
61711 </para>
61712 <para>
61713 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
61714 settings.
61715 </para>
61716 <para>
61717 A recipient callout check is similar. By default, it also uses an empty address
61718 for the sender. This default is chosen because most hosts do not make use of
61719 the sender address when verifying a recipient. Using the same address means
61720 that a single cache entry can be used for each recipient. Some sites, however,
61721 do make use of the sender address when verifying. These are catered for by the
61722 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
61723 </para>
61724 <para>
61725 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
61726 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
61727 Exim tries the next host, if any. If there is a problem with all the remote
61728 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
61729 <option>callout</option> option is given, in which case the condition is forced to succeed.
61730 </para>
61731 <para>
61732 <indexterm role="concept">
61733 <primary>SMTP</primary>
61734 <secondary>output flushing, disabling for callout</secondary>
61735 </indexterm>
61736 A callout may take a little time. For this reason, Exim normally flushes SMTP
61737 output before performing a callout in an ACL, to avoid unexpected timeouts in
61738 clients when the SMTP PIPELINING extension is in use. The flushing can be
61739 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
61740 </para>
61741 </section>
61742 <section id="CALLaddparcall">
61743 <title>Additional parameters for callouts</title>
61744 <para>
61745 <indexterm role="concept">
61746 <primary>callout</primary>
61747 <secondary>additional parameters for</secondary>
61748 </indexterm>
61749 The <option>callout</option> option can be followed by an equals sign and a number of
61750 optional parameters, separated by commas. For example:
61751 </para>
61752 <literallayout class="monospaced">
61753 verify = recipient/callout=10s,defer_ok
61754 </literallayout>
61755 <para>
61756 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
61757 separate verify options, is retained for backwards compatibility, but is now
61758 deprecated. The additional parameters for <option>callout</option> are as follows:
61759 </para>
61760 <variablelist>
61761 <varlistentry>
61762 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
61763 <listitem>
61764 <para>
61765 <indexterm role="concept">
61766 <primary>callout</primary>
61767 <secondary>timeout, specifying</secondary>
61768 </indexterm>
61769 This specifies the timeout that applies for the callout attempt to each host.
61770 For example:
61771 </para>
61772 <literallayout class="monospaced">
61773 verify = sender/callout=5s
61774 </literallayout>
61775 <para>
61776 The default is 30 seconds. The timeout is used for each response from the
61777 remote host. It is also used for the initial connection, unless overridden by
61778 the <option>connect</option> parameter.
61779 </para>
61780 </listitem></varlistentry>
61781 <varlistentry>
61782 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
61783 <listitem>
61784 <para>
61785 <indexterm role="concept">
61786 <primary>callout</primary>
61787 <secondary>connection timeout, specifying</secondary>
61788 </indexterm>
61789 This parameter makes it possible to set a different (usually smaller) timeout
61790 for making the SMTP connection. For example:
61791 </para>
61792 <literallayout class="monospaced">
61793 verify = sender/callout=5s,connect=1s
61794 </literallayout>
61795 <para>
61796 If not specified, this timeout defaults to the general timeout value.
61797 </para>
61798 </listitem></varlistentry>
61799 <varlistentry>
61800 <term><emphasis role="bold">defer_ok</emphasis></term>
61801 <listitem>
61802 <para>
61803 <indexterm role="concept">
61804 <primary>callout</primary>
61805 <secondary>defer, action on</secondary>
61806 </indexterm>
61807 When this parameter is present, failure to contact any host, or any other kind
61808 of temporary error, is treated as success by the ACL. However, the cache is not
61809 updated in this circumstance.
61810 </para>
61811 </listitem></varlistentry>
61812 <varlistentry>
61813 <term><emphasis role="bold">fullpostmaster</emphasis></term>
61814 <listitem>
61815 <para>
61816 <indexterm role="concept">
61817 <primary>callout</primary>
61818 <secondary>full postmaster check</secondary>
61819 </indexterm>
61820 This operates like the <option>postmaster</option> option (see below), but if the check for
61821 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
61822 accordance with the specification in RFC 2821. The RFC states that the
61823 unqualified address <emphasis>postmaster</emphasis> should be accepted.
61824 </para>
61825 </listitem></varlistentry>
61826 <varlistentry>
61827 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
61828 <listitem>
61829 <para>
61830 <indexterm role="concept">
61831 <primary>callout</primary>
61832 <secondary>sender when verifying header</secondary>
61833 </indexterm>
61834 When verifying addresses in header lines using the <option>header_sender</option>
61835 verification option, Exim behaves by default as if the addresses are envelope
61836 sender addresses from a message. Callout verification therefore tests to see
61837 whether a bounce message could be delivered, by using an empty address in the
61838 MAIL command. However, it is arguable that these addresses might never be used
61839 as envelope senders, and could therefore justifiably reject bounce messages
61840 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
61841 address to use in the MAIL command. For example:
61842 </para>
61843 <literallayout class="monospaced">
61844 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
61845 </literallayout>
61846 <para>
61847 This parameter is available only for the <option>header_sender</option> verification option.
61848 </para>
61849 </listitem></varlistentry>
61850 <varlistentry>
61851 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
61852 <listitem>
61853 <para>
61854 <indexterm role="concept">
61855 <primary>callout</primary>
61856 <secondary>overall timeout, specifying</secondary>
61857 </indexterm>
61858 This parameter sets an overall timeout for performing a callout verification.
61859 For example:
61860 </para>
61861 <literallayout class="monospaced">
61862 verify = sender/callout=5s,maxwait=30s
61863 </literallayout>
61864 <para>
61865 This timeout defaults to four times the callout timeout for individual SMTP
61866 commands. The overall timeout applies when there is more than one host that can
61867 be tried. The timeout is checked before trying the next host. This prevents
61868 very long delays if there are a large number of hosts and all are timing out
61869 (for example, when network connections are timing out).
61870 </para>
61871 </listitem></varlistentry>
61872 <varlistentry>
61873 <term><emphasis role="bold">no_cache</emphasis></term>
61874 <listitem>
61875 <para>
61876 <indexterm role="concept">
61877 <primary>callout</primary>
61878 <secondary>cache, suppressing</secondary>
61879 </indexterm>
61880 <indexterm role="concept">
61881 <primary>caching callout, suppressing</primary>
61882 </indexterm>
61883 When this parameter is given, the callout cache is neither read nor updated.
61884 </para>
61885 </listitem></varlistentry>
61886 <varlistentry>
61887 <term><emphasis role="bold">postmaster</emphasis></term>
61888 <listitem>
61889 <para>
61890 <indexterm role="concept">
61891 <primary>callout</primary>
61892 <secondary>postmaster; checking</secondary>
61893 </indexterm>
61894 When this parameter is set, a successful callout check is followed by a similar
61895 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
61896 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
61897 the postmaster check is recorded in a cache record; if it is a failure, this is
61898 used to fail subsequent callouts for the domain without a connection being
61899 made, until the cache record expires.
61900 </para>
61901 </listitem></varlistentry>
61902 <varlistentry>
61903 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
61904 <listitem>
61905 <para>
61906 The postmaster check uses an empty sender in the MAIL command by default.
61907 You can use this parameter to do a postmaster check using a different address.
61908 For example:
61909 </para>
61910 <literallayout class="monospaced">
61911 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
61912 </literallayout>
61913 <para>
61914 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
61915 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
61916 </para>
61917 <literallayout class="monospaced">
61918 require  verify = sender/callout=postmaster_mailfrom=
61919 </literallayout>
61920 <para>
61921 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
61922 account of the sender address. It is assumed that either the empty address or
61923 a fixed non-empty address will be used. All that Exim remembers is that the
61924 postmaster check for the domain succeeded or failed.
61925 </para>
61926 </listitem></varlistentry>
61927 <varlistentry>
61928 <term><emphasis role="bold">random</emphasis></term>
61929 <listitem>
61930 <para>
61931 <indexterm role="concept">
61932 <primary>callout</primary>
61933 <secondary><quote>random</quote> check</secondary>
61934 </indexterm>
61935 When this parameter is set, before doing the normal callout check, Exim does a
61936 check for a <quote>random</quote> local part at the same domain. The local part is not
61937 really random &ndash; it is defined by the expansion of the option
61938 <option>callout_random_local_part</option>, which defaults to
61939 </para>
61940 <literallayout class="monospaced">
61941 $primary_hostname-$tod_epoch-testing
61942 </literallayout>
61943 <para>
61944 The idea here is to try to determine whether the remote host accepts all local
61945 parts without checking. If it does, there is no point in doing callouts for
61946 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
61947 a cache record, and used to force the current and subsequent callout checks to
61948 succeed without a connection being made, until the cache record expires.
61949 </para>
61950 </listitem></varlistentry>
61951 <varlistentry>
61952 <term><emphasis role="bold">use_postmaster</emphasis></term>
61953 <listitem>
61954 <para>
61955 <indexterm role="concept">
61956 <primary>callout</primary>
61957 <secondary>sender for recipient check</secondary>
61958 </indexterm>
61959 This parameter applies to recipient callouts only. For example:
61960 </para>
61961 <literallayout class="monospaced">
61962 deny  !verify = recipient/callout=use_postmaster
61963 </literallayout>
61964 <para>
61965 <indexterm role="variable">
61966 <primary><varname>$qualify_domain</varname></primary>
61967 </indexterm>
61968 It causes a non-empty postmaster address to be used in the MAIL command when
61969 performing the callout for the recipient, and also for a <quote>random</quote> check if
61970 that is configured. The local part of the address is <literal>postmaster</literal> and the
61971 domain is the contents of <varname>$qualify_domain</varname>.
61972 </para>
61973 </listitem></varlistentry>
61974 <varlistentry>
61975 <term><emphasis role="bold">use_sender</emphasis></term>
61976 <listitem>
61977 <para>
61978 This option applies to recipient callouts only. For example:
61979 </para>
61980 <literallayout class="monospaced">
61981 require  verify = recipient/callout=use_sender
61982 </literallayout>
61983 <para>
61984 It causes the message&#x2019;s actual sender address to be used in the MAIL
61985 command when performing the callout, instead of an empty address. There is no
61986 need to use this option unless you know that the called hosts make use of the
61987 sender when checking recipients. If used indiscriminately, it reduces the
61988 usefulness of callout caching.
61989 </para>
61990 </listitem></varlistentry>
61991 <varlistentry>
61992 <term><emphasis role="bold">hold</emphasis></term>
61993 <listitem>
61994 <para>
61995 This option applies to recipient callouts only. For example:
61996 </para>
61997 <literallayout class="monospaced">
61998 require  verify = recipient/callout=use_sender,hold
61999 </literallayout>
62000 <para>
62001 It causes the connection to be held open and used for any further recipients
62002 and for eventual delivery (should that be done quickly).
62003 Doing this saves on TCP and SMTP startup costs, and TLS costs also
62004 when that is used for the connections.
62005 The advantage is only gained if there are no callout cache hits
62006 (which could be enforced by the no_cache option),
62007 if the use_sender option is used,
62008 if neither the random nor the use_postmaster option is used,
62009 and if no other callouts intervene.
62010 </para>
62011 </listitem></varlistentry>
62012 </variablelist>
62013 <para>
62014 If you use any of the parameters that set a non-empty sender for the MAIL
62015 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
62016 <option>use_sender</option>), you should think about possible loops. Recipient checking is
62017 usually done between two hosts that are under the same management, and the host
62018 that receives the callouts is not normally configured to do callouts itself.
62019 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
62020 these circumstances.
62021 </para>
62022 <para>
62023 However, if you use a non-empty sender address for a callout to an arbitrary
62024 host, there is the likelihood that the remote host will itself initiate a
62025 callout check back to your host. As it is checking what appears to be a message
62026 sender, it is likely to use an empty address in MAIL, thus avoiding a
62027 callout loop. However, to be on the safe side it would be best to set up your
62028 own ACLs so that they do not do sender verification checks when the recipient
62029 is the address you use for header sender or postmaster callout checking.
62030 </para>
62031 <para>
62032 Another issue to think about when using non-empty senders for callouts is
62033 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
62034 by the sender/recipient combination; thus, for any given recipient, many more
62035 actual callouts are performed than when an empty sender or postmaster is used.
62036 </para>
62037 </section>
62038 <section id="SECTcallvercache">
62039 <title>Callout caching</title>
62040 <para>
62041 <indexterm role="concept">
62042 <primary>hints database</primary>
62043 <secondary>callout cache</secondary>
62044 </indexterm>
62045 <indexterm role="concept">
62046 <primary>callout</primary>
62047 <secondary>cache, description of</secondary>
62048 </indexterm>
62049 <indexterm role="concept">
62050 <primary>caching</primary>
62051 <secondary>callout</secondary>
62052 </indexterm>
62053 Exim caches the results of callouts in order to reduce the amount of resources
62054 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
62055 option. A hints database called <quote>callout</quote> is used for the cache. Two
62056 different record types are used: one records the result of a callout check for
62057 a specific address, and the other records information that applies to the
62058 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
62059 </para>
62060 <para>
62061 When an original callout fails, a detailed SMTP error message is given about
62062 the failure. However, for subsequent failures use the cache data, this message
62063 is not available.
62064 </para>
62065 <para>
62066 The expiry times for negative and positive address cache records are
62067 independent, and can be set by the global options <option>callout_negative_expire</option>
62068 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
62069 </para>
62070 <para>
62071 If a host gives a negative response to an SMTP connection, or rejects any
62072 commands up to and including
62073 </para>
62074 <literallayout class="monospaced">
62075 MAIL FROM:&lt;&gt;
62076 </literallayout>
62077 <para>
62078 (but not including the MAIL command with a non-empty address),
62079 any callout attempt is bound to fail. Exim remembers such failures in a
62080 domain cache record, which it uses to fail callouts for the domain without
62081 making new connections, until the domain record times out. There are two
62082 separate expiry times for domain cache records:
62083 <option>callout_domain_negative_expire</option> (default 3h) and
62084 <option>callout_domain_positive_expire</option> (default 7d).
62085 </para>
62086 <para>
62087 Domain records expire when the negative expiry time is reached if callouts
62088 cannot be made for the domain, or if the postmaster check failed.
62089 Otherwise, they expire when the positive expiry time is reached. This
62090 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
62091 will eventually be noticed.
62092 </para>
62093 <para>
62094 The callout caching mechanism is based on the domain of the address that is
62095 being tested. If the domain routes to several hosts, it is assumed that their
62096 behaviour will be the same.
62097 </para>
62098 </section>
62099 <section id="SECTsenaddver">
62100 <title>Sender address verification reporting</title>
62101 <para>
62102 <indexterm role="concept">
62103 <primary>verifying</primary>
62104 <secondary>suppressing error details</secondary>
62105 </indexterm>
62106 See section <xref linkend="SECTaddressverification"/> for a general discussion of
62107 verification. When sender verification fails in an ACL, the details of the
62108 failure are given as additional output lines before the 550 response to the
62109 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
62110 you might see:
62111 </para>
62112 <literallayout class="monospaced">
62113 MAIL FROM:&lt;xyz@abc.example&gt;
62114 250 OK
62115 RCPT TO:&lt;pqr@def.example&gt;
62116 550-Verification failed for &lt;xyz@abc.example&gt;
62117 550-Called:   192.168.34.43
62118 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
62119 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
62120 550 Sender verification failed
62121 </literallayout>
62122 <para>
62123 If more than one RCPT command fails in the same way, the details are given
62124 only for the first of them. However, some administrators do not want to send
62125 out this much information. You can suppress the details by adding
62126 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
62127 example:
62128 </para>
62129 <literallayout class="monospaced">
62130 verify = sender/no_details
62131 </literallayout>
62132 </section>
62133 <section id="SECTredirwhilveri">
62134 <title>Redirection while verifying</title>
62135 <para>
62136 <indexterm role="concept">
62137 <primary>verifying</primary>
62138 <secondary>redirection while</secondary>
62139 </indexterm>
62140 <indexterm role="concept">
62141 <primary>address redirection</primary>
62142 <secondary>while verifying</secondary>
62143 </indexterm>
62144 A dilemma arises when a local address is redirected by aliasing or forwarding
62145 during verification: should the generated addresses themselves be verified,
62146 or should the successful expansion of the original address be enough to verify
62147 it? By default, Exim takes the following pragmatic approach:
62148 </para>
62149 <itemizedlist>
62150 <listitem>
62151 <para>
62152 When an incoming address is redirected to just one child address, verification
62153 continues with the child address, and if that fails to verify, the original
62154 verification also fails.
62155 </para>
62156 </listitem>
62157 <listitem>
62158 <para>
62159 When an incoming address is redirected to more than one child address,
62160 verification does not continue. A success result is returned.
62161 </para>
62162 </listitem>
62163 </itemizedlist>
62164 <para>
62165 This seems the most reasonable behaviour for the common use of aliasing as a
62166 way of redirecting different local parts to the same mailbox. It means, for
62167 example, that a pair of alias entries of the form
62168 </para>
62169 <literallayout class="monospaced">
62170 A.Wol:   aw123
62171 aw123:   :fail: Gone away, no forwarding address
62172 </literallayout>
62173 <para>
62174 work as expected, with both local parts causing verification failure. When a
62175 redirection generates more than one address, the behaviour is more like a
62176 mailing list, where the existence of the alias itself is sufficient for
62177 verification to succeed.
62178 </para>
62179 <para>
62180 It is possible, however, to change the default behaviour so that all successful
62181 redirections count as successful verifications, however many new addresses are
62182 generated. This is specified by the <option>success_on_redirect</option> verification
62183 option. For example:
62184 </para>
62185 <literallayout class="monospaced">
62186 require verify = recipient/success_on_redirect/callout=10s
62187 </literallayout>
62188 <para>
62189 In this example, verification succeeds if a router generates a new address, and
62190 the callout does not occur, because no address was routed to a remote host.
62191 </para>
62192 <para>
62193 When verification is being tested via the <option>-bv</option> option, the treatment of
62194 redirections is as just described, unless the <option>-v</option> or any debugging option is
62195 also specified. In that case, full verification is done for every generated
62196 address and a report is output for each of them.
62197 </para>
62198 </section>
62199 <section id="SECTverifyCSA">
62200 <title>Client SMTP authorization (CSA)</title>
62201 <para>
62202 <indexterm role="concept">
62203 <primary>CSA</primary>
62204 <secondary>verifying</secondary>
62205 </indexterm>
62206 Client SMTP Authorization is a system that allows a site to advertise
62207 which machines are and are not permitted to send email. This is done by placing
62208 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
62209 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
62210 Authorization checks in Exim are performed by the ACL condition:
62211 </para>
62212 <literallayout class="monospaced">
62213 verify = csa
62214 </literallayout>
62215 <para>
62216 This fails if the client is not authorized. If there is a DNS problem, or if no
62217 valid CSA SRV record is found, or if the client is authorized, the condition
62218 succeeds. These three cases can be distinguished using the expansion variable
62219 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
62220 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
62221 be likely to cause problems for legitimate email.
62222 </para>
62223 <para>
62224 The error messages produced by the CSA code include slightly more
62225 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
62226 looking up the CSA SRV record, or problems looking up the CSA target
62227 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
62228 </para>
62229 <itemizedlist>
62230 <listitem>
62231 <para>
62232 The client&#x2019;s host name is explicitly not authorized.
62233 </para>
62234 </listitem>
62235 <listitem>
62236 <para>
62237 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
62238 </para>
62239 </listitem>
62240 <listitem>
62241 <para>
62242 The client&#x2019;s host name is authorized but it has no valid target IP addresses
62243 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
62244 </para>
62245 </listitem>
62246 <listitem>
62247 <para>
62248 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
62249 that all subdomains must be explicitly authorized.
62250 </para>
62251 </listitem>
62252 </itemizedlist>
62253 <para>
62254 The <option>csa</option> verification condition can take an argument which is the domain to
62255 use for the DNS query. The default is:
62256 </para>
62257 <literallayout class="monospaced">
62258 verify = csa/$sender_helo_name
62259 </literallayout>
62260 <para>
62261 This implementation includes an extension to CSA. If the query domain
62262 is an address literal such as [192.0.2.95], or if it is a bare IP
62263 address, Exim searches for CSA SRV records in the reverse DNS as if
62264 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
62265 meaningful to say:
62266 </para>
62267 <literallayout class="monospaced">
62268 verify = csa/$sender_host_address
62269 </literallayout>
62270 <para>
62271 In fact, this is the check that Exim performs if the client does not say HELO.
62272 This extension can be turned off by setting the main configuration option
62273 <option>dns_csa_use_reverse</option> to be false.
62274 </para>
62275 <para>
62276 If a CSA SRV record is not found for the domain itself, a search
62277 is performed through its parent domains for a record which might be
62278 making assertions about subdomains. The maximum depth of this search is limited
62279 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
62280 default. Exim does not look for CSA SRV records in a top level domain, so the
62281 default settings handle HELO domains as long as seven
62282 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
62283 of legitimate HELO domains.
62284 </para>
62285 <para>
62286 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
62287 direct SRV lookups, this is not sufficient because of the extra parent domain
62288 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
62289 addresses into lookups in the reverse DNS space. The result of a successful
62290 lookup such as:
62291 </para>
62292 <literallayout class="monospaced">
62293 ${lookup dnsdb {csa=$sender_helo_name}}
62294 </literallayout>
62295 <para>
62296 has two space-separated fields: an authorization code and a target host name.
62297 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
62298 authorization required but absent, or <quote>?</quote> for unknown.
62299 </para>
62300 </section>
62301 <section id="SECTverifyPRVS">
62302 <title>Bounce address tag validation</title>
62303 <para>
62304 <indexterm role="concept">
62305 <primary>BATV, verifying</primary>
62306 </indexterm>
62307 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
62308 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
62309 Genuine incoming bounce messages should therefore always be addressed to
62310 recipients that have a valid tag. This scheme is a way of detecting unwanted
62311 bounce messages caused by sender address forgeries (often called <quote>collateral
62312 spam</quote>), because the recipients of such messages do not include valid tags.
62313 </para>
62314 <para>
62315 There are two expansion items to help with the implementation of the BATV
62316 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
62317 the original envelope sender address by using a simple key to add a hash of the
62318 address and some time-based randomizing information. The <option>prvs</option> expansion
62319 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
62320 The syntax of these expansion items is described in section
62321 <xref linkend="SECTexpansionitems"/>.
62322 The validity period on signed addresses is seven days.
62323 </para>
62324 <para>
62325 As an example, suppose the secret per-address keys are stored in an MySQL
62326 database. A query to look up the key for an address could be defined as a macro
62327 like this:
62328 </para>
62329 <literallayout class="monospaced">
62330 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
62331                 WHERE sender='${quote_mysql:$prvscheck_address}'\
62332                 }{$value}}
62333 </literallayout>
62334 <para>
62335 Suppose also that the senders who make use of BATV are defined by an address
62336 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
62337 use this:
62338 </para>
62339 <literallayout class="monospaced">
62340 # Bounces: drop unsigned addresses for BATV senders
62341 deny senders = :
62342      recipients = +batv_senders
62343      message = This address does not send an unsigned reverse path
62344
62345 # Bounces: In case of prvs-signed address, check signature.
62346 deny senders = :
62347      condition  = ${prvscheck {$local_part@$domain}\
62348                   {PRVSCHECK_SQL}{1}}
62349      !condition = $prvscheck_result
62350      message = Invalid reverse path signature.
62351 </literallayout>
62352 <para>
62353 The first statement rejects recipients for bounce messages that are addressed
62354 to plain BATV sender addresses, because it is known that BATV senders do not
62355 send out messages with plain sender addresses. The second statement rejects
62356 recipients that are prvs-signed, but with invalid signatures (either because
62357 the key is wrong, or the signature has timed out).
62358 </para>
62359 <para>
62360 A non-prvs-signed address is not rejected by the second statement, because the
62361 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
62362 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
62363 the first argument is a syntactically valid prvs-signed address, the yield is
62364 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
62365 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
62366 of the checks (empty for failure, <quote>1</quote> for success).
62367 </para>
62368 <para>
62369 There is one more issue you must consider when implementing prvs-signing:
62370 you have to ensure that the routers accept prvs-signed addresses and
62371 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
62372 router to remove the signature with a configuration along these lines:
62373 </para>
62374 <literallayout class="monospaced">
62375 batv_redirect:
62376   driver = redirect
62377   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
62378 </literallayout>
62379 <para>
62380 This works because, if the third argument of <option>prvscheck</option> is empty, the result
62381 of the expansion of a prvs-signed address is the decoded value of the original
62382 address. This router should probably be the first of your routers that handles
62383 local addresses.
62384 </para>
62385 <para>
62386 To create BATV-signed addresses in the first place, a transport of this form
62387 can be used:
62388 </para>
62389 <literallayout class="monospaced">
62390 external_smtp_batv:
62391   driver = smtp
62392   return_path = ${prvs {$return_path} \
62393                        {${lookup mysql{SELECT \
62394                        secret FROM batv_prvs WHERE \
62395                        sender='${quote_mysql:$sender_address}'} \
62396                        {$value}fail}}}
62397 </literallayout>
62398 <para>
62399 If no key can be found for the existing return path, no signing takes place.
62400 </para>
62401 </section>
62402 <section id="SECTrelaycontrol">
62403 <title>Using an ACL to control relaying</title>
62404 <para>
62405 <indexterm role="concept">
62406 <primary>access control lists (ACLs)</primary>
62407 <secondary>relay control</secondary>
62408 </indexterm>
62409 <indexterm role="concept">
62410 <primary>relaying</primary>
62411 <secondary>control by ACL</secondary>
62412 </indexterm>
62413 <indexterm role="concept">
62414 <primary>policy control</primary>
62415 <secondary>relay control</secondary>
62416 </indexterm>
62417 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
62418 delivers it directly to another host as a result of a remote address contained
62419 within it. Redirecting a local address via an alias or forward file and then
62420 passing the message on to another host is not relaying,
62421 <indexterm role="concept">
62422 <primary><quote>percent hack</quote></primary>
62423 </indexterm>
62424 but a redirection as a result of the <quote>percent hack</quote> is.
62425 </para>
62426 <para>
62427 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
62428 A host which is acting as a gateway or an MX backup is concerned with incoming
62429 relaying from arbitrary hosts to a specific set of domains. On the other hand,
62430 a host which is acting as a smart host for a number of clients is concerned
62431 with outgoing relaying from those clients to the Internet at large. Often the
62432 same host is fulfilling both functions,
62433 but in principle these two kinds of relaying are entirely independent. What is
62434 not wanted is the transmission of mail from arbitrary remote hosts through your
62435 system to arbitrary domains.
62436 </para>
62437 <para>
62438 You can implement relay control by means of suitable statements in the ACL that
62439 runs for each RCPT command. For convenience, it is often easiest to use
62440 Exim&#x2019;s named list facility to define the domains and hosts involved. For
62441 example, suppose you want to do the following:
62442 </para>
62443 <itemizedlist>
62444 <listitem>
62445 <para>
62446 Deliver a number of domains to mailboxes on the local host (or process them
62447 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
62448 <emphasis>my.dom2.example</emphasis>.
62449 </para>
62450 </listitem>
62451 <listitem>
62452 <para>
62453 Relay mail for a number of other domains for which you are the secondary MX.
62454 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
62455 </para>
62456 </listitem>
62457 <listitem>
62458 <para>
62459 Relay mail from the hosts on your local LAN, to whatever domains are involved.
62460 Suppose your LAN is 192.168.45.0/24.
62461 </para>
62462 </listitem>
62463 </itemizedlist>
62464 <para>
62465 In the main part of the configuration, you put the following definitions:
62466 </para>
62467 <literallayout class="monospaced">
62468 domainlist local_domains    = my.dom1.example : my.dom2.example
62469 domainlist relay_to_domains = friend1.example : friend2.example
62470 hostlist   relay_from_hosts = 192.168.45.0/24
62471 </literallayout>
62472 <para>
62473 Now you can use these definitions in the ACL that is run for every RCPT
62474 command:
62475 </para>
62476 <literallayout class="monospaced">
62477 acl_check_rcpt:
62478   accept domains = +local_domains : +relay_to_domains
62479   accept hosts   = +relay_from_hosts
62480 </literallayout>
62481 <para>
62482 The first statement accepts any RCPT command that contains an address in
62483 the local or relay domains. For any other domain, control passes to the second
62484 statement, which accepts the command only if it comes from one of the relay
62485 hosts. In practice, you will probably want to make your ACL more sophisticated
62486 than this, for example, by including sender and recipient verification. The
62487 default configuration includes a more comprehensive example, which is described
62488 in chapter <xref linkend="CHAPdefconfil"/>.
62489 </para>
62490 </section>
62491 <section id="SECTcheralcon">
62492 <title>Checking a relay configuration</title>
62493 <para>
62494 <indexterm role="concept">
62495 <primary>relaying</primary>
62496 <secondary>checking control of</secondary>
62497 </indexterm>
62498 You can check the relay characteristics of your configuration in the same way
62499 that you can test any ACL behaviour for an incoming SMTP connection, by using
62500 the <option>-bh</option> option to run a fake SMTP session with which you interact.
62501 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
62502 </para>
62503 </section>
62504 </chapter>
62505
62506 <chapter id="CHAPexiscan">
62507 <title>Content scanning at ACL time</title>
62508 <para>
62509 <indexterm role="concept" id="IIDcosca" class="startofrange">
62510 <primary>content scanning</primary>
62511 <secondary>at ACL time</secondary>
62512 </indexterm>
62513 The extension of Exim to include content scanning at ACL time, formerly known
62514 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
62515 was integrated into the main source for Exim release 4.50, and Tom continues to
62516 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
62517 specification.
62518 </para>
62519 <para>
62520 It is also possible to scan the content of messages at other times. The
62521 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
62522 scanning after all the ACLs have run. A transport filter can be used to scan
62523 messages at delivery time (see the <option>transport_filter</option> option, described in
62524 chapter <xref linkend="CHAPtransportgeneric"/>).
62525 </para>
62526 <para>
62527 If you want to include the ACL-time content-scanning features when you compile
62528 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
62529 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
62530 </para>
62531 <itemizedlist>
62532 <listitem>
62533 <para>
62534 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
62535 for all MIME parts for SMTP and non-SMTP messages, respectively.
62536 </para>
62537 </listitem>
62538 <listitem>
62539 <para>
62540 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
62541 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
62542 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
62543 </para>
62544 </listitem>
62545 <listitem>
62546 <para>
62547 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
62548 of messages, or parts of messages, for debugging purposes.
62549 </para>
62550 </listitem>
62551 <listitem>
62552 <para>
62553 Additional expansion variables that are set in the new ACL and by the new
62554 conditions.
62555 </para>
62556 </listitem>
62557 <listitem>
62558 <para>
62559 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
62560 </para>
62561 </listitem>
62562 </itemizedlist>
62563 <para>
62564 Content-scanning is continually evolving, and new features are still being
62565 added. While such features are still unstable and liable to incompatible
62566 changes, they are made available in Exim by setting options whose names begin
62567 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
62568 this manual. You can find out about them by reading the file called
62569 <filename>doc/experimental.txt</filename>.
62570 </para>
62571 <para>
62572 All the content-scanning facilities work on a MBOX copy of the message that is
62573 temporarily created in a file called:
62574 </para>
62575 <literallayout>
62576 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
62577 </literallayout>
62578 <para>
62579 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
62580 expect an MBOX-like structure inside that file. The file is created when the
62581 first content scanning facility is called. Subsequent calls to content
62582 scanning conditions open the same file again. The directory is recursively
62583 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
62584 </para>
62585 <literallayout class="monospaced">
62586 control = no_mbox_unspool
62587 </literallayout>
62588 <para>
62589 has been encountered. When the MIME ACL decodes files, they are put into the
62590 same directory by default.
62591 </para>
62592 <section id="SECTscanvirus">
62593 <title>Scanning for viruses</title>
62594 <para>
62595 <indexterm role="concept">
62596 <primary>virus scanning</primary>
62597 </indexterm>
62598 <indexterm role="concept">
62599 <primary>content scanning</primary>
62600 <secondary>for viruses</secondary>
62601 </indexterm>
62602 <indexterm role="concept">
62603 <primary>content scanning</primary>
62604 <secondary>the <option>malware</option> condition</secondary>
62605 </indexterm>
62606 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
62607 It supports a <quote>generic</quote> interface to scanners called via the shell, and
62608 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
62609 in memory and thus are much faster.
62610 </para>
62611 <para>
62612 Since message data needs to have arrived,
62613 the condition may be only called in ACL defined by
62614 <option>acl_smtp_data</option>,
62615 <option>acl_smtp_data_prdr</option>,
62616 <option>acl_smtp_mime</option> or
62617 <option>acl_smtp_dkim</option>
62618 </para>
62619 <para>
62620 A timeout of 2 minutes is applied to a scanner call (by default);
62621 if it expires then a defer action is taken.
62622 </para>
62623 <para>
62624 <indexterm role="option">
62625 <primary><option>av_scanner</option></primary>
62626 </indexterm>
62627 You can set the <option>av_scanner</option> option in the main part of the configuration
62628 to specify which scanner to use, together with any additional options that
62629 are needed. The basic syntax is as follows:
62630 </para>
62631 <literallayout>
62632 <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>
62633 </literallayout>
62634 <para>
62635 If you do not set <option>av_scanner</option>, it defaults to
62636 </para>
62637 <literallayout class="monospaced">
62638 av_scanner = sophie:/var/run/sophie
62639 </literallayout>
62640 <para>
62641 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
62642 before use.
62643 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
62644 The following scanner types are supported in this release,
62645 though individual ones can be included or not at build time:
62646 </para>
62647 <variablelist>
62648 <varlistentry>
62649 <term><option>avast</option></term>
62650 <listitem>
62651 <para>
62652 <indexterm role="concept">
62653 <primary>virus scanners</primary>
62654 <secondary>avast</secondary>
62655 </indexterm>
62656 This is the scanner daemon of Avast. It has been tested with Avast Core
62657 Security (currently at version 2.2.0).
62658 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
62659 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
62660 This scanner type takes one option,
62661 which can be either a full path to a UNIX socket,
62662 or host and port specifiers separated by white space.
62663 The host may be a name or an IP address; the port is either a
62664 single number or a pair of numbers with a dash between.
62665 A list of options may follow. These options are interpreted on the
62666 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
62667 the daemon as options before the main scan command.
62668 </para>
62669 <para>
62670 <indexterm role="concept">
62671 <primary><literal>pass_unscanned</literal></primary>
62672 <secondary>avast</secondary>
62673 </indexterm>
62674 If <literal>pass_unscanned</literal>
62675 is set, any files the Avast scanner can&#x2019;t scan (e.g.
62676 decompression bombs, or invalid archives) are considered clean. Use with
62677 care.
62678 </para>
62679 <para>
62680 For example:
62681 </para>
62682 <literallayout class="monospaced">
62683 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
62684 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
62685 av_scanner = avast:192.168.2.22 5036
62686 </literallayout>
62687 <para>
62688 If you omit the argument, the default path
62689 <filename>/var/run/avast/scan.sock</filename>
62690 is used.
62691 If you use a remote host,
62692 you need to make Exim&#x2019;s spool directory available to it,
62693 as the scanner is passed a file path, not file contents.
62694 For information about available commands and their options you may use
62695 </para>
62696 <literallayout class="monospaced">
62697 $ socat UNIX:/var/run/avast/scan.sock STDIO:
62698     FLAGS
62699     SENSITIVITY
62700     PACK
62701 </literallayout>
62702 <para>
62703 If the scanner returns a temporary failure (e.g. license issues, or
62704 permission problems), the message is deferred and a paniclog entry is
62705 written.  The usual <literal>defer_ok</literal> option is available.
62706 </para>
62707 </listitem></varlistentry>
62708 <varlistentry>
62709 <term><option>aveserver</option></term>
62710 <listitem>
62711 <para>
62712 <indexterm role="concept">
62713 <primary>virus scanners</primary>
62714 <secondary>Kaspersky</secondary>
62715 </indexterm>
62716 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
62717 at <emphasis role="bold"><ulink url="https://www.kaspersky.com/">https://www.kaspersky.com/</ulink></emphasis>. This scanner type takes one option,
62718 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
62719 example:
62720 </para>
62721 <literallayout class="monospaced">
62722 av_scanner = aveserver:/var/run/aveserver
62723 </literallayout>
62724 </listitem></varlistentry>
62725 <varlistentry>
62726 <term><option>clamd</option></term>
62727 <listitem>
62728 <para>
62729 <indexterm role="concept">
62730 <primary>virus scanners</primary>
62731 <secondary>clamd</secondary>
62732 </indexterm>
62733 This daemon-type scanner is GPL and free. You can get it at
62734 <emphasis role="bold"><ulink url="https://www.clamav.net/">https://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
62735 unpack MIME containers, so it used to be recommended to unpack MIME attachments
62736 in the MIME ACL. This is no longer believed to be necessary.
62737 </para>
62738 <para>
62739 The options are a list of server specifiers, which may be
62740 a UNIX socket specification,
62741 a TCP socket specification,
62742 or a (global) option.
62743 </para>
62744 <para>
62745 A socket specification consists of a space-separated list.
62746 For a Unix socket the first element is a full path for the socket,
62747 for a TCP socket the first element is the IP address
62748 and the second a port number,
62749 Any further elements are per-server (non-global) options.
62750 These per-server options are supported:
62751 </para>
62752 <literallayout class="monospaced">
62753 retry=&lt;timespec&gt;  Retry on connect fail
62754 </literallayout>
62755 <para>
62756 The <literal>retry</literal> option specifies a time after which a single retry for
62757 a failed connect is made.  The default is to not retry.
62758 </para>
62759 <para>
62760 If a Unix socket file is specified, only one server is supported.
62761 </para>
62762 <para>
62763 Examples:
62764 </para>
62765 <literallayout class="monospaced">
62766 av_scanner = clamd:/opt/clamd/socket
62767 av_scanner = clamd:192.0.2.3 1234
62768 av_scanner = clamd:192.0.2.3 1234:local
62769 av_scanner = clamd:192.0.2.3 1234 retry=10s
62770 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
62771 </literallayout>
62772 <para>
62773 If the value of av_scanner points to a UNIX socket file or contains the
62774 <literal>local</literal>
62775 option, then the ClamAV interface will pass a filename containing the data
62776 to be scanned, which should normally result in less I/O happening and be
62777 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
62778 Exim does not assume that there is a common filesystem with the remote host.
62779 </para>
62780 <para>
62781 The final example shows that multiple TCP targets can be specified.  Exim will
62782 randomly use one for each incoming email (i.e. it load balances them).  Note
62783 that only TCP targets may be used if specifying a list of scanners; a UNIX
62784 socket cannot be mixed in with TCP targets.  If one of the servers becomes
62785 unavailable, Exim will try the remaining one(s) until it finds one that works.
62786 When a clamd server becomes unreachable, Exim will log a message.  Exim does
62787 not keep track of scanner state between multiple messages, and the scanner
62788 selection is random, so the message will get logged in the mainlog for each
62789 email that the down scanner gets chosen first (message wrapped to be readable):
62790 </para>
62791 <literallayout class="monospaced">
62792 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
62793    clamd: connection to localhost, port 3310 failed
62794    (Connection refused)
62795 </literallayout>
62796 <para>
62797 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
62798 contributing the code for this scanner.
62799 </para>
62800 </listitem></varlistentry>
62801 <varlistentry>
62802 <term><option>cmdline</option></term>
62803 <listitem>
62804 <para>
62805 <indexterm role="concept">
62806 <primary>virus scanners</primary>
62807 <secondary>command line interface</secondary>
62808 </indexterm>
62809 This is the keyword for the generic command line scanner interface. It can be
62810 used to attach virus scanners that are invoked from the shell. This scanner
62811 type takes 3 mandatory options:
62812 </para>
62813 <orderedlist numeration="arabic">
62814 <listitem>
62815 <para>
62816 The full path and name of the scanner binary, with all command line options,
62817 and a placeholder (<literal>%s</literal>) for the directory to scan.
62818 </para>
62819 </listitem>
62820 <listitem>
62821 <para>
62822 A regular expression to match against the STDOUT and STDERR output of the
62823 virus scanner. If the expression matches, a virus was found. You must make
62824 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
62825 the <quote>trigger</quote> expression.
62826 </para>
62827 </listitem>
62828 <listitem>
62829 <para>
62830 Another regular expression, containing exactly one pair of parentheses, to
62831 match the name of the virus found in the scanners output. This is called the
62832 <quote>name</quote> expression.
62833 </para>
62834 </listitem>
62835 </orderedlist>
62836 <para>
62837 For example, Sophos Sweep reports a virus on a line like this:
62838 </para>
62839 <literallayout class="monospaced">
62840 Virus 'W32/Magistr-B' found in file ./those.bat
62841 </literallayout>
62842 <para>
62843 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
62844 name expression, we want to extract the W32/Magistr-B string, so we can match
62845 for the single quotes left and right of it. Altogether, this makes the
62846 configuration setting:
62847 </para>
62848 <literallayout class="monospaced">
62849 av_scanner = cmdline:\
62850              /path/to/sweep -ss -all -rec -archive %s:\
62851              found in file:'(.+)'
62852 </literallayout>
62853 </listitem></varlistentry>
62854 <varlistentry>
62855 <term><option>drweb</option></term>
62856 <listitem>
62857 <para>
62858 <indexterm role="concept">
62859 <primary>virus scanners</primary>
62860 <secondary>DrWeb</secondary>
62861 </indexterm>
62862 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="https://www.sald.ru/">https://www.sald.ru/</ulink></emphasis>) interface
62863 takes one option,
62864 either a full path to a UNIX socket,
62865 or host and port specifiers separated by white space.
62866 The host may be a name or an IP address; the port is either a
62867 single number or a pair of numbers with a dash between.
62868 For example:
62869 </para>
62870 <literallayout class="monospaced">
62871 av_scanner = drweb:/var/run/drwebd.sock
62872 av_scanner = drweb:192.168.2.20 31337
62873 </literallayout>
62874 <para>
62875 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
62876 is used. Thanks to Alex Miller for contributing the code for this scanner.
62877 </para>
62878 </listitem></varlistentry>
62879 <varlistentry>
62880 <term><option>f-protd</option></term>
62881 <listitem>
62882 <para>
62883 <indexterm role="concept">
62884 <primary>virus scanners</primary>
62885 <secondary>f-protd</secondary>
62886 </indexterm>
62887 The f-protd scanner is accessed via HTTP over TCP.
62888 One argument is taken, being a space-separated hostname and port number
62889 (or port-range).
62890 For example:
62891 </para>
62892 <literallayout class="monospaced">
62893 av_scanner = f-protd:localhost 10200-10204
62894 </literallayout>
62895 <para>
62896 If you omit the argument, the default values shown above are used.
62897 </para>
62898 </listitem></varlistentry>
62899 <varlistentry>
62900 <term><option>f-prot6d</option></term>
62901 <listitem>
62902 <para>
62903 <indexterm role="concept">
62904 <primary>virus scanners</primary>
62905 <secondary>f-prot6d</secondary>
62906 </indexterm>
62907 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
62908 One argument is taken, being a space-separated hostname and port number.
62909 For example:
62910 </para>
62911 <literallayout class="monospaced">
62912 av_scanner = f-prot6d:localhost 10200
62913 </literallayout>
62914 <para>
62915 If you omit the argument, the default values show above are used.
62916 </para>
62917 </listitem></varlistentry>
62918 <varlistentry>
62919 <term><option>fsecure</option></term>
62920 <listitem>
62921 <para>
62922 <indexterm role="concept">
62923 <primary>virus scanners</primary>
62924 <secondary>F-Secure</secondary>
62925 </indexterm>
62926 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="https://www.f-secure.com/">https://www.f-secure.com/</ulink></emphasis>) takes one
62927 argument which is the path to a UNIX socket. For example:
62928 </para>
62929 <literallayout class="monospaced">
62930 av_scanner = fsecure:/path/to/.fsav
62931 </literallayout>
62932 <para>
62933 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
62934 Thelmen for contributing the code for this scanner.
62935 </para>
62936 </listitem></varlistentry>
62937 <varlistentry>
62938 <term><option>kavdaemon</option></term>
62939 <listitem>
62940 <para>
62941 <indexterm role="concept">
62942 <primary>virus scanners</primary>
62943 <secondary>Kaspersky</secondary>
62944 </indexterm>
62945 This is the scanner daemon of Kaspersky Version 4. This version of the
62946 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
62947 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
62948 For example:
62949 </para>
62950 <literallayout class="monospaced">
62951 av_scanner = kavdaemon:/opt/AVP/AvpCtl
62952 </literallayout>
62953 <para>
62954 The default path is <filename>/var/run/AvpCtl</filename>.
62955 </para>
62956 </listitem></varlistentry>
62957 <varlistentry>
62958 <term><option>mksd</option></term>
62959 <listitem>
62960 <para>
62961 <indexterm role="concept">
62962 <primary>virus scanners</primary>
62963 <secondary>mksd</secondary>
62964 </indexterm>
62965 This was a daemon type scanner that is aimed mainly at Polish users,
62966 though some documentation was available in English.
62967 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>
62968 and this appears to be a candidate for removal from Exim, unless
62969 we are informed of other virus scanners which use the same protocol
62970 to integrate.
62971 The only option for this scanner type is
62972 the maximum number of processes used simultaneously to scan the attachments,
62973 provided that mksd has
62974 been run with at least the same number of child processes. For example:
62975 </para>
62976 <literallayout class="monospaced">
62977 av_scanner = mksd:2
62978 </literallayout>
62979 <para>
62980 You can safely omit this option (the default value is 1).
62981 </para>
62982 </listitem></varlistentry>
62983 <varlistentry>
62984 <term><option>sock</option></term>
62985 <listitem>
62986 <para>
62987 <indexterm role="concept">
62988 <primary>virus scanners</primary>
62989 <secondary>simple socket-connected</secondary>
62990 </indexterm>
62991 This is a general-purpose way of talking to simple scanner daemons
62992 running on the local machine.
62993 There are four options:
62994 an address (which may be an IP address and port, or the path of a Unix socket),
62995 a commandline to send (may include a single %s which will be replaced with
62996 the path to the mail file to be scanned),
62997 an RE to trigger on from the returned data,
62998 and an RE to extract malware_name from the returned data.
62999 For example:
63000 </para>
63001 <literallayout class="monospaced">
63002 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
63003 </literallayout>
63004 <para>
63005 Note that surrounding whitespace is stripped from each option, meaning
63006 there is no way to specify a trailing newline.
63007 The socket specifier and both regular-expressions are required.
63008 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
63009 specify an empty element to get this.
63010 </para>
63011 </listitem></varlistentry>
63012 <varlistentry>
63013 <term><option>sophie</option></term>
63014 <listitem>
63015 <para>
63016 <indexterm role="concept">
63017 <primary>virus scanners</primary>
63018 <secondary>Sophos and Sophie</secondary>
63019 </indexterm>
63020 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
63021 You can get Sophie at <emphasis role="bold"><ulink url="http://sophie.sourceforge.net/">http://sophie.sourceforge.net/</ulink></emphasis>. The only option
63022 for this scanner type is the path to the UNIX socket that Sophie uses for
63023 client communication. For example:
63024 </para>
63025 <literallayout class="monospaced">
63026 av_scanner = sophie:/tmp/sophie
63027 </literallayout>
63028 <para>
63029 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
63030 the option.
63031 </para>
63032 </listitem></varlistentry>
63033 </variablelist>
63034 <para>
63035 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
63036 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
63037 ACL.
63038 </para>
63039 <para>
63040 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
63041 makes it possible to use different scanners. See further below for an example.
63042 The <option>malware</option> condition caches its results, so when you use it multiple times
63043 for the same message, the actual scanning process is only carried out once.
63044 However, using expandable items in <option>av_scanner</option> disables this caching, in
63045 which case each use of the <option>malware</option> condition causes a new scan of the
63046 message.
63047 </para>
63048 <para>
63049 The <option>malware</option> condition takes a right-hand argument that is expanded before
63050 use and taken as a list, slash-separated by default.
63051 The first element can then be one of
63052 </para>
63053 <itemizedlist>
63054 <listitem>
63055 <para>
63056 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
63057 The condition succeeds if a virus was found, and fail otherwise. This is the
63058 recommended usage.
63059 </para>
63060 </listitem>
63061 <listitem>
63062 <para>
63063 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
63064 the condition fails immediately.
63065 </para>
63066 </listitem>
63067 <listitem>
63068 <para>
63069 A regular expression, in which case the message is scanned for viruses. The
63070 condition succeeds if a virus is found and its name matches the regular
63071 expression. This allows you to take special actions on certain types of virus.
63072 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
63073 unless the separator is changed (in the usual way <xref linkend="SECTlistsepchange"/>).
63074 </para>
63075 </listitem>
63076 </itemizedlist>
63077 <para>
63078 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
63079 messages even if there is a problem with the virus scanner.
63080 Otherwise, such a problem causes the ACL to defer.
63081 </para>
63082 <para>
63083 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
63084 specify a non-default timeout.  The default is two minutes.
63085 For example:
63086 </para>
63087 <literallayout class="monospaced">
63088 malware = * / defer_ok / tmo=10s
63089 </literallayout>
63090 <para>
63091 A timeout causes the ACL to defer.
63092 </para>
63093 <para>
63094 <indexterm role="variable">
63095 <primary><varname>$callout_address</varname></primary>
63096 </indexterm>
63097 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
63098 is set to record the actual address used.
63099 </para>
63100 <para>
63101 <indexterm role="variable">
63102 <primary><varname>$malware_name</varname></primary>
63103 </indexterm>
63104 When a virus is found, the condition sets up an expansion variable called
63105 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
63106 <option>message</option> modifier that specifies the error returned to the sender, and/or in
63107 logging data.
63108 </para>
63109 <para>
63110 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
63111 imposed by your anti-virus scanner.
63112 </para>
63113 <para>
63114 Here is a very simple scanning example:
63115 </para>
63116 <literallayout class="monospaced">
63117 deny malware = *
63118      message = This message contains malware ($malware_name)
63119 </literallayout>
63120 <para>
63121 The next example accepts messages when there is a problem with the scanner:
63122 </para>
63123 <literallayout class="monospaced">
63124 deny malware = */defer_ok
63125      message = This message contains malware ($malware_name)
63126 </literallayout>
63127 <para>
63128 The next example shows how to use an ACL variable to scan with both sophie and
63129 aveserver. It assumes you have set:
63130 </para>
63131 <literallayout class="monospaced">
63132 av_scanner = $acl_m0
63133 </literallayout>
63134 <para>
63135 in the main Exim configuration.
63136 </para>
63137 <literallayout class="monospaced">
63138 deny set acl_m0 = sophie
63139      malware = *
63140      message = This message contains malware ($malware_name)
63141
63142 deny set acl_m0 = aveserver
63143      malware = *
63144      message = This message contains malware ($malware_name)
63145 </literallayout>
63146 </section>
63147 <section id="SECTscanspamass">
63148 <title>Scanning with SpamAssassin and Rspamd</title>
63149 <para>
63150 <indexterm role="concept">
63151 <primary>content scanning</primary>
63152 <secondary>for spam</secondary>
63153 </indexterm>
63154 <indexterm role="concept">
63155 <primary>spam scanning</primary>
63156 </indexterm>
63157 <indexterm role="concept">
63158 <primary>SpamAssassin</primary>
63159 </indexterm>
63160 <indexterm role="concept">
63161 <primary>Rspamd</primary>
63162 </indexterm>
63163 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
63164 score and a report for the message.
63165 Support is also provided for Rspamd.
63166 </para>
63167 <para>
63168 For more information about installation and configuration of SpamAssassin or
63169 Rspamd refer to their respective websites at
63170 <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>
63171 </para>
63172 <para>
63173 SpamAssassin can be installed with CPAN by running:
63174 </para>
63175 <literallayout class="monospaced">
63176 perl -MCPAN -e 'install Mail::SpamAssassin'
63177 </literallayout>
63178 <para>
63179 SpamAssassin has its own set of configuration files. Please review its
63180 documentation to see how you can tweak it. The default installation should work
63181 nicely, however.
63182 </para>
63183 <para>
63184 <indexterm role="option">
63185 <primary><option>spamd_address</option></primary>
63186 </indexterm>
63187 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
63188 intend to use an instance running on the local host you do not need to set
63189 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
63190 you must set the <option>spamd_address</option> option in the global part of the Exim
63191 configuration as follows (example):
63192 </para>
63193 <literallayout class="monospaced">
63194 spamd_address = 192.168.99.45 783
63195 </literallayout>
63196 <para>
63197 The SpamAssassin protocol relies on a TCP half-close from the client.
63198 If your SpamAssassin client side is running a Linux system with an
63199 iptables firewall, consider setting
63200 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
63201 timeout, Exim uses when waiting for a response from the SpamAssassin
63202 server (currently defaulting to 120s).  With a lower value the Linux
63203 connection tracking may consider your half-closed connection as dead too
63204 soon.
63205 </para>
63206 <para>
63207 To use Rspamd (which by default listens on all local addresses
63208 on TCP port 11333)
63209 you should add <option>variant=rspamd</option> after the address/port pair, for example:
63210 </para>
63211 <literallayout class="monospaced">
63212 spamd_address = 127.0.0.1 11333 variant=rspamd
63213 </literallayout>
63214 <para>
63215 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
63216 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
63217 filename instead of an address/port pair:
63218 </para>
63219 <literallayout class="monospaced">
63220 spamd_address = /var/run/spamd_socket
63221 </literallayout>
63222 <para>
63223 You can have multiple <option>spamd</option> servers to improve scalability. These can
63224 reside on other hardware reachable over the network. To specify multiple
63225 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
63226 option, separated with colons (the separator can be changed in the usual way <xref linkend="SECTlistsepchange"/>):
63227 </para>
63228 <literallayout class="monospaced">
63229 spamd_address = 192.168.2.10 783 : \
63230                 192.168.2.11 783 : \
63231                 192.168.2.12 783
63232 </literallayout>
63233 <para>
63234 Up to 32 <option>spamd</option> servers are supported.
63235 When a server fails to respond to the connection attempt, all other
63236 servers are tried until one succeeds. If no server responds, the <option>spam</option>
63237 condition defers.
63238 </para>
63239 <para>
63240 Unix and TCP socket specifications may be mixed in any order.
63241 Each element of the list is a list itself, space-separated by default
63242 and changeable in the usual way (<xref linkend="SECTlistsepchange"/>);
63243 take care to not double the separator.
63244 </para>
63245 <para>
63246 For TCP socket specifications a host name or IP (v4 or v6, but
63247 subject to list-separator quoting rules) address can be used,
63248 and the port can be one or a dash-separated pair.
63249 In the latter case, the range is tried in strict order.
63250 </para>
63251 <para>
63252 Elements after the first for Unix sockets, or second for TCP socket,
63253 are options.
63254 The supported options are:
63255 </para>
63256 <literallayout class="monospaced">
63257 pri=&lt;priority&gt;      Selection priority
63258 weight=&lt;value&gt;      Selection bias
63259 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
63260 retry=&lt;timespec&gt;    Retry on connect fail
63261 tmo=&lt;timespec&gt;      Connection time limit
63262 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
63263 </literallayout>
63264 <para>
63265 The <literal>pri</literal> option specifies a priority for the server within the list,
63266 higher values being tried first.
63267 The default priority is 1.
63268 </para>
63269 <para>
63270 The <literal>weight</literal> option specifies a selection bias.
63271 Within a priority set
63272 servers are queried in a random fashion, weighted by this value.
63273 The default value for selection bias is 1.
63274 </para>
63275 <para>
63276 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
63277 in the local time zone; each element being one or more digits.
63278 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
63279 characters, may be omitted and will be taken as zero.
63280 </para>
63281 <para>
63282 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
63283 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
63284 </para>
63285 <para>
63286 The <literal>tmo</literal> option specifies an overall timeout for communication.
63287 The default value is two minutes.
63288 </para>
63289 <para>
63290 The <literal>retry</literal> option specifies a time after which a single retry for
63291 a failed connect is made.
63292 The default is to not retry.
63293 </para>
63294 <para>
63295 The <option>spamd_address</option> variable is expanded before use if it starts with
63296 a dollar sign. In this case, the expansion may return a string that is
63297 used as the list so that multiple spamd servers can be the result of an
63298 expansion.
63299 </para>
63300 <para>
63301 <indexterm role="variable">
63302 <primary><varname>$callout_address</varname></primary>
63303 </indexterm>
63304 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
63305 is set to record the actual address used.
63306 </para>
63307 </section>
63308 <section id="SECID206">
63309 <title>Calling SpamAssassin from an Exim ACL</title>
63310 <para>
63311 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
63312 </para>
63313 <literallayout class="monospaced">
63314 deny spam = joe
63315      message = This message was classified as SPAM
63316 </literallayout>
63317 <para>
63318 The right-hand side of the <option>spam</option> condition specifies a name. This is
63319 relevant if you have set up multiple SpamAssassin profiles. If you do not want
63320 to scan using a specific profile, but rather use the SpamAssassin system-wide
63321 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
63322 Rspamd does not use this setting. However, you must put something on the
63323 right-hand side.
63324 </para>
63325 <para>
63326 The name allows you to use per-domain or per-user antispam profiles in
63327 principle, but this is not straightforward in practice, because a message may
63328 have multiple recipients, not necessarily all in the same domain. Because the
63329 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
63330 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
63331 are not set.
63332 Careful enforcement of single-recipient messages
63333 (e.g. by responding with defer in the recipient ACL for all recipients
63334 after the first),
63335 or the use of PRDR,
63336 <indexterm role="concept">
63337 <primary>PRDR</primary>
63338 <secondary>use for per-user SpamAssassin profiles</secondary>
63339 </indexterm>
63340 are needed to use this feature.
63341 </para>
63342 <para>
63343 The right-hand side of the <option>spam</option> condition is expanded before being used, so
63344 you can put lookups or conditions there. When the right-hand side evaluates to
63345 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
63346 </para>
63347 <para>
63348 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
63349 large ones may cause significant performance degradation. As most spam messages
63350 are quite small, it is recommended that you do not scan the big ones. For
63351 example:
63352 </para>
63353 <literallayout class="monospaced">
63354 deny condition = ${if &lt; {$message_size}{10K}}
63355      spam = nobody
63356      message = This message was classified as SPAM
63357 </literallayout>
63358 <para>
63359 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
63360 SpamAssassin profile has been matched or exceeded. If you want to use the
63361 <option>spam</option> condition for its side effects (see the variables below), you can make
63362 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
63363 </para>
63364 <para>
63365 <indexterm role="concept">
63366 <primary>spam scanning</primary>
63367 <secondary>returned variables</secondary>
63368 </indexterm>
63369 When the <option>spam</option> condition is run, it sets up a number of expansion
63370 variables.
63371 Except for <varname>$spam_report</varname>,
63372 these variables are saved with the received message so are
63373 available for use at delivery time.
63374 </para>
63375 <variablelist>
63376 <varlistentry>
63377 <term><varname>$spam_score</varname></term>
63378 <listitem>
63379 <para>
63380 The spam score of the message, for example, <quote>3.4</quote> or <quote>30.5</quote>. This is useful
63381 for inclusion in log or reject messages.
63382 </para>
63383 </listitem></varlistentry>
63384 <varlistentry>
63385 <term><varname>$spam_score_int</varname></term>
63386 <listitem>
63387 <para>
63388 The spam score of the message, multiplied by ten, as an integer value. For
63389 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
63390 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
63391 The integer value is useful for numeric comparisons in conditions.
63392 </para>
63393 </listitem></varlistentry>
63394 <varlistentry>
63395 <term><varname>$spam_bar</varname></term>
63396 <listitem>
63397 <para>
63398 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
63399 integer part of the spam score value. A spam score of 4.4 would have a
63400 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
63401 headers, since MUAs can match on such strings. The maximum length of the
63402 spam bar is 50 characters.
63403 </para>
63404 </listitem></varlistentry>
63405 <varlistentry>
63406 <term><varname>$spam_report</varname></term>
63407 <listitem>
63408 <para>
63409 A multiline text table, containing the full SpamAssassin report for the
63410 message. Useful for inclusion in headers or reject messages.
63411 This variable is only usable in a DATA-time ACL.
63412 Beware that SpamAssassin may return non-ASCII characters, especially
63413 when running in country-specific locales, which are not legal
63414 unencoded in headers.
63415 </para>
63416 </listitem></varlistentry>
63417 <varlistentry>
63418 <term><varname>$spam_action</varname></term>
63419 <listitem>
63420 <para>
63421 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
63422 spam score versus threshold.
63423 For Rspamd, the recommended action.
63424 </para>
63425 </listitem></varlistentry>
63426 </variablelist>
63427 <para>
63428 The <option>spam</option> condition caches its results unless expansion in
63429 spamd_address was used. If you call it again with the same user name, it
63430 does not scan again, but rather returns the same values as before.
63431 </para>
63432 <para>
63433 The <option>spam</option> condition returns DEFER if there is any error while running
63434 the message through SpamAssassin or if the expansion of spamd_address
63435 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
63436 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
63437 spam condition, like this:
63438 </para>
63439 <literallayout class="monospaced">
63440 deny spam    = joe/defer_ok
63441      message = This message was classified as SPAM
63442 </literallayout>
63443 <para>
63444 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
63445 </para>
63446 <para>
63447 Here is a longer, commented example of the use of the <option>spam</option>
63448 condition:
63449 </para>
63450 <literallayout class="monospaced">
63451 # put headers in all messages (no matter if spam or not)
63452 warn  spam = nobody:true
63453       add_header = X-Spam-Score: $spam_score ($spam_bar)
63454       add_header = X-Spam-Report: $spam_report
63455
63456 # add second subject line with *SPAM* marker when message
63457 # is over threshold
63458 warn  spam = nobody
63459       add_header = Subject: *SPAM* $h_Subject:
63460
63461 # reject spam at high scores (&gt; 12)
63462 deny  spam = nobody:true
63463       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
63464       message = This message scored $spam_score spam points.
63465 </literallayout>
63466 </section>
63467 <section id="SECTscanmimepart">
63468 <title>Scanning MIME parts</title>
63469 <para>
63470 <indexterm role="concept">
63471 <primary>content scanning</primary>
63472 <secondary>MIME parts</secondary>
63473 </indexterm>
63474 <indexterm role="concept">
63475 <primary>MIME content scanning</primary>
63476 </indexterm>
63477 <indexterm role="option">
63478 <primary><option>acl_smtp_mime</option></primary>
63479 </indexterm>
63480 <indexterm role="option">
63481 <primary><option>acl_not_smtp_mime</option></primary>
63482 </indexterm>
63483 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
63484 each MIME part of an SMTP message, including multipart types, in the sequence
63485 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
63486 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
63487 options may both refer to the same ACL if you want the same processing in both
63488 cases.
63489 </para>
63490 <para>
63491 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
63492 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
63493 the case of a non-SMTP message. However, a MIME ACL is called only if the
63494 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
63495 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
63496 result code is sent to the client. In the case of an SMTP message, the
63497 <option>acl_smtp_data</option> ACL is not called when this happens.
63498 </para>
63499 <para>
63500 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
63501 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
63502 condition to match against the raw MIME part. You can also use the
63503 <option>mime_regex</option> condition to match against the decoded MIME part (see section
63504 <xref linkend="SECTscanregex"/>).
63505 </para>
63506 <para>
63507 At the start of a MIME ACL, a number of variables are set from the header
63508 information for the relevant MIME part. These are described below. The contents
63509 of the MIME part are not by default decoded into a disk file except for MIME
63510 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
63511 part into a disk file, you can use the <option>decode</option> condition. The general
63512 syntax is:
63513 </para>
63514 <literallayout>
63515 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
63516 </literallayout>
63517 <para>
63518 The right hand side is expanded before use. After expansion,
63519 the value can be:
63520 </para>
63521 <orderedlist numeration="arabic">
63522 <listitem>
63523 <para>
63524 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
63525 </para>
63526 </listitem>
63527 <listitem>
63528 <para>
63529 The string <quote>default</quote>. In that case, the file is put in the temporary
63530 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
63531 a sequential filename consisting of the message id and a sequence number. The
63532 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
63533 </para>
63534 </listitem>
63535 <listitem>
63536 <para>
63537 A full path name starting with a slash. If the full name is an existing
63538 directory, it is used as a replacement for the default directory. The filename
63539 is then sequentially assigned. If the path does not exist, it is used as
63540 the full path and filename.
63541 </para>
63542 </listitem>
63543 <listitem>
63544 <para>
63545 If the string does not start with a slash, it is used as the
63546 filename, and the default path is then used.
63547 </para>
63548 </listitem>
63549 </orderedlist>
63550 <para>
63551 The <option>decode</option> condition normally succeeds. It is only false for syntax
63552 errors or unusual circumstances such as memory shortages. You can easily decode
63553 a file with its original, proposed filename using
63554 </para>
63555 <literallayout class="monospaced">
63556 decode = $mime_filename
63557 </literallayout>
63558 <para>
63559 However, you should keep in mind that <varname>$mime_filename</varname> might contain
63560 anything. If you place files outside of the default path, they are not
63561 automatically unlinked.
63562 </para>
63563 <para>
63564 For RFC822 attachments (these are messages attached to messages, with a
63565 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
63566 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
63567 variable is set (see below). Attached messages are always decoded to disk
63568 before being checked, and the files are unlinked once the check is done.
63569 </para>
63570 <para>
63571 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
63572 used to match regular expressions against raw and decoded MIME parts,
63573 respectively. They are described in section <xref linkend="SECTscanregex"/>.
63574 </para>
63575 <para>
63576 <indexterm role="concept">
63577 <primary>MIME content scanning</primary>
63578 <secondary>returned variables</secondary>
63579 </indexterm>
63580 The following list describes all expansion variables that are
63581 available in the MIME ACL:
63582 </para>
63583 <variablelist>
63584 <varlistentry>
63585 <term><varname>$mime_anomaly_level</varname></term>
63586 <term><varname>$mime_anomaly_text</varname></term>
63587 <listitem>
63588 <para>
63589 <indexterm role="variable">
63590 <primary><varname>$mime_anomaly_level</varname></primary>
63591 </indexterm>
63592 <indexterm role="variable">
63593 <primary><varname>$mime_anomaly_text</varname></primary>
63594 </indexterm>
63595 If there are problems decoding, these variables contain information on
63596 the detected issue.
63597 </para>
63598 </listitem></varlistentry>
63599 <varlistentry>
63600 <term><varname>$mime_boundary</varname></term>
63601 <listitem>
63602 <para>
63603 <indexterm role="variable">
63604 <primary><varname>$mime_boundary</varname></primary>
63605 </indexterm>
63606 If the current part is a multipart (see <varname>$mime_is_multipart</varname> below), it should
63607 have a boundary string, which is stored in this variable. If the current part
63608 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
63609 contains the empty string.
63610 </para>
63611 </listitem></varlistentry>
63612 <varlistentry>
63613 <term><varname>$mime_charset</varname></term>
63614 <listitem>
63615 <para>
63616 <indexterm role="variable">
63617 <primary><varname>$mime_charset</varname></primary>
63618 </indexterm>
63619 This variable contains the character set identifier, if one was found in the
63620 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
63621 </para>
63622 <literallayout class="monospaced">
63623 us-ascii
63624 gb2312 (Chinese)
63625 iso-8859-1
63626 </literallayout>
63627 <para>
63628 Please note that this value is not normalized, so you should do matches
63629 case-insensitively.
63630 </para>
63631 </listitem></varlistentry>
63632 <varlistentry>
63633 <term><varname>$mime_content_description</varname></term>
63634 <listitem>
63635 <para>
63636 <indexterm role="variable">
63637 <primary><varname>$mime_content_description</varname></primary>
63638 </indexterm>
63639 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
63640 header. It can contain a human-readable description of the parts content. Some
63641 implementations repeat the filename for attachments here, but they are usually
63642 only used for display purposes.
63643 </para>
63644 </listitem></varlistentry>
63645 <varlistentry>
63646 <term><varname>$mime_content_disposition</varname></term>
63647 <listitem>
63648 <para>
63649 <indexterm role="variable">
63650 <primary><varname>$mime_content_disposition</varname></primary>
63651 </indexterm>
63652 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
63653 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
63654 </para>
63655 </listitem></varlistentry>
63656 <varlistentry>
63657 <term><varname>$mime_content_id</varname></term>
63658 <listitem>
63659 <para>
63660 <indexterm role="variable">
63661 <primary><varname>$mime_content_id</varname></primary>
63662 </indexterm>
63663 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
63664 This is a unique ID that can be used to reference a part from another part.
63665 </para>
63666 </listitem></varlistentry>
63667 <varlistentry>
63668 <term><varname>$mime_content_size</varname></term>
63669 <listitem>
63670 <para>
63671 <indexterm role="variable">
63672 <primary><varname>$mime_content_size</varname></primary>
63673 </indexterm>
63674 This variable is set only after the <option>decode</option> modifier (see above) has been
63675 successfully run. It contains the size of the decoded part in kilobytes. The
63676 size is always rounded up to full kilobytes, so only a completely empty part
63677 has a <varname>$mime_content_size</varname> of zero.
63678 </para>
63679 </listitem></varlistentry>
63680 <varlistentry>
63681 <term><varname>$mime_content_transfer_encoding</varname></term>
63682 <listitem>
63683 <para>
63684 <indexterm role="variable">
63685 <primary><varname>$mime_content_transfer_encoding</varname></primary>
63686 </indexterm>
63687 This variable contains the normalized content of the
63688 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
63689 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
63690 </para>
63691 </listitem></varlistentry>
63692 <varlistentry>
63693 <term><varname>$mime_content_type</varname></term>
63694 <listitem>
63695 <para>
63696 <indexterm role="variable">
63697 <primary><varname>$mime_content_type</varname></primary>
63698 </indexterm>
63699 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
63700 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
63701 are some examples of popular MIME types, as they may appear in this variable:
63702 </para>
63703 <literallayout class="monospaced">
63704 text/plain
63705 text/html
63706 application/octet-stream
63707 image/jpeg
63708 audio/midi
63709 </literallayout>
63710 <para>
63711 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
63712 empty string.
63713 </para>
63714 </listitem></varlistentry>
63715 <varlistentry>
63716 <term><varname>$mime_decoded_filename</varname></term>
63717 <listitem>
63718 <para>
63719 <indexterm role="variable">
63720 <primary><varname>$mime_decoded_filename</varname></primary>
63721 </indexterm>
63722 This variable is set only after the <option>decode</option> modifier (see above) has been
63723 successfully run. It contains the full path and filename of the file
63724 containing the decoded data.
63725 </para>
63726 </listitem></varlistentry>
63727 </variablelist>
63728 <para>
63729 <indexterm role="concept">
63730 <primary>RFC 2047</primary>
63731 </indexterm>
63732 </para>
63733 <variablelist>
63734 <varlistentry>
63735 <term><varname>$mime_filename</varname></term>
63736 <listitem>
63737 <para>
63738 <indexterm role="variable">
63739 <primary><varname>$mime_filename</varname></primary>
63740 </indexterm>
63741 This is perhaps the most important of the MIME variables. It contains a
63742 proposed filename for an attachment, if one was found in either the
63743 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
63744 RFC2047
63745 or RFC2231
63746 decoded, but no additional sanity checks are done.
63747  If no filename was
63748 found, this variable contains the empty string.
63749 </para>
63750 </listitem></varlistentry>
63751 <varlistentry>
63752 <term><varname>$mime_is_coverletter</varname></term>
63753 <listitem>
63754 <para>
63755 <indexterm role="variable">
63756 <primary><varname>$mime_is_coverletter</varname></primary>
63757 </indexterm>
63758 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
63759 attached data. It can be used to clamp down on flashy or unnecessarily encoded
63760 content in the cover letter, while not restricting attachments at all.
63761 </para>
63762 <para>
63763 The variable contains 1 (true) for a MIME part believed to be part of the
63764 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
63765 follows:
63766 </para>
63767 <orderedlist numeration="arabic">
63768 <listitem>
63769 <para>
63770 The outermost MIME part of a message is always a cover letter.
63771 </para>
63772 </listitem>
63773 <listitem>
63774 <para>
63775 If a multipart/alternative or multipart/related MIME part is a cover letter,
63776 so are all MIME subparts within that multipart.
63777 </para>
63778 </listitem>
63779 <listitem>
63780 <para>
63781 If any other multipart is a cover letter, the first subpart is a cover letter,
63782 and the rest are attachments.
63783 </para>
63784 </listitem>
63785 <listitem>
63786 <para>
63787 All parts contained within an attachment multipart are attachments.
63788 </para>
63789 </listitem>
63790 </orderedlist>
63791 <para>
63792 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
63793 alternative plain text), while allowing HTML files to be attached. HTML
63794 coverletter mail attached to non-HTML coverletter mail will also be allowed:
63795 </para>
63796 <literallayout class="monospaced">
63797 deny !condition = $mime_is_rfc822
63798      condition = $mime_is_coverletter
63799      condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
63800      message = HTML mail is not accepted here
63801 </literallayout>
63802 </listitem></varlistentry>
63803 <varlistentry>
63804 <term><varname>$mime_is_multipart</varname></term>
63805 <listitem>
63806 <para>
63807 <indexterm role="variable">
63808 <primary><varname>$mime_is_multipart</varname></primary>
63809 </indexterm>
63810 This variable has the value 1 (true) when the current part has the main type
63811 <quote>multipart</quote>, for example, <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
63812 Since multipart entities only serve as containers for other parts, you may not
63813 want to carry out specific actions on them.
63814 </para>
63815 </listitem></varlistentry>
63816 <varlistentry>
63817 <term><varname>$mime_is_rfc822</varname></term>
63818 <listitem>
63819 <para>
63820 <indexterm role="variable">
63821 <primary><varname>$mime_is_rfc822</varname></primary>
63822 </indexterm>
63823 This variable has the value 1 (true) if the current part is not a part of the
63824 checked message itself, but part of an attached message. Attached message
63825 decoding is fully recursive.
63826 </para>
63827 </listitem></varlistentry>
63828 <varlistentry>
63829 <term><varname>$mime_part_count</varname></term>
63830 <listitem>
63831 <para>
63832 <indexterm role="variable">
63833 <primary><varname>$mime_part_count</varname></primary>
63834 </indexterm>
63835 This variable is a counter that is raised for each processed MIME part. It
63836 starts at zero for the very first part (which is usually a multipart). The
63837 counter is per-message, so it is reset when processing RFC822 attachments (see
63838 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
63839 complete, so you can use it in the DATA ACL to determine the number of MIME
63840 parts of a message. For non-MIME messages, this variable contains the value -1.
63841 </para>
63842 </listitem></varlistentry>
63843 </variablelist>
63844 </section>
63845 <section id="SECTscanregex">
63846 <title>Scanning with regular expressions</title>
63847 <para>
63848 <indexterm role="concept">
63849 <primary>content scanning</primary>
63850 <secondary>with regular expressions</secondary>
63851 </indexterm>
63852 <indexterm role="concept">
63853 <primary>regular expressions</primary>
63854 <secondary>content scanning with</secondary>
63855 </indexterm>
63856 You can specify your own custom regular expression matches on the full body of
63857 the message, or on individual MIME parts.
63858 </para>
63859 <para>
63860 The <option>regex</option> condition takes one or more regular expressions as arguments and
63861 matches them against the full message (when called in the DATA ACL) or a raw
63862 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
63863 linewise, with a maximum line length of 32K characters. That means you cannot
63864 have multiline matches with the <option>regex</option> condition.
63865 </para>
63866 <para>
63867 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
63868 to 32K of decoded content (the whole content at once, not linewise). If the
63869 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
63870 is decoded automatically when <option>mime_regex</option> is executed (using default path
63871 and filename values). If the decoded data is larger than  32K, only the first
63872 32K characters are checked.
63873 </para>
63874 <para>
63875 The regular expressions are passed as a colon-separated list. To include a
63876 literal colon, you must double it. Since the whole right-hand side string is
63877 expanded before being used, you must also escape dollar signs and backslashes
63878 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
63879 Here is a simple example that contains two regular expressions:
63880 </para>
63881 <literallayout class="monospaced">
63882 deny regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
63883      message = contains blacklisted regex ($regex_match_string)
63884 </literallayout>
63885 <para>
63886 The conditions returns true if any one of the regular expressions matches. The
63887 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
63888 matching regular expression.
63889 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
63890 are set to any substrings captured by the regular expression.
63891 </para>
63892 <para>
63893 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
63894 CPU-intensive.
63895 </para>
63896 <para>
63897 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
63898 </para>
63899 </section>
63900 </chapter>
63901
63902 <chapter id="CHAPlocalscan">
63903 <title>Adding a local scan function to Exim</title>
63904 <titleabbrev>Local scan function</titleabbrev>
63905 <para>
63906 <indexterm role="concept" id="IIDlosca" class="startofrange">
63907 <primary><function>local_scan()</function> function</primary>
63908 <secondary>description of</secondary>
63909 </indexterm>
63910 <indexterm role="concept">
63911 <primary>customizing</primary>
63912 <secondary>input scan using C function</secondary>
63913 </indexterm>
63914 <indexterm role="concept">
63915 <primary>policy control</primary>
63916 <secondary>by local scan function</secondary>
63917 </indexterm>
63918 In these days of email worms, viruses, and ever-increasing spam, some sites
63919 want to apply a lot of checking to messages before accepting them.
63920 </para>
63921 <para>
63922 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
63923 passing messages to external virus and spam scanning software. You can also do
63924 a certain amount in Exim itself through string expansions and the <option>condition</option>
63925 condition in the ACL that runs after the SMTP DATA command or the ACL for
63926 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
63927 </para>
63928 <para>
63929 To allow for further customization to a site&#x2019;s own requirements, there is the
63930 possibility of linking Exim with a private message scanning function, written
63931 in C. If you want to run code that is written in something other than C, you
63932 can of course use a little C stub to call it.
63933 </para>
63934 <para>
63935 The local scan function is run once for every incoming message, at the point
63936 when Exim is just about to accept the message.
63937 It can therefore be used to control non-SMTP messages from local processes as
63938 well as messages arriving via SMTP.
63939 </para>
63940 <para>
63941 Exim applies a timeout to calls of the local scan function, and there is an
63942 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
63943 Zero means <quote>no timeout</quote>.
63944 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
63945 before calling the local scan function, so that the most common types of crash
63946 are caught. If the timeout is exceeded or one of those signals is caught, the
63947 incoming message is rejected with a temporary error if it is an SMTP message.
63948 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
63949 code. The incident is logged on the main and reject logs.
63950 </para>
63951 <section id="SECID207">
63952 <title>Building Exim to use a local scan function</title>
63953 <para>
63954 <indexterm role="concept">
63955 <primary><function>local_scan()</function> function</primary>
63956 <secondary>building Exim to use</secondary>
63957 </indexterm>
63958 To make use of the local scan function feature, you must tell Exim where your
63959 function is before building Exim, by setting
63960 both HAVE_LOCAL_SCAN and
63961 LOCAL_SCAN_SOURCE in your
63962 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
63963 directory, so you might set
63964 </para>
63965 <literallayout class="monospaced">
63966 HAVE_LOCAL_SCAN=yes
63967 LOCAL_SCAN_SOURCE=Local/local_scan.c
63968 </literallayout>
63969 <para>
63970 for example. The function must be called <function>local_scan()</function>;
63971 </para>
63972 <para revisionflag="changed">
63973 the source file(s) for it should first #define LOCAL_SCAN
63974 and then #include "local_scan.h".
63975 </para>
63976 <para>
63977 It is called by
63978 Exim after it has received a message, when the success return code is about to
63979 be sent. This is after all the ACLs have been run. The return code from your
63980 function controls whether the message is actually accepted or not. There is a
63981 commented template function (that just accepts the message) in the file
63982 _src/local_scan.c_.
63983 </para>
63984 <para>
63985 If you want to make use of Exim&#x2019;s runtime configuration file to set options
63986 for your <function>local_scan()</function> function, you must also set
63987 </para>
63988 <literallayout class="monospaced">
63989 LOCAL_SCAN_HAS_OPTIONS=yes
63990 </literallayout>
63991 <para>
63992 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
63993 </para>
63994 </section>
63995 <section id="SECTapiforloc">
63996 <title>API for local_scan()</title>
63997 <para>
63998 <indexterm role="concept">
63999 <primary><function>local_scan()</function> function</primary>
64000 <secondary>API description</secondary>
64001 </indexterm>
64002 <indexterm role="concept">
64003 <primary><option>dlfunc</option></primary>
64004 <secondary>API description</secondary>
64005 </indexterm>
64006 You must include this line near the start of your code:
64007 </para>
64008 <literallayout class="monospaced">
64009 #define LOCAL_SCAN
64010 #include "local_scan.h"
64011 </literallayout>
64012 <para>
64013 This header file defines a number of variables and other values, and the
64014 prototype for the function itself. Exim is coded to use unsigned char values
64015 almost exclusively, and one of the things this header defines is a shorthand
64016 for <literal>unsigned char</literal> called <literal>uschar</literal>.
64017 It also makes available the following macro definitions, to simplify casting character
64018 strings and pointers to character strings:
64019 </para>
64020 <literallayout class="monospaced">
64021 #define CS   (char *)
64022 #define CCS  (const char *)
64023 #define CSS  (char **)
64024 #define US   (unsigned char *)
64025 #define CUS  (const unsigned char *)
64026 #define USS  (unsigned char **)
64027 </literallayout>
64028 <para>
64029 The function prototype for <function>local_scan()</function> is:
64030 </para>
64031 <literallayout class="monospaced">
64032 extern int local_scan(int fd, uschar **return_text);
64033 </literallayout>
64034 <para>
64035 The arguments are as follows:
64036 </para>
64037 <itemizedlist>
64038 <listitem>
64039 <para>
64040 <option>fd</option> is a file descriptor for the file that contains the body of the message
64041 (the -D file). The file is open for reading and writing, but updating it is not
64042 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
64043 </para>
64044 <para>
64045 The descriptor is positioned at character 19 of the file, which is the first
64046 character of the body itself, because the first 19 characters are the message
64047 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
64048 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
64049 case this changes in some future version.
64050 </para>
64051 </listitem>
64052 <listitem>
64053 <para>
64054 <option>return_text</option> is an address which you can use to return a pointer to a text
64055 string at the end of the function. The value it points to on entry is NULL.
64056 </para>
64057 </listitem>
64058 </itemizedlist>
64059 <para>
64060 The function must return an <option>int</option> value which is one of the following macros:
64061 </para>
64062 <variablelist>
64063 <varlistentry>
64064 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
64065 <listitem>
64066 <para>
64067 <indexterm role="variable">
64068 <primary><varname>$local_scan_data</varname></primary>
64069 </indexterm>
64070 The message is accepted. If you pass back a string of text, it is saved with
64071 the message, and made available in the variable <varname>$local_scan_data</varname>. No
64072 newlines are permitted (if there are any, they are turned into spaces) and the
64073 maximum length of text is 1000 characters.
64074 </para>
64075 </listitem></varlistentry>
64076 <varlistentry>
64077 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
64078 <listitem>
64079 <para>
64080 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
64081 queued without immediate delivery, and is frozen.
64082 </para>
64083 </listitem></varlistentry>
64084 <varlistentry>
64085 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
64086 <listitem>
64087 <para>
64088 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
64089 queued without immediate delivery.
64090 </para>
64091 </listitem></varlistentry>
64092 <varlistentry>
64093 <term><literal>LOCAL_SCAN_REJECT</literal></term>
64094 <listitem>
64095 <para>
64096 The message is rejected; the returned text is used as an error message which is
64097 passed back to the sender and which is also logged. Newlines are permitted &ndash;
64098 they cause a multiline response for SMTP rejections, but are converted to
64099 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
64100 used.
64101 </para>
64102 </listitem></varlistentry>
64103 <varlistentry>
64104 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
64105 <listitem>
64106 <para>
64107 The message is temporarily rejected; the returned text is used as an error
64108 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
64109 problem</quote> is used.
64110 </para>
64111 </listitem></varlistentry>
64112 <varlistentry>
64113 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
64114 <listitem>
64115 <para>
64116 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
64117 message is not written to the reject log. It has the effect of unsetting the
64118 <option>rejected_header</option> log selector for just this rejection. If
64119 <option>rejected_header</option> is already unset (see the discussion of the
64120 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
64121 same as LOCAL_SCAN_REJECT.
64122 </para>
64123 </listitem></varlistentry>
64124 <varlistentry>
64125 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
64126 <listitem>
64127 <para>
64128 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
64129 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
64130 </para>
64131 </listitem></varlistentry>
64132 </variablelist>
64133 <para>
64134 If the message is not being received by interactive SMTP, rejections are
64135 reported by writing to <option>stderr</option> or by sending an email, as configured by the
64136 <option>-oe</option> command line options.
64137 </para>
64138 </section>
64139 <section id="SECTconoptloc">
64140 <title>Configuration options for local_scan()</title>
64141 <para>
64142 <indexterm role="concept">
64143 <primary><function>local_scan()</function> function</primary>
64144 <secondary>configuration options</secondary>
64145 </indexterm>
64146 It is possible to have option settings in the main configuration file
64147 that set values in static variables in the <function>local_scan()</function> module. If you
64148 want to do this, you must have the line
64149 </para>
64150 <literallayout class="monospaced">
64151 LOCAL_SCAN_HAS_OPTIONS=yes
64152 </literallayout>
64153 <para>
64154 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
64155 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
64156 file, you must define static variables to hold the option values, and a table
64157 to define them.
64158 </para>
64159 <para>
64160 The table must be a vector called <option>local_scan_options</option>, of type
64161 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
64162 and a pointer to the variable that holds the value. The entries must appear in
64163 alphabetical order. Following <option>local_scan_options</option> you must also define a
64164 variable called <option>local_scan_options_count</option> that contains the number of
64165 entries in the table. Here is a short example, showing two kinds of option:
64166 </para>
64167 <literallayout class="monospaced">
64168 static int my_integer_option = 42;
64169 static uschar *my_string_option = US"a default string";
64170
64171 optionlist local_scan_options[] = {
64172   { "my_integer", opt_int,       &amp;my_integer_option },
64173   { "my_string",  opt_stringptr, &amp;my_string_option }
64174 };
64175
64176 int local_scan_options_count =
64177   sizeof(local_scan_options)/sizeof(optionlist);
64178 </literallayout>
64179 <para>
64180 The values of the variables can now be changed from Exim&#x2019;s runtime
64181 configuration file by including a local scan section as in this example:
64182 </para>
64183 <literallayout class="monospaced">
64184 begin local_scan
64185 my_integer = 99
64186 my_string = some string of text...
64187 </literallayout>
64188 <para>
64189 The available types of option data are as follows:
64190 </para>
64191 <variablelist>
64192 <varlistentry>
64193 <term><emphasis role="bold">opt_bool</emphasis></term>
64194 <listitem>
64195 <para>
64196 This specifies a boolean (true/false) option. The address should point to a
64197 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
64198 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
64199 whether such a variable has been set at all, you can initialize it to
64200 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
64201 values.)
64202 </para>
64203 </listitem></varlistentry>
64204 <varlistentry>
64205 <term><emphasis role="bold">opt_fixed</emphasis></term>
64206 <listitem>
64207 <para>
64208 This specifies a fixed point number, such as is used for load averages.
64209 The address should point to a variable of type <literal>int</literal>. The value is stored
64210 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
64211 </para>
64212 </listitem></varlistentry>
64213 <varlistentry>
64214 <term><emphasis role="bold">opt_int</emphasis></term>
64215 <listitem>
64216 <para>
64217 This specifies an integer; the address should point to a variable of type
64218 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
64219 Exim.
64220 </para>
64221 </listitem></varlistentry>
64222 <varlistentry>
64223 <term><emphasis role="bold">opt_mkint</emphasis></term>
64224 <listitem>
64225 <para>
64226 This is the same as <option>opt_int</option>, except that when such a value is output in a
64227 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
64228 printed with the suffix K or M.
64229 </para>
64230 </listitem></varlistentry>
64231 <varlistentry>
64232 <term><emphasis role="bold">opt_octint</emphasis></term>
64233 <listitem>
64234 <para>
64235 This also specifies an integer, but the value is always interpreted as an
64236 octal integer, whether or not it starts with the digit zero, and it is
64237 always output in octal.
64238 </para>
64239 </listitem></varlistentry>
64240 <varlistentry>
64241 <term><emphasis role="bold">opt_stringptr</emphasis></term>
64242 <listitem>
64243 <para>
64244 This specifies a string value; the address must be a pointer to a
64245 variable that points to a string (for example, of type <literal>uschar *</literal>).
64246 </para>
64247 </listitem></varlistentry>
64248 <varlistentry>
64249 <term><emphasis role="bold">opt_time</emphasis></term>
64250 <listitem>
64251 <para>
64252 This specifies a time interval value. The address must point to a variable of
64253 type <literal>int</literal>. The value that is placed there is a number of seconds.
64254 </para>
64255 </listitem></varlistentry>
64256 </variablelist>
64257 <para>
64258 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
64259 out the values of all the <function>local_scan()</function> options.
64260 </para>
64261 </section>
64262 <section id="SECID208">
64263 <title>Available Exim variables</title>
64264 <para>
64265 <indexterm role="concept">
64266 <primary><function>local_scan()</function> function</primary>
64267 <secondary>available Exim variables</secondary>
64268 </indexterm>
64269 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
64270 are the only ones that are guaranteed to be maintained from release to release.
64271 Note, however, that you can obtain the value of any Exim expansion variable,
64272 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
64273 C variables are as follows:
64274 </para>
64275 <variablelist>
64276 <varlistentry>
64277 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
64278 <listitem>
64279 <para>
64280 This variable contains the number of lines in the message&#x2019;s body.
64281 It is not valid if the <option>spool_files_wireformat</option> option is used.
64282 </para>
64283 </listitem></varlistentry>
64284 <varlistentry>
64285 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
64286 <listitem>
64287 <para>
64288 This variable contains the number of binary zero bytes in the message&#x2019;s body.
64289 It is not valid if the <option>spool_files_wireformat</option> option is used.
64290 </para>
64291 </listitem></varlistentry>
64292 <varlistentry>
64293 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
64294 <listitem>
64295 <para>
64296 This variable is set to zero when no debugging is taking place. Otherwise, it
64297 is a bitmap of debugging selectors. Two bits are identified for use in
64298 <function>local_scan()</function>; they are defined as macros:
64299 </para>
64300 <itemizedlist>
64301 <listitem>
64302 <para>
64303 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
64304 testing option that is not privileged &ndash; any caller may set it. All the
64305 other selector bits can be set only by admin users.
64306 </para>
64307 </listitem>
64308 <listitem>
64309 <para>
64310 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
64311 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
64312 of debugging bits.
64313 </para>
64314 </listitem>
64315 </itemizedlist>
64316 <para>
64317 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
64318 selected, you should use code like this:
64319 </para>
64320 <literallayout class="monospaced">
64321 if ((debug_selector &amp; D_local_scan) != 0)
64322   debug_printf("xxx", ...);
64323 </literallayout>
64324 </listitem></varlistentry>
64325 <varlistentry>
64326 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
64327 <listitem>
64328 <para>
64329 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
64330 variable <option>expand_string_message</option> contains the error message, zero-terminated.
64331 </para>
64332 </listitem></varlistentry>
64333 <varlistentry>
64334 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
64335 <listitem>
64336 <para>
64337 A pointer to a chain of header lines. The <option>header_line</option> structure is
64338 discussed below.
64339 </para>
64340 </listitem></varlistentry>
64341 <varlistentry>
64342 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
64343 <listitem>
64344 <para>
64345 A pointer to the last of the header lines.
64346 </para>
64347 </listitem></varlistentry>
64348 <varlistentry>
64349 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
64350 <listitem>
64351 <para>
64352 The value of the <option>headers_charset</option> configuration option.
64353 </para>
64354 </listitem></varlistentry>
64355 <varlistentry>
64356 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
64357 <listitem>
64358 <para>
64359 This variable is TRUE during a host checking session that is initiated by the
64360 <option>-bh</option> command line option.
64361 </para>
64362 </listitem></varlistentry>
64363 <varlistentry>
64364 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
64365 <listitem>
64366 <para>
64367 The IP address of the interface that received the message, as a string. This
64368 is NULL for locally submitted messages.
64369 </para>
64370 </listitem></varlistentry>
64371 <varlistentry>
64372 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
64373 <listitem>
64374 <para>
64375 The port on which this message was received. When testing with the <option>-bh</option>
64376 command line option, the value of this variable is -1 unless a port has been
64377 specified via the <option>-oMi</option> option.
64378 </para>
64379 </listitem></varlistentry>
64380 <varlistentry>
64381 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
64382 <listitem>
64383 <para>
64384 This variable contains Exim&#x2019;s message id for the incoming message (the value of
64385 <varname>$message_exim_id</varname>) as a zero-terminated string.
64386 </para>
64387 </listitem></varlistentry>
64388 <varlistentry>
64389 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
64390 <listitem>
64391 <para>
64392 The name of the protocol by which the message was received.
64393 </para>
64394 </listitem></varlistentry>
64395 <varlistentry>
64396 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
64397 <listitem>
64398 <para>
64399 The number of accepted recipients.
64400 </para>
64401 </listitem></varlistentry>
64402 <varlistentry>
64403 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
64404 <listitem>
64405 <para>
64406 <indexterm role="concept">
64407 <primary>recipient</primary>
64408 <secondary>adding in local scan</secondary>
64409 </indexterm>
64410 <indexterm role="concept">
64411 <primary>recipient</primary>
64412 <secondary>removing in local scan</secondary>
64413 </indexterm>
64414 The list of accepted recipients, held in a vector of length
64415 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
64416 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
64417 below). You can delete recipients by removing them from the vector and
64418 adjusting the value in <option>recipients_count</option>. In particular, by setting
64419 <option>recipients_count</option> to zero you remove all recipients. If you then return the
64420 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
64421 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
64422 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
64423 </para>
64424 </listitem></varlistentry>
64425 <varlistentry>
64426 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
64427 <listitem>
64428 <para>
64429 The envelope sender address. For bounce messages this is the empty string.
64430 </para>
64431 </listitem></varlistentry>
64432 <varlistentry>
64433 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
64434 <listitem>
64435 <para>
64436 The IP address of the sending host, as a string. This is NULL for
64437 locally-submitted messages.
64438 </para>
64439 </listitem></varlistentry>
64440 <varlistentry>
64441 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
64442 <listitem>
64443 <para>
64444 The name of the authentication mechanism that was used, or NULL if the message
64445 was not received over an authenticated SMTP connection.
64446 </para>
64447 </listitem></varlistentry>
64448 <varlistentry>
64449 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
64450 <listitem>
64451 <para>
64452 The name of the sending host, if known.
64453 </para>
64454 </listitem></varlistentry>
64455 <varlistentry>
64456 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
64457 <listitem>
64458 <para>
64459 The port on the sending host.
64460 </para>
64461 </listitem></varlistentry>
64462 <varlistentry>
64463 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
64464 <listitem>
64465 <para>
64466 This variable is TRUE for all SMTP input, including BSMTP.
64467 </para>
64468 </listitem></varlistentry>
64469 <varlistentry>
64470 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
64471 <listitem>
64472 <para>
64473 This variable is TRUE for BSMTP input.
64474 </para>
64475 </listitem></varlistentry>
64476 <varlistentry>
64477 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
64478 <listitem>
64479 <para>
64480 The contents of this variable control which pool of memory is used for new
64481 requests. See section <xref linkend="SECTmemhanloc"/> for details.
64482 </para>
64483 </listitem></varlistentry>
64484 </variablelist>
64485 </section>
64486 <section id="SECID209">
64487 <title>Structure of header lines</title>
64488 <para>
64489 The <option>header_line</option> structure contains the members listed below.
64490 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
64491 (see below). You can cause header lines to be ignored (deleted) by setting
64492 their type to *.
64493 </para>
64494 <variablelist>
64495 <varlistentry>
64496 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
64497 <listitem>
64498 <para>
64499 A pointer to the next header line, or NULL for the last line.
64500 </para>
64501 </listitem></varlistentry>
64502 <varlistentry>
64503 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
64504 <listitem>
64505 <para>
64506 A code identifying certain headers that Exim recognizes. The codes are printing
64507 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
64508 Notice in particular that any header line whose type is * is not transmitted
64509 with the message. This flagging is used for header lines that have been
64510 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
64511 lines.) Effectively, * means <quote>deleted</quote>.
64512 </para>
64513 </listitem></varlistentry>
64514 <varlistentry>
64515 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
64516 <listitem>
64517 <para>
64518 The number of characters in the header line, including the terminating and any
64519 internal newlines.
64520 </para>
64521 </listitem></varlistentry>
64522 <varlistentry>
64523 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
64524 <listitem>
64525 <para>
64526 A pointer to the text of the header. It always ends with a newline, followed by
64527 a zero byte. Internal newlines are preserved.
64528 </para>
64529 </listitem></varlistentry>
64530 </variablelist>
64531 </section>
64532 <section id="SECID210">
64533 <title>Structure of recipient items</title>
64534 <para>
64535 The <option>recipient_item</option> structure contains these members:
64536 </para>
64537 <variablelist>
64538 <varlistentry>
64539 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
64540 <listitem>
64541 <para>
64542 This is a pointer to the recipient address as it was received.
64543 </para>
64544 </listitem></varlistentry>
64545 <varlistentry>
64546 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
64547 <listitem>
64548 <para>
64549 This is used in later Exim processing when top level addresses are created by
64550 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
64551 and must always contain -1 at this stage.
64552 </para>
64553 </listitem></varlistentry>
64554 <varlistentry>
64555 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
64556 <listitem>
64557 <para>
64558 If this value is not NULL, bounce messages caused by failing to deliver to the
64559 recipient are sent to the address it contains. In other words, it overrides the
64560 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
64561 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
64562 an unqualified address, Exim qualifies it using the domain from
64563 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
64564 is NULL for all recipients.
64565 </para>
64566 </listitem></varlistentry>
64567 </variablelist>
64568 </section>
64569 <section id="SECID211">
64570 <title>Available Exim functions</title>
64571 <para>
64572 <indexterm role="concept">
64573 <primary><function>local_scan()</function> function</primary>
64574 <secondary>available Exim functions</secondary>
64575 </indexterm>
64576 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
64577 These are the only ones that are guaranteed to be maintained from release to
64578 release:
64579 </para>
64580 <variablelist>
64581 <varlistentry>
64582 <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>
64583 <listitem>
64584 <para>
64585 This function creates a child process that runs the command specified by
64586 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
64587 be NULL if no environment variables are to be passed. A new umask is supplied
64588 for the process in <option>newumask</option>.
64589 </para>
64590 <para>
64591 Pipes to the standard input and output of the new process are set up
64592 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
64593 standard error is cloned to the standard output. If there are any file
64594 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
64595 argument is TRUE, the new process is made into a process group leader.
64596 </para>
64597 <para>
64598 The function returns the pid of the new process, or -1 if things go wrong.
64599 </para>
64600 </listitem></varlistentry>
64601 <varlistentry>
64602 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
64603 <listitem>
64604 <para>
64605 This function waits for a child process to terminate, or for a timeout (in
64606 seconds) to expire. A timeout value of zero means wait as long as it takes. The
64607 return value is as follows:
64608 </para>
64609 <itemizedlist>
64610 <listitem>
64611 <para>
64612 &gt;= 0
64613 </para>
64614 <para>
64615 The process terminated by a normal exit and the value is the process
64616 ending status.
64617 </para>
64618 </listitem>
64619 <listitem>
64620 <para>
64621 &lt; 0 and &gt; &ndash;256
64622 </para>
64623 <para>
64624 The process was terminated by a signal and the value is the negation of the
64625 signal number.
64626 </para>
64627 </listitem>
64628 <listitem>
64629 <para>
64630 &ndash;256
64631 </para>
64632 <para>
64633 The process timed out.
64634 </para>
64635 </listitem>
64636 <listitem>
64637 <para>
64638 &ndash;257
64639 </para>
64640 <para>
64641 The was some other error in wait(); <option>errno</option> is still set.
64642 </para>
64643 </listitem>
64644 </itemizedlist>
64645 </listitem></varlistentry>
64646 <varlistentry>
64647 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
64648 <listitem>
64649 <para>
64650 This function provide you with a means of submitting a new message to
64651 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
64652 want, but this packages it all up for you.) The function creates a pipe,
64653 forks a subprocess that is running
64654 </para>
64655 <literallayout class="monospaced">
64656 exim -t -oem -oi -f &lt;&gt;
64657 </literallayout>
64658 <para>
64659 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
64660 that is connected to the standard input. The yield of the function is the PID
64661 of the subprocess. You can then write a message to the file descriptor, with
64662 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
64663 </para>
64664 <para>
64665 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
64666 finish and to collect its ending status. A timeout value of zero is usually
64667 fine in this circumstance. Unless you have made a mistake with the recipient
64668 addresses, you should get a return code of zero.
64669 </para>
64670 </listitem></varlistentry>
64671 <varlistentry>
64672 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
64673 <listitem>
64674 <para>
64675 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
64676 that it runs is:
64677 </para>
64678 <literallayout>
64679 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
64680 </literallayout>
64681 <para>
64682 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
64683 </para>
64684 </listitem></varlistentry>
64685 <varlistentry>
64686 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
64687 <listitem>
64688 <para>
64689 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
64690 output is written to the standard error stream. If no debugging is selected,
64691 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
64692 conditional on the <literal>local_scan</literal> debug selector by coding like this:
64693 </para>
64694 <literallayout class="monospaced">
64695 if ((debug_selector &amp; D_local_scan) != 0)
64696   debug_printf("xxx", ...);
64697 </literallayout>
64698 </listitem></varlistentry>
64699 <varlistentry>
64700 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
64701 <listitem>
64702 <para>
64703 This is an interface to Exim&#x2019;s string expansion code. The return value is the
64704 expanded string, or NULL if there was an expansion failure.
64705 The C variable <option>expand_string_message</option> contains an error message after an
64706 expansion failure. If expansion does not change the string, the return value is
64707 the pointer to the input string. Otherwise, the return value points to a new
64708 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
64709 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
64710 </para>
64711 </listitem></varlistentry>
64712 <varlistentry>
64713 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
64714 <listitem>
64715 <para>
64716 This function allows you to an add additional header line at the end of the
64717 existing ones. The first argument is the type, and should normally be a space
64718 character. The second argument is a format string and any number of
64719 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
64720 if you want, and you must ensure that the string ends with a newline.
64721 </para>
64722 </listitem></varlistentry>
64723 <varlistentry>
64724 <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>
64725 <listitem>
64726 <para>
64727 This function adds a new header line at a specified point in the header
64728 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
64729 </para>
64730 <para>
64731 If <option>name</option> is NULL, the new header is added at the end of the chain if
64732 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
64733 NULL, the header lines are searched for the first non-deleted header that
64734 matches the name. If one is found, the new header is added before it if
64735 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
64736 found header and any adjacent subsequent ones with the same name (even if
64737 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
64738 option controls where the header is added. If it is true, addition is at the
64739 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
64740 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
64741 </para>
64742 <literallayout class="monospaced">
64743 header_add_at_position(TRUE, US"Received", TRUE,
64744   ' ', "X-xxx: ...");
64745 </literallayout>
64746 <para>
64747 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
64748 there may not be if <option>received_header_text</option> expands to an empty string.
64749 </para>
64750 </listitem></varlistentry>
64751 <varlistentry>
64752 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
64753 <listitem>
64754 <para>
64755 This function removes header lines. If <option>occurrence</option> is zero or negative, all
64756 occurrences of the header are removed. If occurrence is greater than zero, that
64757 particular instance of the header is removed. If no header(s) can be found that
64758 match the specification, the function does nothing.
64759 </para>
64760 </listitem></varlistentry>
64761 <varlistentry>
64762 <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>
64763 <listitem>
64764 <para>
64765 This function tests whether the given header has the given name. It is not just
64766 a string comparison, because white space is permitted between the name and the
64767 colon. If the <option>notdel</option> argument is true, a false return is forced for all
64768 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
64769 </para>
64770 <literallayout class="monospaced">
64771 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
64772 </literallayout>
64773 </listitem></varlistentry>
64774 <varlistentry>
64775 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
64776 <listitem>
64777 <para>
64778 <indexterm role="concept">
64779 <primary>base64 encoding</primary>
64780 <secondary>functions for <function>local_scan()</function> use</secondary>
64781 </indexterm>
64782 This function base64-encodes a string, which is passed by address and length.
64783 The text may contain bytes of any value, including zero. The result is passed
64784 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
64785 zero-terminated.
64786 </para>
64787 </listitem></varlistentry>
64788 <varlistentry>
64789 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
64790 <listitem>
64791 <para>
64792 This function decodes a base64-encoded string. Its arguments are a
64793 zero-terminated base64-encoded string and the address of a variable that is set
64794 to point to the result, which is in dynamic memory. The length of the decoded
64795 string is the yield of the function. If the input is invalid base64 data, the
64796 yield is -1. A zero byte is added to the end of the output string to make it
64797 easy to interpret as a C string (assuming it contains no zeros of its own). The
64798 added zero byte is not included in the returned count.
64799 </para>
64800 </listitem></varlistentry>
64801 <varlistentry>
64802 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
64803 <listitem>
64804 <para>
64805 This function checks for a match in a domain list. Domains are always
64806 matched caselessly. The return value is one of the following:
64807 </para>
64808 <literallayout>
64809 <literal>OK     </literal> match succeeded
64810 <literal>FAIL   </literal> match failed
64811 <literal>DEFER  </literal> match deferred
64812 </literallayout>
64813 <para>
64814 DEFER is usually caused by some kind of lookup defer, such as the
64815 inability to contact a database.
64816 </para>
64817 </listitem></varlistentry>
64818 <varlistentry>
64819 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
64820 <listitem>
64821 <para>
64822 This function checks for a match in a local part list. The third argument
64823 controls case-sensitivity. The return values are as for
64824 <emphasis>lss_match_domain()</emphasis>.
64825 </para>
64826 </listitem></varlistentry>
64827 <varlistentry>
64828 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
64829 <listitem>
64830 <para>
64831 This function checks for a match in an address list. The third argument
64832 controls the case-sensitivity of the local part match. The domain is always
64833 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
64834 </para>
64835 </listitem></varlistentry>
64836 <varlistentry>
64837 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
64838 <listitem>
64839 <para>
64840 This function checks for a match in a host list. The most common usage is
64841 expected to be
64842 </para>
64843 <literallayout class="monospaced">
64844 lss_match_host(sender_host_name, sender_host_address, ...)
64845 </literallayout>
64846 <para>
64847 <indexterm role="variable">
64848 <primary><varname>$sender_host_address</varname></primary>
64849 </indexterm>
64850 An empty address field matches an empty item in the host list. If the host name
64851 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
64852 looked up if a host name is required to match an item in the list. The return
64853 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
64854 returns ERROR in the case when it had to look up a host name, but the lookup
64855 failed.
64856 </para>
64857 </listitem></varlistentry>
64858 <varlistentry>
64859 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
64860 <listitem>
64861 <para>
64862 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
64863 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
64864 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
64865 them. It specifies to which log or logs the message is written. The remaining
64866 arguments are a format and relevant insertion arguments. The string should not
64867 contain any newlines, not even at the end.
64868 </para>
64869 </listitem></varlistentry>
64870 <varlistentry>
64871 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
64872 <listitem>
64873 <para>
64874 This function adds an additional recipient to the message. The first argument
64875 is the recipient address. If it is unqualified (has no domain), it is qualified
64876 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
64877 </para>
64878 <para>
64879 This function does not allow you to specify a private <option>errors_to</option> address (as
64880 described with the structure of <option>recipient_item</option> above), because it pre-dates
64881 the addition of that field to the structure. However, it is easy to add such a
64882 value afterwards. For example:
64883 </para>
64884 <literallayout class="monospaced">
64885  receive_add_recipient(US"monitor@mydom.example", -1);
64886  recipients_list[recipients_count-1].errors_to =
64887    US"postmaster@mydom.example";
64888 </literallayout>
64889 </listitem></varlistentry>
64890 <varlistentry>
64891 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
64892 <listitem>
64893 <para>
64894 This is a convenience function to remove a named recipient from the list of
64895 recipients. It returns true if a recipient was removed, and false if no
64896 matching recipient could be found. The argument must be a complete email
64897 address.
64898 </para>
64899 </listitem></varlistentry>
64900 </variablelist>
64901 <para>
64902 <indexterm role="concept">
64903 <primary>RFC 2047</primary>
64904 </indexterm>
64905 </para>
64906 <variablelist>
64907 <varlistentry>
64908 <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>
64909 <listitem>
64910 <para>
64911 This function decodes strings that are encoded according to RFC 2047. Typically
64912 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
64913 from the Q or B encoding into a byte-string. Then, if provided with the name of
64914 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
64915 made  to translate the result to the named character set. If this fails, the
64916 binary string is returned with an error message.
64917 </para>
64918 <para>
64919 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
64920 maximum MIME word length is enforced. The third argument is the target
64921 encoding, or NULL if no translation is wanted.
64922 </para>
64923 <para>
64924 <indexterm role="concept">
64925 <primary>binary zero</primary>
64926 <secondary>in RFC 2047 decoding</secondary>
64927 </indexterm>
64928 <indexterm role="concept">
64929 <primary>RFC 2047</primary>
64930 <secondary>binary zero in</secondary>
64931 </indexterm>
64932 If a binary zero is encountered in the decoded string, it is replaced by the
64933 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
64934 not be 0 because header lines are handled as zero-terminated strings.
64935 </para>
64936 <para>
64937 The function returns the result of processing the string, zero-terminated; if
64938 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
64939 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
64940 </para>
64941 <para>
64942 If an error is encountered, the function returns NULL and uses the <option>error</option>
64943 argument to return an error message. The variable pointed to by <option>error</option> is
64944 set to NULL if there is no error; it may be set non-NULL even when the function
64945 returns a non-NULL value if decoding was successful, but there was a problem
64946 with translation.
64947 </para>
64948 </listitem></varlistentry>
64949 <varlistentry>
64950 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
64951 <listitem>
64952 <para>
64953 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
64954 below.
64955 </para>
64956 </listitem></varlistentry>
64957 <varlistentry>
64958 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,BOOL,&nbsp;...)</emphasis></term>
64959 <listitem>
64960 <para>
64961 The arguments of this function are almost like <function>printf()</function>; it writes to the SMTP
64962 output stream. You should use this function only when there is an SMTP output
64963 stream, that is, when the incoming message is being received via interactive
64964 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
64965 is FALSE. If you want to test for an incoming message from another host (as
64966 opposed to a local process that used the <option>-bs</option> command line option), you can
64967 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
64968 is involved.
64969 </para>
64970 <para>
64971 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
64972 output function, so it can be used for all forms of SMTP connection.
64973 </para>
64974 <para>
64975 The second argument is used to request that the data be buffered
64976 (when TRUE) or flushed (along with any previously buffered, when FALSE).
64977 This is advisory only, but likely to save on system-calls and packets
64978 sent when a sequence of calls to the function are made.
64979 </para>
64980 <para>
64981 The argument was added in Exim version 4.90 - changing the API/ABI.
64982 Nobody noticed until 4.93 was imminent, at which point the
64983 ABI version number was incremented.
64984 </para>
64985 <para>
64986 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
64987 must start with an appropriate response code: 550 if you are going to return
64988 LOCAL_SCAN_REJECT, 451 if you are going to return
64989 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
64990 initial lines of a multi-line response, the code must be followed by a hyphen
64991 to indicate that the line is not the final response line. You must also ensure
64992 that the lines you write terminate with CRLF. For example:
64993 </para>
64994 <literallayout class="monospaced">
64995 smtp_printf("550-this is some extra info\r\n");
64996 return LOCAL_SCAN_REJECT;
64997 </literallayout>
64998 <para>
64999 Note that you can also create multi-line responses by including newlines in
65000 the data returned via the <option>return_text</option> argument. The added value of using
65001 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
65002 multiple output lines.
65003 </para>
65004 <para>
65005 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
65006 does not
65007 guarantee a flush of
65008 pending output, and therefore does not test
65009 the state of the stream. (In the main code of Exim, flushing and error
65010 detection is done when Exim is ready for the next SMTP input command.) If
65011 you want to flush the output and check for an error (for example, the
65012 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
65013 arguments. It flushes the output stream, and returns a non-zero value if there
65014 is an error.
65015 </para>
65016 </listitem></varlistentry>
65017 <varlistentry revisionflag="changed">
65018 <term><emphasis role="bold">void&nbsp;*store_get(int,BOOL)</emphasis></term>
65019 <listitem>
65020 <para revisionflag="changed">
65021 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
65022 chunk of memory whose size is given by the first argument.
65023 The second argument should be given as TRUE if the memory will be used for
65024 data possibly coming from an attacker (eg. the message content),
65025 FALSE if it is locally-sourced.
65026 Exim bombs out if it ever
65027 runs out of memory. See the next section for a discussion of memory handling.
65028 </para>
65029 </listitem></varlistentry>
65030 <varlistentry>
65031 <term><emphasis role="bold">void&nbsp;*store_get_perm(int,BOOL)</emphasis></term>
65032 <listitem>
65033 <para>
65034 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
65035 permanent pool. See the next section for a discussion of memory handling.
65036 </para>
65037 </listitem></varlistentry>
65038 <varlistentry>
65039 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
65040 <listitem>
65041 <para>
65042 See below.
65043 </para>
65044 </listitem></varlistentry>
65045 <varlistentry>
65046 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
65047 <listitem>
65048 <para>
65049 See below.
65050 </para>
65051 </listitem></varlistentry>
65052 <varlistentry>
65053 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
65054 <listitem>
65055 <para>
65056 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
65057 The first makes a copy of an entire string. The second copies up to a maximum
65058 number of characters, indicated by the second argument. The third uses a format
65059 and insertion arguments to create a new string. In each case, the result is a
65060 pointer to a new string in the current memory pool. See the next section for
65061 more discussion.
65062 </para>
65063 </listitem></varlistentry>
65064 </variablelist>
65065 </section>
65066 <section id="SECTmemhanloc">
65067 <title>More about Exim&#x2019;s memory handling</title>
65068 <para>
65069 <indexterm role="concept">
65070 <primary><function>local_scan()</function> function</primary>
65071 <secondary>memory handling</secondary>
65072 </indexterm>
65073 No function is provided for freeing memory, because that is never needed.
65074 The dynamic memory that Exim uses when receiving a message is automatically
65075 recycled if another message is received by the same process (this applies only
65076 to incoming SMTP connections &ndash; other input methods can supply only one
65077 message at a time). After receiving the last message, a reception process
65078 terminates.
65079 </para>
65080 <para>
65081 Because it is recycled, the normal dynamic memory cannot be used for holding
65082 data that must be preserved over a number of incoming messages on the same SMTP
65083 connection. However, Exim in fact uses two pools of dynamic memory; the second
65084 one is not recycled, and can be used for this purpose.
65085 </para>
65086 <para>
65087 If you want to allocate memory that remains available for subsequent messages
65088 in the same SMTP connection, you should set
65089 </para>
65090 <literallayout class="monospaced">
65091 store_pool = POOL_PERM
65092 </literallayout>
65093 <para>
65094 before calling the function that does the allocation. There is no need to
65095 restore the value if you do not need to; however, if you do want to revert to
65096 the normal pool, you can either restore the previous value of <option>store_pool</option> or
65097 set it explicitly to POOL_MAIN.
65098 </para>
65099 <para>
65100 The pool setting applies to all functions that get dynamic memory, including
65101 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
65102 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
65103 block of memory from the permanent pool while preserving the value of
65104 <option>store_pool</option>.
65105 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
65106 </para>
65107 </section>
65108 </chapter>
65109
65110 <chapter id="CHAPsystemfilter">
65111 <title>System-wide message filtering</title>
65112 <para>
65113 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
65114 <primary>filter</primary>
65115 <secondary>system filter</secondary>
65116 </indexterm>
65117 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
65118 <primary>filtering all mail</primary>
65119 </indexterm>
65120 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
65121 <primary>system filter</primary>
65122 </indexterm>
65123 The previous chapters (on ACLs and the local scan function) describe checks
65124 that can be applied to messages before they are accepted by a host. There is
65125 also a mechanism for checking messages once they have been received, but before
65126 they are delivered. This is called the <emphasis>system filter</emphasis>.
65127 </para>
65128 <para>
65129 The system filter operates in a similar manner to users&#x2019; filter files, but it
65130 is run just once per message (however many recipients the message has).
65131 It should not normally be used as a substitute for routing, because <option>deliver</option>
65132 commands in a system router provide new envelope recipient addresses.
65133 The system filter must be an Exim filter. It cannot be a Sieve filter.
65134 </para>
65135 <para>
65136 The system filter is run at the start of a delivery attempt, before any routing
65137 is done. If a message fails to be completely delivered at the first attempt,
65138 the system filter is run again at the start of every retry.
65139 If you want your filter to do something only once per message, you can make use
65140 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
65141 prevent it happening on retries.
65142 </para>
65143 <para>
65144 <indexterm role="variable">
65145 <primary><varname>$domain</varname></primary>
65146 </indexterm>
65147 <indexterm role="variable">
65148 <primary><varname>$local_part</varname></primary>
65149 </indexterm>
65150 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
65151 specific to individual recipient addresses, such as <varname>$local_part</varname> and
65152 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
65153 you want to run a centrally-specified filter for each recipient address
65154 independently, you can do so by setting up a suitable <command>redirect</command> router, as
65155 described in section <xref linkend="SECTperaddfil"/> below.
65156 </para>
65157 <section id="SECID212">
65158 <title>Specifying a system filter</title>
65159 <para>
65160 <indexterm role="concept">
65161 <primary>uid (user id)</primary>
65162 <secondary>system filter</secondary>
65163 </indexterm>
65164 <indexterm role="concept">
65165 <primary>gid (group id)</primary>
65166 <secondary>system filter</secondary>
65167 </indexterm>
65168 The name of the file that contains the system filter must be specified by
65169 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
65170 other than root, you must also set <option>system_filter_user</option> and
65171 <option>system_filter_group</option> as appropriate. For example:
65172 </para>
65173 <literallayout class="monospaced">
65174 system_filter = /etc/mail/exim.filter
65175 system_filter_user = exim
65176 </literallayout>
65177 <para>
65178 If a system filter generates any deliveries directly to files or pipes (via the
65179 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
65180 specified by setting <option>system_filter_file_transport</option> and
65181 <option>system_filter_pipe_transport</option>, respectively. Similarly,
65182 <option>system_filter_reply_transport</option> must be set to handle any messages generated
65183 by the <option>reply</option> command.
65184 </para>
65185 </section>
65186 <section id="SECID213">
65187 <title>Testing a system filter</title>
65188 <para>
65189 You can run simple tests of a system filter in the same way as for a user
65190 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
65191 are permitted only in system filters are recognized.
65192 </para>
65193 <para>
65194 If you want to test the combined effect of a system filter and a user filter,
65195 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
65196 </para>
65197 </section>
65198 <section id="SECID214">
65199 <title>Contents of a system filter</title>
65200 <para>
65201 The language used to specify system filters is the same as for users&#x2019; filter
65202 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
65203 mail filtering</emphasis>. However, there are some additional features that are
65204 available only in system filters; these are described in subsequent sections.
65205 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
65206 they cause errors.
65207 </para>
65208 <para>
65209 <indexterm role="concept">
65210 <primary>frozen messages</primary>
65211 <secondary>manual thaw; testing in filter</secondary>
65212 </indexterm>
65213 There are two special conditions which, though available in users&#x2019; filter
65214 files, are designed for use in system filters. The condition <option>first_delivery</option>
65215 is true only for the first attempt at delivering a message, and
65216 <option>manually_thawed</option> is true only if the message has been frozen, and
65217 subsequently thawed by an admin user. An explicit forced delivery counts as a
65218 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
65219 </para>
65220 <para>
65221 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
65222 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
65223 succeed, it will not be tried again.
65224 If you want Exim to retry an unseen delivery until it succeeds, you should
65225 arrange to set it up every time the filter runs.
65226 </para>
65227 <para>
65228 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
65229 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
65230 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
65231 to which users&#x2019; filter files can refer.
65232 </para>
65233 </section>
65234 <section id="SECID215">
65235 <title>Additional variable for system filters</title>
65236 <para>
65237 <indexterm role="variable">
65238 <primary><varname>$recipients</varname></primary>
65239 </indexterm>
65240 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
65241 of the message (separated by commas and white space), is available in system
65242 filters. It is not available in users&#x2019; filters for privacy reasons.
65243 </para>
65244 </section>
65245 <section id="SECID216">
65246 <title>Defer, freeze, and fail commands for system filters</title>
65247 <para>
65248 <indexterm role="concept">
65249 <primary>freezing messages</primary>
65250 </indexterm>
65251 <indexterm role="concept">
65252 <primary>message</primary>
65253 <secondary>freezing</secondary>
65254 </indexterm>
65255 <indexterm role="concept">
65256 <primary>message</primary>
65257 <secondary>forced failure</secondary>
65258 </indexterm>
65259 <indexterm role="concept">
65260 <primary><option>fail</option></primary>
65261 <secondary>in system filter</secondary>
65262 </indexterm>
65263 <indexterm role="concept">
65264 <primary><option>freeze</option> in system filter</primary>
65265 </indexterm>
65266 <indexterm role="concept">
65267 <primary><option>defer</option> in system filter</primary>
65268 </indexterm>
65269 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
65270 always available in system filters, but are not normally enabled in users&#x2019;
65271 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
65272 for the <command>redirect</command> router.) These commands can optionally be followed by the
65273 word <option>text</option> and a string containing an error message, for example:
65274 </para>
65275 <literallayout class="monospaced">
65276 fail text "this message looks like spam to me"
65277 </literallayout>
65278 <para>
65279 The keyword <option>text</option> is optional if the next character is a double quote.
65280 </para>
65281 <para>
65282 The <option>defer</option> command defers delivery of the original recipients of the
65283 message. The <option>fail</option> command causes all the original recipients to be failed,
65284 and a bounce message to be created. The <option>freeze</option> command suspends all
65285 delivery attempts for the original recipients. In all cases, any new deliveries
65286 that are specified by the filter are attempted as normal after the filter has
65287 run.
65288 </para>
65289 <para>
65290 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
65291 not manually frozen since. This means that automatic freezing by a system
65292 filter can be used as a way of checking out suspicious messages. If a message
65293 is found to be all right, manually unfreezing it allows it to be delivered.
65294 </para>
65295 <para>
65296 <indexterm role="concept">
65297 <primary>log</primary>
65298 <secondary><option>fail</option> command log line</secondary>
65299 </indexterm>
65300 <indexterm role="concept">
65301 <primary><option>fail</option></primary>
65302 <secondary>log line; reducing</secondary>
65303 </indexterm>
65304 The text given with a fail command is used as part of the bounce message as
65305 well as being written to the log. If the message is quite long, this can fill
65306 up a lot of log space when such failures are common. To reduce the size of the
65307 log message, Exim interprets the text in a special way if it starts with the
65308 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
65309 strings is written to the log, and the rest of the text is used in the bounce
65310 message. For example:
65311 </para>
65312 <literallayout class="monospaced">
65313 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
65314      because it contains attachments that we are \
65315      not prepared to receive."
65316 </literallayout>
65317 <para>
65318 <indexterm role="concept">
65319 <primary>loop</primary>
65320 <secondary>caused by <option>fail</option></secondary>
65321 </indexterm>
65322 Take great care with the <option>fail</option> command when basing the decision to fail on
65323 the contents of the message, because the bounce message will of course include
65324 the contents of the original message and will therefore trigger the <option>fail</option>
65325 command again (causing a mail loop) unless steps are taken to prevent this.
65326 Testing the <option>error_message</option> condition is one way to prevent this. You could
65327 use, for example
65328 </para>
65329 <literallayout class="monospaced">
65330 if $message_body contains "this is spam" and not error_message
65331 then fail text "spam is not wanted here" endif
65332 </literallayout>
65333 <para>
65334 though of course that might let through unwanted bounce messages. The
65335 alternative is clever checking of the body and/or headers to detect bounces
65336 generated by the filter.
65337 </para>
65338 <para>
65339 The interpretation of a system filter file ceases after a
65340 <option>defer</option>,
65341 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
65342 set up earlier in the filter file are honoured, so you can use a sequence such
65343 as
65344 </para>
65345 <literallayout class="monospaced">
65346 mail ...
65347 freeze
65348 </literallayout>
65349 <para>
65350 to send a specified message when the system filter is freezing (or deferring or
65351 failing) a message. The normal deliveries for the message do not, of course,
65352 take place.
65353 </para>
65354 </section>
65355 <section id="SECTaddremheasys">
65356 <title>Adding and removing headers in a system filter</title>
65357 <para>
65358 <indexterm role="concept">
65359 <primary>header lines</primary>
65360 <secondary>adding; in system filter</secondary>
65361 </indexterm>
65362 <indexterm role="concept">
65363 <primary>header lines</primary>
65364 <secondary>removing; in system filter</secondary>
65365 </indexterm>
65366 <indexterm role="concept">
65367 <primary>filter</primary>
65368 <secondary>header lines; adding/removing</secondary>
65369 </indexterm>
65370 Two filter commands that are available only in system filters are:
65371 </para>
65372 <literallayout class="monospaced">
65373 headers add &lt;string&gt;
65374 headers remove &lt;string&gt;
65375 </literallayout>
65376 <para>
65377 The argument for the <option>headers add</option> is a string that is expanded and then
65378 added to the end of the message&#x2019;s headers. It is the responsibility of the
65379 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
65380 space is ignored, and if the string is otherwise empty, or if the expansion is
65381 forced to fail, the command has no effect.
65382 </para>
65383 <para>
65384 You can use <quote>\n</quote> within the string, followed by white space, to specify
65385 continued header lines. More than one header may be added in one command by
65386 including <quote>\n</quote> within the string without any following white space. For
65387 example:
65388 </para>
65389 <literallayout class="monospaced">
65390 headers add "X-header-1: ....\n  \
65391              continuation of X-header-1 ...\n\
65392              X-header-2: ...."
65393 </literallayout>
65394 <para>
65395 Note that the header line continuation white space after the first newline must
65396 be placed before the backslash that continues the input string, because white
65397 space after input continuations is ignored.
65398 </para>
65399 <para>
65400 The argument for <option>headers remove</option> is a colon-separated list of header names.
65401 This command applies only to those headers that are stored with the message;
65402 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
65403 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
65404 header with the same name, they are all removed.
65405 </para>
65406 <para>
65407 The <option>headers</option> command in a system filter makes an immediate change to the set
65408 of header lines that was received with the message (with possible additions
65409 from ACL processing). Subsequent commands in the system filter operate on the
65410 modified set, which also forms the basis for subsequent message delivery.
65411 Unless further modified during routing or transporting, this set of headers is
65412 used for all recipients of the message.
65413 </para>
65414 <para>
65415 During routing and transporting, the variables that refer to the contents of
65416 header lines refer only to those lines that are in this set. Thus, header lines
65417 that are added by a system filter are visible to users&#x2019; filter files and to all
65418 routers and transports. This contrasts with the manipulation of header lines by
65419 routers and transports, which is not immediate, but which instead is saved up
65420 until the message is actually being written (see section
65421 <xref linkend="SECTheadersaddrem"/>).
65422 </para>
65423 <para>
65424 If the message is not delivered at the first attempt, header lines that were
65425 added by the system filter are stored with the message, and so are still
65426 present at the next delivery attempt. Header lines that were removed are still
65427 present, but marked <quote>deleted</quote> so that they are not transported with the
65428 message. For this reason, it is usual to make the <option>headers</option> command
65429 conditional on <option>first_delivery</option> so that the set of header lines is not
65430 modified more than once.
65431 </para>
65432 <para>
65433 Because header modification in a system filter acts immediately, you have to
65434 use an indirect approach if you want to modify the contents of a header line.
65435 For example:
65436 </para>
65437 <literallayout class="monospaced">
65438 headers add "Old-Subject: $h_subject:"
65439 headers remove "Subject"
65440 headers add "Subject: new subject (was: $h_old-subject:)"
65441 headers remove "Old-Subject"
65442 </literallayout>
65443 </section>
65444 <section id="SECID217">
65445 <title>Setting an errors address in a system filter</title>
65446 <para>
65447 <indexterm role="concept">
65448 <primary>envelope from</primary>
65449 </indexterm>
65450 <indexterm role="concept">
65451 <primary>envelope sender</primary>
65452 </indexterm>
65453 In a system filter, if a <option>deliver</option> command is followed by
65454 </para>
65455 <literallayout class="monospaced">
65456 errors_to &lt;some address&gt;
65457 </literallayout>
65458 <para>
65459 in order to change the envelope sender (and hence the error reporting) for that
65460 delivery, any address may be specified. (In a user filter, only the current
65461 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
65462 might use
65463 </para>
65464 <literallayout class="monospaced">
65465 unseen deliver monitor@spying.example errors_to root@local.example
65466 </literallayout>
65467 <para>
65468 to take a copy which would not be sent back to the normal error reporting
65469 address if its delivery failed.
65470 </para>
65471 </section>
65472 <section id="SECTperaddfil">
65473 <title>Per-address filtering</title>
65474 <para>
65475 <indexterm role="variable">
65476 <primary><varname>$domain</varname></primary>
65477 </indexterm>
65478 <indexterm role="variable">
65479 <primary><varname>$local_part</varname></primary>
65480 </indexterm>
65481 In contrast to the system filter, which is run just once per message for each
65482 delivery attempt, it is also possible to set up a system-wide filtering
65483 operation that runs once for each recipient address. In this case, variables
65484 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
65485 filter file could be made dependent on them. This is an example of a router
65486 which implements such a filter:
65487 </para>
65488 <literallayout class="monospaced">
65489 central_filter:
65490   check_local_user
65491   driver = redirect
65492   domains = +local_domains
65493   file = /central/filters/$local_part_data
65494   no_verify
65495   allow_filter
65496   allow_freeze
65497 </literallayout>
65498 <para>
65499 The filter is run in a separate process under its own uid. Therefore, either
65500 <option>check_local_user</option> must be set (as above), in which case the filter is run as
65501 the local user, or the <option>user</option> option must be used to specify which user to
65502 use. If both are set, <option>user</option> overrides.
65503 </para>
65504 <para>
65505 Care should be taken to ensure that none of the commands in the filter file
65506 specify a significant delivery if the message is to go on to be delivered to
65507 its intended recipient. The router will not then claim to have dealt with the
65508 address, so it will be passed on to subsequent routers to be delivered in the
65509 normal way.
65510 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
65511 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
65512 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
65513 </para>
65514 </section>
65515 </chapter>
65516
65517 <chapter id="CHAPmsgproc">
65518 <title>Message processing</title>
65519 <para>
65520 <indexterm role="concept" id="IIDmesproc" class="startofrange">
65521 <primary>message</primary>
65522 <secondary>general processing</secondary>
65523 </indexterm>
65524 Exim performs various transformations on the sender and recipient addresses of
65525 all messages that it handles, and also on the messages&#x2019; header lines. Some of
65526 these are optional and configurable, while others always take place. All of
65527 this processing, except rewriting as a result of routing, and the addition or
65528 removal of header lines while delivering, happens when a message is received,
65529 before it is placed on Exim&#x2019;s queue.
65530 </para>
65531 <para>
65532 Some of the automatic processing takes place by default only for
65533 <quote>locally-originated</quote> messages. This adjective is used to describe messages
65534 that are not received over TCP/IP, but instead are passed to an Exim process on
65535 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
65536 set up by the <option>-bs</option> command line option.
65537 </para>
65538 <para>
65539 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
65540 or ::1) are not considered to be locally-originated. Exim does not treat the
65541 loopback interface specially in any way.
65542 </para>
65543 <para>
65544 If you want the loopback interface to be treated specially, you must ensure
65545 that there are appropriate entries in your ACLs.
65546 </para>
65547 <section id="SECTsubmodnon">
65548 <title>Submission mode for non-local messages</title>
65549 <para>
65550 <indexterm role="concept">
65551 <primary>message</primary>
65552 <secondary>submission</secondary>
65553 </indexterm>
65554 <indexterm role="concept">
65555 <primary>submission mode</primary>
65556 </indexterm>
65557 Processing that happens automatically for locally-originated messages (unless
65558 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
65559 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
65560 state. Submission mode is set by the modifier
65561 </para>
65562 <literallayout class="monospaced">
65563 control = submission
65564 </literallayout>
65565 <para>
65566 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
65567 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
65568 a local submission, and is normally used when the source of the message is
65569 known to be an MUA running on a client host (as opposed to an MTA). For
65570 example, to set submission mode for messages originating on the IPv4 loopback
65571 interface, you could include the following in the MAIL ACL:
65572 </para>
65573 <literallayout class="monospaced">
65574 warn  hosts = 127.0.0.1
65575       control = submission
65576 </literallayout>
65577 <para>
65578 <indexterm role="concept">
65579 <primary><option>sender_retain</option> submission option</primary>
65580 </indexterm>
65581 There are some options that can be used when setting submission mode. A slash
65582 is used to separate options. For example:
65583 </para>
65584 <literallayout class="monospaced">
65585 control = submission/sender_retain
65586 </literallayout>
65587 <para>
65588 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
65589 true and <option>local_from_check</option> false for the current incoming message. The first
65590 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
65591 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
65592 authenticated sender. With this setting, Exim still fixes up messages by adding
65593 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
65594 attempt to check sender authenticity in header lines.
65595 </para>
65596 <para>
65597 When <option>sender_retain</option> is not set, a submission mode setting may specify a
65598 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
65599 example:
65600 </para>
65601 <literallayout class="monospaced">
65602 control = submission/domain=some.domain
65603 </literallayout>
65604 <para>
65605 The domain may be empty. How this value is used is described in sections
65606 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
65607 that allows you to specify the user&#x2019;s full name for inclusion in a created
65608 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
65609 </para>
65610 <literallayout class="monospaced">
65611 accept authenticated = *
65612        control = submission/domain=wonderland.example/\
65613                             name=${lookup {$authenticated_id} \
65614                                    lsearch {/etc/exim/namelist}}
65615 </literallayout>
65616 <para>
65617 Because the name may contain any characters, including slashes, the <option>name</option>
65618 option must be given last. The remainder of the string is used as the name. For
65619 the example above, if <filename>/etc/exim/namelist</filename> contains:
65620 </para>
65621 <literallayout class="monospaced">
65622 bigegg:  Humpty Dumpty
65623 </literallayout>
65624 <para>
65625 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
65626 line would be:
65627 </para>
65628 <literallayout class="monospaced">
65629 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
65630 </literallayout>
65631 <para>
65632 <indexterm role="concept">
65633 <primary>return path</primary>
65634 <secondary>in submission mode</secondary>
65635 </indexterm>
65636 By default, submission mode forces the return path to the same address as is
65637 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
65638 specified, the return path is also left unchanged.
65639 </para>
65640 <para>
65641 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
65642 ACL. This means that any sender checks performed before the fix-ups use the
65643 untrusted sender address specified by the user, not the trusted sender address
65644 specified by submission mode. Although this might be slightly unexpected, it
65645 does mean that you can configure ACL checks to spot that a user is trying to
65646 spoof another&#x2019;s address.
65647 </para>
65648 </section>
65649 <section id="SECTlineendings">
65650 <title>Line endings</title>
65651 <para>
65652 <indexterm role="concept">
65653 <primary>line endings</primary>
65654 </indexterm>
65655 <indexterm role="concept">
65656 <primary>carriage return</primary>
65657 </indexterm>
65658 <indexterm role="concept">
65659 <primary>linefeed</primary>
65660 </indexterm>
65661 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
65662 linefeed) is the line ending for messages transmitted over the Internet using
65663 SMTP over TCP/IP. However, within individual operating systems, different
65664 conventions are used. For example, Unix-like systems use just LF, but others
65665 use CRLF or just CR.
65666 </para>
65667 <para>
65668 Exim was designed for Unix-like systems, and internally, it stores messages
65669 using the system&#x2019;s convention of a single LF as a line terminator. When
65670 receiving a message, all line endings are translated to this standard format.
65671 Originally, it was thought that programs that passed messages directly to an
65672 MTA within an operating system would use that system&#x2019;s convention. Experience
65673 has shown that this is not the case; for example, there are Unix applications
65674 that use CRLF in this circumstance. For this reason, and for compatibility with
65675 other MTAs, the way Exim handles line endings for all messages is now as
65676 follows:
65677 </para>
65678 <itemizedlist>
65679 <listitem>
65680 <para>
65681 LF not preceded by CR is treated as a line ending.
65682 </para>
65683 </listitem>
65684 <listitem>
65685 <para>
65686 CR is treated as a line ending; if it is immediately followed by LF, the LF
65687 is ignored.
65688 </para>
65689 </listitem>
65690 <listitem>
65691 <para>
65692 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
65693 nor a local message in the state where a line containing only a dot is a
65694 terminator.
65695 </para>
65696 </listitem>
65697 <listitem>
65698 <para>
65699 If a bare CR is encountered within a header line, an extra space is added after
65700 the line terminator so as not to end the header line. The reasoning behind this
65701 is that bare CRs in header lines are most likely either to be mistakes, or
65702 people trying to play silly games.
65703 </para>
65704 </listitem>
65705 <listitem>
65706 <para>
65707 If the first header line received in a message ends with CRLF, a subsequent
65708 bare LF in a header line is treated in the same way as a bare CR in a header
65709 line.
65710 </para>
65711 </listitem>
65712 </itemizedlist>
65713 </section>
65714 <section id="SECID218">
65715 <title>Unqualified addresses</title>
65716 <para>
65717 <indexterm role="concept">
65718 <primary>unqualified addresses</primary>
65719 </indexterm>
65720 <indexterm role="concept">
65721 <primary>address</primary>
65722 <secondary>qualification</secondary>
65723 </indexterm>
65724 By default, Exim expects every envelope address it receives from an external
65725 host to be fully qualified. Unqualified addresses cause negative responses to
65726 SMTP commands. However, because SMTP is used as a means of transporting
65727 messages from MUAs running on personal workstations, there is sometimes a
65728 requirement to accept unqualified addresses from specific hosts or IP networks.
65729 </para>
65730 <para>
65731 Exim has two options that separately control which hosts may send unqualified
65732 sender or recipient addresses in SMTP commands, namely
65733 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
65734 cases, if an unqualified address is accepted, it is qualified by adding the
65735 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
65736 </para>
65737 <para>
65738 <indexterm role="option">
65739 <primary><option>qualify_domain</option></primary>
65740 </indexterm>
65741 <indexterm role="option">
65742 <primary><option>qualify_recipient</option></primary>
65743 </indexterm>
65744 Unqualified addresses in header lines are automatically qualified for messages
65745 that are locally originated, unless the <option>-bnq</option> option is given on the command
65746 line. For messages received over SMTP, unqualified addresses in header lines
65747 are qualified only if unqualified addresses are permitted in SMTP commands. In
65748 other words, such qualification is also controlled by
65749 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
65750 </para>
65751 </section>
65752 <section id="SECID219">
65753 <title>The UUCP From line</title>
65754 <para>
65755 <indexterm role="concept">
65756 <primary><quote>From</quote> line</primary>
65757 </indexterm>
65758 <indexterm role="concept">
65759 <primary>UUCP</primary>
65760 <secondary><quote>From</quote> line</secondary>
65761 </indexterm>
65762 <indexterm role="concept">
65763 <primary>sender</primary>
65764 <secondary>address</secondary>
65765 </indexterm>
65766 <indexterm role="option">
65767 <primary><option>uucp_from_pattern</option></primary>
65768 </indexterm>
65769 <indexterm role="option">
65770 <primary><option>uucp_from_sender</option></primary>
65771 </indexterm>
65772 <indexterm role="concept">
65773 <primary>envelope from</primary>
65774 </indexterm>
65775 <indexterm role="concept">
65776 <primary>envelope sender</primary>
65777 </indexterm>
65778 <indexterm role="concept">
65779 <primary>Sendmail compatibility</primary>
65780 <secondary><quote>From</quote> line</secondary>
65781 </indexterm>
65782 Messages that have come from UUCP (and some other applications) often begin
65783 with a line containing the envelope sender and a timestamp, following the word
65784 <quote>From</quote>. Examples of two common formats are:
65785 </para>
65786 <literallayout class="monospaced">
65787 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
65788 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
65789 </literallayout>
65790 <para>
65791 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
65792 Exim recognizes such lines at the start of messages that are submitted to it
65793 via the command line (that is, on the standard input). It does not recognize
65794 such lines in incoming SMTP messages, unless the sending host matches
65795 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
65796 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
65797 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
65798 default value matches the two common cases shown above and puts the address
65799 that follows <quote>From</quote> into <varname>$1</varname>.
65800 </para>
65801 <para>
65802 <indexterm role="concept">
65803 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
65804 <secondary>in <quote>From </quote> line handling</secondary>
65805 </indexterm>
65806 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
65807 a trusted user, the message&#x2019;s sender address is constructed by expanding the
65808 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
65809 then parsed as an RFC 2822 address. If there is no domain, the local part is
65810 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
65811 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
65812 </para>
65813 <para>
65814 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
65815 sender address is not changed. This is also the case for incoming SMTP messages
65816 that are permitted to contain <quote>From</quote> lines.
65817 </para>
65818 <para>
65819 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
65820 treated as a data line that starts the body of the message, as it is not valid
65821 as a header line. This also happens if a <quote>From</quote> line is present in an
65822 incoming SMTP message from a source that is not permitted to send them.
65823 </para>
65824 </section>
65825 <section id="SECID220">
65826 <title>Resent- header lines</title>
65827 <para>
65828 <indexterm role="concept">
65829 <primary><option>Resent-</option> header lines</primary>
65830 </indexterm>
65831 <indexterm role="concept">
65832 <primary>header lines</primary>
65833 <secondary>Resent-</secondary>
65834 </indexterm>
65835 RFC 2822 makes provision for sets of header lines starting with the string
65836 <literal>Resent-</literal> to be added to a message when it is resent by the original
65837 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
65838 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
65839 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
65840 </para>
65841 <blockquote>
65842 <para>
65843 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
65844 processing of replies or other such automatic actions on messages.</emphasis>
65845 </para>
65846 </blockquote>
65847 <para>
65848 This leaves things a bit vague as far as other processing actions such as
65849 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
65850 follows:
65851 </para>
65852 <itemizedlist>
65853 <listitem>
65854 <para>
65855 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
65856 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
65857 </para>
65858 </listitem>
65859 <listitem>
65860 <para>
65861 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
65862 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
65863 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
65864 </para>
65865 </listitem>
65866 <listitem>
65867 <para>
65868 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
65869 also removed.
65870 </para>
65871 </listitem>
65872 <listitem>
65873 <para>
65874 For a locally-submitted message,
65875 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
65876 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
65877 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
65878 included in log lines in this case.
65879 </para>
65880 </listitem>
65881 <listitem>
65882 <para>
65883 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
65884 <option>Resent-</option> header lines are present.
65885 </para>
65886 </listitem>
65887 </itemizedlist>
65888 </section>
65889 <section id="SECID221">
65890 <title>The Auto-Submitted: header line</title>
65891 <para>
65892 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
65893 includes the header line:
65894 </para>
65895 <literallayout class="monospaced">
65896 Auto-Submitted: auto-replied
65897 </literallayout>
65898 </section>
65899 <section id="SECID222">
65900 <title>The Bcc: header line</title>
65901 <para>
65902 <indexterm role="concept">
65903 <primary><emphasis>Bcc:</emphasis> header line</primary>
65904 </indexterm>
65905 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
65906 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
65907 extracting its addresses). If <option>-t</option> is not present on the command line, any
65908 existing <emphasis>Bcc:</emphasis> is not removed.
65909 </para>
65910 </section>
65911 <section id="SECID223">
65912 <title>The Date: header line</title>
65913 <para>
65914 <indexterm role="concept">
65915 <primary><emphasis>Date:</emphasis> header line</primary>
65916 </indexterm>
65917 <indexterm role="concept">
65918 <primary>header lines</primary>
65919 <secondary>Date:</secondary>
65920 </indexterm>
65921 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
65922 Exim adds one, using the current date and time, unless the
65923 <option>suppress_local_fixups</option> control has been specified.
65924 </para>
65925 </section>
65926 <section id="SECID224">
65927 <title>The Delivery-date: header line</title>
65928 <para>
65929 <indexterm role="concept">
65930 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
65931 </indexterm>
65932 <indexterm role="option">
65933 <primary><option>delivery_date_remove</option></primary>
65934 </indexterm>
65935 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
65936 set. Exim can be configured to add them to the final delivery of messages. (See
65937 the generic <option>delivery_date_add</option> transport option.) They should not be present
65938 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
65939 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
65940 messages.
65941 </para>
65942 </section>
65943 <section id="SECID225">
65944 <title>The Envelope-to: header line</title>
65945 <para>
65946 <indexterm role="concept">
65947 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
65948 </indexterm>
65949 <indexterm role="concept">
65950 <primary>header lines</primary>
65951 <secondary>Envelope-to:</secondary>
65952 </indexterm>
65953 <indexterm role="option">
65954 <primary><option>envelope_to_remove</option></primary>
65955 </indexterm>
65956 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
65957 Exim can be configured to add them to the final delivery of messages. (See the
65958 generic <option>envelope_to_add</option> transport option.) They should not be present in
65959 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
65960 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
65961 messages.
65962 </para>
65963 </section>
65964 <section id="SECTthefrohea">
65965 <title>The From: header line</title>
65966 <para>
65967 <indexterm role="concept">
65968 <primary><emphasis>From:</emphasis> header line</primary>
65969 </indexterm>
65970 <indexterm role="concept">
65971 <primary>header lines</primary>
65972 <secondary>From:</secondary>
65973 </indexterm>
65974 <indexterm role="concept">
65975 <primary>Sendmail compatibility</primary>
65976 <secondary><quote>From</quote> line</secondary>
65977 </indexterm>
65978 <indexterm role="concept">
65979 <primary>message</primary>
65980 <secondary>submission</secondary>
65981 </indexterm>
65982 <indexterm role="concept">
65983 <primary>submission mode</primary>
65984 </indexterm>
65985 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
65986 adds one if either of the following conditions is true:
65987 </para>
65988 <itemizedlist>
65989 <listitem>
65990 <para>
65991 The envelope sender address is not empty (that is, this is not a bounce
65992 message). The added header line copies the envelope sender address.
65993 </para>
65994 </listitem>
65995 <listitem>
65996 <para>
65997 <indexterm role="variable">
65998 <primary><varname>$authenticated_id</varname></primary>
65999 </indexterm>
66000 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
66001 </para>
66002 <orderedlist numeration="arabic">
66003 <listitem>
66004 <para>
66005 <indexterm role="variable">
66006 <primary><varname>$qualify_domain</varname></primary>
66007 </indexterm>
66008 If no domain is specified by the submission control, the local part is
66009 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
66010 </para>
66011 </listitem>
66012 <listitem>
66013 <para>
66014 If a non-empty domain is specified by the submission control, the local
66015 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
66016 </para>
66017 </listitem>
66018 <listitem>
66019 <para>
66020 If an empty domain is specified by the submission control,
66021 <varname>$authenticated_id</varname> is assumed to be the complete address.
66022 </para>
66023 </listitem>
66024 </orderedlist>
66025 </listitem>
66026 </itemizedlist>
66027 <para>
66028 A non-empty envelope sender takes precedence.
66029 </para>
66030 <para>
66031 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
66032 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
66033 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
66034 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
66035 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
66036 <option>unknown_login</option> configuration option). The address is qualified with
66037 <option>qualify_domain</option>.
66038 </para>
66039 <para>
66040 For compatibility with Sendmail, if an incoming, non-SMTP message has a
66041 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
66042 user, this is replaced by an address containing the user&#x2019;s login name and full
66043 name as described in section <xref linkend="SECTconstr"/>.
66044 </para>
66045 </section>
66046 <section id="SECID226">
66047 <title>The Message-ID: header line</title>
66048 <para>
66049 <indexterm role="concept">
66050 <primary><emphasis>Message-ID:</emphasis> header line</primary>
66051 </indexterm>
66052 <indexterm role="concept">
66053 <primary>header lines</primary>
66054 <secondary>Message-ID:</secondary>
66055 </indexterm>
66056 <indexterm role="concept">
66057 <primary>message</primary>
66058 <secondary>submission</secondary>
66059 </indexterm>
66060 <indexterm role="option">
66061 <primary><option>message_id_header_text</option></primary>
66062 </indexterm>
66063 If a locally-generated or submission-mode incoming message does not contain a
66064 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
66065 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
66066 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
66067 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
66068 message id, preceded by the letter E to ensure it starts with a letter, and
66069 followed by @ and the primary host name. Additional information can be included
66070 in this header line by setting the <option>message_id_header_text</option> and/or
66071 <option>message_id_header_domain</option> options.
66072 </para>
66073 </section>
66074 <section id="SECID227">
66075 <title>The Received: header line</title>
66076 <para>
66077 <indexterm role="concept">
66078 <primary><emphasis>Received:</emphasis> header line</primary>
66079 </indexterm>
66080 <indexterm role="concept">
66081 <primary>header lines</primary>
66082 <secondary>Received:</secondary>
66083 </indexterm>
66084 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
66085 contents are defined by the <option>received_header_text</option> configuration option, and
66086 Exim automatically adds a semicolon and a timestamp to the configured string.
66087 </para>
66088 <para>
66089 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
66090 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
66091 line is the time that the message started to be received. This is the value
66092 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
66093 </para>
66094 <para>
66095 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
66096 changed to the time of acceptance, which is (apart from a small delay while the
66097 -H spool file is written) the earliest time at which delivery could start.
66098 </para>
66099 </section>
66100 <section id="SECID228">
66101 <title>The References: header line</title>
66102 <para>
66103 <indexterm role="concept">
66104 <primary><emphasis>References:</emphasis> header line</primary>
66105 </indexterm>
66106 <indexterm role="concept">
66107 <primary>header lines</primary>
66108 <secondary>References:</secondary>
66109 </indexterm>
66110 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
66111 header line. This is constructed according to the rules that are described in
66112 section 3.64 of RFC 2822 (which states that replies should contain such a
66113 header line), and section 3.14 of RFC 3834 (which states that automatic
66114 responses are not different in this respect). However, because some mail
66115 processing software does not cope well with very long header lines, no more
66116 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
66117 incoming message. If there are more than 12, the first one and then the final
66118 11 are copied, before adding the message ID of the incoming message.
66119 </para>
66120 </section>
66121 <section id="SECID229">
66122 <title>The Return-path: header line</title>
66123 <para>
66124 <indexterm role="concept">
66125 <primary><emphasis>Return-path:</emphasis> header line</primary>
66126 </indexterm>
66127 <indexterm role="concept">
66128 <primary>header lines</primary>
66129 <secondary>Return-path:</secondary>
66130 </indexterm>
66131 <indexterm role="option">
66132 <primary><option>return_path_remove</option></primary>
66133 </indexterm>
66134 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
66135 it does the final delivery of messages. (See the generic <option>return_path_add</option>
66136 transport option.) Therefore, they should not be present in messages in
66137 transit. If the <option>return_path_remove</option> configuration option is set (the
66138 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
66139 </para>
66140 </section>
66141 <section id="SECTthesenhea">
66142 <title>The Sender: header line</title>
66143 <para>
66144 <indexterm role="concept">
66145 <primary><emphasis>Sender:</emphasis> header line</primary>
66146 </indexterm>
66147 <indexterm role="concept">
66148 <primary>message</primary>
66149 <secondary>submission</secondary>
66150 </indexterm>
66151 <indexterm role="concept">
66152 <primary>header lines</primary>
66153 <secondary>Sender:</secondary>
66154 </indexterm>
66155 For a locally-originated message from an untrusted user, Exim may remove an
66156 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
66157 these actions by setting the <option>local_sender_retain</option> option true, the
66158 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
66159 control setting.
66160 </para>
66161 <para>
66162 When a local message is received from an untrusted user and
66163 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
66164 control has not been set, a check is made to see if the address given in the
66165 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
66166 that is expected has the login name as the local part and the value of
66167 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
66168 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
66169 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
66170 line is added to the message.
66171 </para>
66172 <para>
66173 If you set <option>local_from_check</option> false, this checking does not occur. However,
66174 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
66175 <option>local_sender_retain</option> to be true. It is not possible to set both of these
66176 options true at the same time.
66177 </para>
66178 <para>
66179 <indexterm role="concept">
66180 <primary>submission mode</primary>
66181 </indexterm>
66182 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
66183 received over TCP/IP or for messages submitted by trusted users. However, when
66184 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
66185 not specified on the submission control, the following processing takes place:
66186 </para>
66187 <para>
66188 <indexterm role="variable">
66189 <primary><varname>$authenticated_id</varname></primary>
66190 </indexterm>
66191 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
66192 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
66193 created as follows:
66194 </para>
66195 <itemizedlist>
66196 <listitem>
66197 <para>
66198 <indexterm role="variable">
66199 <primary><varname>$qualify_domain</varname></primary>
66200 </indexterm>
66201 If no domain is specified by the submission control, the local part is
66202 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
66203 </para>
66204 </listitem>
66205 <listitem>
66206 <para>
66207 If a non-empty domain is specified by the submission control, the local part
66208 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
66209 </para>
66210 </listitem>
66211 <listitem>
66212 <para>
66213 If an empty domain is specified by the submission control,
66214 <varname>$authenticated_id</varname> is assumed to be the complete address.
66215 </para>
66216 </listitem>
66217 </itemizedlist>
66218 <para>
66219 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
66220 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
66221 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
66222 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
66223 </para>
66224 <para>
66225 <indexterm role="concept">
66226 <primary>return path</primary>
66227 <secondary>created from <emphasis>Sender:</emphasis></secondary>
66228 </indexterm>
66229 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
66230 the message (the envelope sender address) is changed to be the same address,
66231 except in the case of submission mode when <option>sender_retain</option> is specified.
66232 </para>
66233 </section>
66234 <section id="SECTheadersaddrem">
66235 <title>Adding and removing header lines in routers and transports</title>
66236 <para>
66237 <indexterm role="concept">
66238 <primary>header lines</primary>
66239 <secondary>adding; in router or transport</secondary>
66240 </indexterm>
66241 <indexterm role="concept">
66242 <primary>header lines</primary>
66243 <secondary>removing; in router or transport</secondary>
66244 </indexterm>
66245 When a message is delivered, the addition and removal of header lines can be
66246 specified in a system filter, or on any of the routers and transports that
66247 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
66248 modifying headers in a system filter. Header lines can also be added in an ACL
66249 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
66250 </para>
66251 <para>
66252 In contrast to what happens in a system filter, header modifications that are
66253 specified on routers and transports apply only to the particular recipient
66254 addresses that are being processed by those routers and transports. These
66255 changes do not actually take place until a copy of the message is being
66256 transported. Therefore, they do not affect the basic set of header lines, and
66257 they do not affect the values of the variables that refer to header lines.
66258 </para>
66259 <para>
66260 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
66261 the transport cannot refer to the modified header lines, because such
66262 expansions all occur before the message is actually transported.
66263 </para>
66264 <para>
66265 For both routers and transports, the argument of a <option>headers_add</option>
66266 option must be in the form of one or more RFC 2822 header lines, separated by
66267 newlines (coded as <quote>\n</quote>). For example:
66268 </para>
66269 <literallayout class="monospaced">
66270 headers_add = X-added-header: added by $primary_hostname\n\
66271               X-added-second: another added header line
66272 </literallayout>
66273 <para>
66274 Exim does not check the syntax of these added header lines.
66275 </para>
66276 <para>
66277 Multiple <option>headers_add</option> options for a single router or transport can be
66278 specified; the values will append to a single list of header lines.
66279 Each header-line is separately expanded.
66280 </para>
66281 <para>
66282 The argument of a <option>headers_remove</option> option must consist of a colon-separated
66283 list of header names. This is confusing, because header names themselves are
66284 often terminated by colons. In this case, the colons are the list separators,
66285 not part of the names. For example:
66286 </para>
66287 <literallayout class="monospaced">
66288 headers_remove = return-receipt-to:acknowledge-to
66289 </literallayout>
66290 <para>
66291 Multiple <option>headers_remove</option> options for a single router or transport can be
66292 specified; the arguments will append to a single header-names list.
66293 Each item is separately expanded.
66294 Note that colons in complex expansions which are used to
66295 form all or part of a <option>headers_remove</option> list
66296 will act as list separators.
66297 </para>
66298 <para>
66299 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
66300 items are expanded at routing time,
66301 and then associated with all addresses that are
66302 accepted by that router, and also with any new addresses that it generates. If
66303 an address passes through several routers as a result of aliasing or
66304 forwarding, the changes are cumulative.
66305 </para>
66306 <para>
66307 <indexterm role="option">
66308 <primary><option>unseen</option></primary>
66309 </indexterm>
66310 However, this does not apply to multiple routers that result from the use of
66311 the <option>unseen</option> option. Any header modifications that were specified by the
66312 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
66313 </para>
66314 <para>
66315 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
66316 settings cannot be delivered together in a batch, so a transport is always
66317 dealing with a set of addresses that have the same header-processing
66318 requirements.
66319 </para>
66320 <para>
66321 The transport starts by writing the original set of header lines that arrived
66322 with the message, possibly modified by the system filter. As it writes out
66323 these lines, it consults the list of header names that were attached to the
66324 recipient address(es) by <option>headers_remove</option> options in routers, and it also
66325 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
66326 names are on either of these lists are not written out. If there are multiple
66327 instances of any listed header, they are all skipped.
66328 </para>
66329 <para>
66330 After the remaining original header lines have been written, new header
66331 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
66332 the order in which they were attached to the address. These are followed by any
66333 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
66334 </para>
66335 <para>
66336 This way of handling header line modifications in routers and transports has
66337 the following consequences:
66338 </para>
66339 <itemizedlist>
66340 <listitem>
66341 <para>
66342 The original set of header lines, possibly modified by the system filter,
66343 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
66344 to it, at all times.
66345 </para>
66346 </listitem>
66347 <listitem>
66348 <para>
66349 Header lines that are added by a router&#x2019;s
66350 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
66351 expansion syntax in subsequent routers or the transport.
66352 </para>
66353 </listitem>
66354 <listitem>
66355 <para>
66356 Conversely, header lines that are specified for removal by <option>headers_remove</option>
66357 in a router remain visible to subsequent routers and the transport.
66358 </para>
66359 </listitem>
66360 <listitem>
66361 <para>
66362 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
66363 a later router or by a transport.
66364 </para>
66365 </listitem>
66366 <listitem>
66367 <para>
66368 An added header can refer to the contents of an original header that is to be
66369 removed, even it has the same name as the added header. For example:
66370 </para>
66371 <literallayout class="monospaced">
66372 headers_remove = subject
66373 headers_add = Subject: new subject (was: $h_subject:)
66374 </literallayout>
66375 </listitem>
66376 </itemizedlist>
66377 <para>
66378 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
66379 for a <command>redirect</command> router that has the <option>one_time</option> option set.
66380 </para>
66381 </section>
66382 <section id="SECTconstr">
66383 <title>Constructed addresses</title>
66384 <para>
66385 <indexterm role="concept">
66386 <primary>address</primary>
66387 <secondary>constructed</secondary>
66388 </indexterm>
66389 <indexterm role="concept">
66390 <primary>constructed address</primary>
66391 </indexterm>
66392 When Exim constructs a sender address for a locally-generated message, it uses
66393 the form
66394 </para>
66395 <literallayout>
66396 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
66397 </literallayout>
66398 <para>
66399 For example:
66400 </para>
66401 <literallayout class="monospaced">
66402 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
66403 </literallayout>
66404 <para>
66405 The user name is obtained from the <option>-F</option> command line option if set, or
66406 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
66407 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
66408 ampersand character, this is replaced by the login name with the first letter
66409 upper cased, as is conventional in a number of operating systems. See the
66410 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
66411 The <option>unknown_username</option> option can be used to specify user names in cases when
66412 there is no password file entry.
66413 </para>
66414 <para>
66415 <indexterm role="concept">
66416 <primary>RFC 2047</primary>
66417 </indexterm>
66418 In all cases, the user name is made to conform to RFC 2822 by quoting all or
66419 parts of it if necessary. In addition, if it contains any non-printing
66420 characters, it is encoded as described in RFC 2047, which defines a way of
66421 including non-ASCII characters in header lines. The value of the
66422 <option>headers_charset</option> option specifies the name of the encoding that is used (the
66423 characters are assumed to be in this encoding). The setting of
66424 <option>print_topbitchars</option> controls whether characters with the top bit set (that
66425 is, with codes greater than 127) count as printing characters or not.
66426 </para>
66427 </section>
66428 <section id="SECID230">
66429 <title>Case of local parts</title>
66430 <para>
66431 <indexterm role="concept">
66432 <primary>case of local parts</primary>
66433 </indexterm>
66434 <indexterm role="concept">
66435 <primary>local part</primary>
66436 <secondary>case of</secondary>
66437 </indexterm>
66438 RFC 2822 states that the case of letters in the local parts of addresses cannot
66439 be assumed to be non-significant. Exim preserves the case of local parts of
66440 addresses, but by default it uses a lower-cased form when it is routing,
66441 because on most Unix systems, usernames are in lower case and case-insensitive
66442 routing is required. However, any particular router can be made to use the
66443 original case for local parts by setting the <option>caseful_local_part</option> generic
66444 router option.
66445 </para>
66446 <para>
66447 <indexterm role="concept">
66448 <primary>mixed-case login names</primary>
66449 </indexterm>
66450 If you must have mixed-case user names on your system, the best way to proceed,
66451 assuming you want case-independent handling of incoming email, is to set up
66452 your first router to convert incoming local parts in your domains to the
66453 correct case by means of a file lookup. For example:
66454 </para>
66455 <literallayout class="monospaced">
66456 correct_case:
66457   driver = redirect
66458   domains = +local_domains
66459   data = ${lookup{$local_part}cdb\
66460               {/etc/usercased.cdb}{$value}fail}\
66461               @$domain
66462 </literallayout>
66463 <para>
66464 For this router, the local part is forced to lower case by the default action
66465 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
66466 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
66467 on any subsequent routers which process your domains, they will operate on
66468 local parts with the correct case in a case-sensitive manner.
66469 </para>
66470 </section>
66471 <section id="SECID231">
66472 <title>Dots in local parts</title>
66473 <para>
66474 <indexterm role="concept">
66475 <primary>dot</primary>
66476 <secondary>in local part</secondary>
66477 </indexterm>
66478 <indexterm role="concept">
66479 <primary>local part</primary>
66480 <secondary>dots in</secondary>
66481 </indexterm>
66482 RFC 2822 forbids empty components in local parts. That is, an unquoted local
66483 part may not begin or end with a dot, nor have two consecutive dots in the
66484 middle. However, it seems that many MTAs do not enforce this, so Exim permits
66485 empty components for compatibility.
66486 </para>
66487 </section>
66488 <section id="SECID232">
66489 <title>Rewriting addresses</title>
66490 <para>
66491 <indexterm role="concept">
66492 <primary>rewriting</primary>
66493 <secondary>addresses</secondary>
66494 </indexterm>
66495 Rewriting of sender and recipient addresses, and addresses in headers, can
66496 happen automatically, or as the result of configuration options, as described
66497 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
66498 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
66499 </para>
66500 <para>
66501 Automatic rewriting includes qualification, as mentioned above. The other case
66502 in which it can happen is when an incomplete non-local domain is given. The
66503 routing process may cause this to be expanded into the full domain name. For
66504 example, a header such as
66505 </para>
66506 <literallayout class="monospaced">
66507 To: hare@teaparty
66508 </literallayout>
66509 <para>
66510 might get rewritten as
66511 </para>
66512 <literallayout class="monospaced">
66513 To: hare@teaparty.wonderland.fict.example
66514 </literallayout>
66515 <para>
66516 Rewriting as a result of routing is the one kind of message processing that
66517 does not happen at input time, as it cannot be done until the address has
66518 been routed.
66519 </para>
66520 <para>
66521 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
66522 addresses have been routed, in case any of the headers get changed as a
66523 result of routing. However, doing this in practice would hold up many
66524 deliveries for unreasonable amounts of time, just because one address could not
66525 immediately be routed. Exim therefore does not delay other deliveries when
66526 routing of one or more addresses is deferred.
66527 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
66528 </para>
66529 </section>
66530 </chapter>
66531
66532 <chapter id="CHAPSMTP">
66533 <title>SMTP processing</title>
66534 <para>
66535 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
66536 <primary>SMTP</primary>
66537 <secondary>processing details</secondary>
66538 </indexterm>
66539 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
66540 <primary>LMTP</primary>
66541 <secondary>processing details</secondary>
66542 </indexterm>
66543 Exim supports a number of different ways of using the SMTP protocol, and its
66544 LMTP variant, which is an interactive protocol for transferring messages into a
66545 closed mail store application. This chapter contains details of how SMTP is
66546 processed. For incoming mail, the following are available:
66547 </para>
66548 <itemizedlist>
66549 <listitem>
66550 <para>
66551 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
66552 </para>
66553 </listitem>
66554 <listitem>
66555 <para>
66556 SMTP over the standard input and output (the <option>-bs</option> option);
66557 </para>
66558 </listitem>
66559 <listitem>
66560 <para>
66561 Batched SMTP on the standard input (the <option>-bS</option> option).
66562 </para>
66563 </listitem>
66564 </itemizedlist>
66565 <para>
66566 For mail delivery, the following are available:
66567 </para>
66568 <itemizedlist>
66569 <listitem>
66570 <para>
66571 SMTP over TCP/IP (the <command>smtp</command> transport);
66572 </para>
66573 </listitem>
66574 <listitem>
66575 <para>
66576 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
66577 <quote>lmtp</quote>);
66578 </para>
66579 </listitem>
66580 <listitem>
66581 <para>
66582 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
66583 transport);
66584 </para>
66585 </listitem>
66586 <listitem>
66587 <para>
66588 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
66589 the <option>use_bsmtp</option> option set).
66590 </para>
66591 </listitem>
66592 </itemizedlist>
66593 <para>
66594 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
66595 stored in or read from files (or pipes), in a format in which SMTP commands are
66596 used to contain the envelope information.
66597 </para>
66598 <section id="SECToutSMTPTCP">
66599 <title>Outgoing SMTP and LMTP over TCP/IP</title>
66600 <para>
66601 <indexterm role="concept">
66602 <primary>SMTP</primary>
66603 <secondary>outgoing over TCP/IP</secondary>
66604 </indexterm>
66605 <indexterm role="concept">
66606 <primary>outgoing SMTP over TCP/IP</primary>
66607 </indexterm>
66608 <indexterm role="concept">
66609 <primary>LMTP</primary>
66610 <secondary>over TCP/IP</secondary>
66611 </indexterm>
66612 <indexterm role="concept">
66613 <primary>outgoing LMTP over TCP/IP</primary>
66614 </indexterm>
66615 <indexterm role="concept">
66616 <primary>EHLO</primary>
66617 </indexterm>
66618 <indexterm role="concept">
66619 <primary>HELO</primary>
66620 </indexterm>
66621 <indexterm role="concept">
66622 <primary>SIZE</primary>
66623 <secondary>option on MAIL command</secondary>
66624 </indexterm>
66625 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
66626 The <option>protocol</option> option selects which protocol is to be used, but the actual
66627 processing is the same in both cases.
66628 </para>
66629 <para>
66630 <indexterm role="concept">
66631 <primary>ESMTP extensions</primary>
66632 <secondary>SIZE</secondary>
66633 </indexterm>
66634 If, in response to its EHLO command, Exim is told that the SIZE
66635 extension is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
66636 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
66637 <option>size_addition</option> option (default 1024) to allow for additions to the message
66638 such as per-transport header lines, or changes made in a
66639 <indexterm role="concept">
66640 <primary>transport</primary>
66641 <secondary>filter</secondary>
66642 </indexterm>
66643 <indexterm role="concept">
66644 <primary>filter</primary>
66645 <secondary>transport filter</secondary>
66646 </indexterm>
66647 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
66648 suppressed.
66649 </para>
66650 <para>
66651 If the remote server advertises support for PIPELINING, Exim uses the
66652 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
66653 required for the transaction.
66654 </para>
66655 <para>
66656 If the remote server advertises support for the STARTTLS command, and Exim
66657 was built to support TLS encryption, it tries to start a TLS session unless the
66658 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
66659 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
66660 is called for verification.
66661 </para>
66662 <para>
66663 If the remote server advertises support for the AUTH command, Exim scans
66664 the authenticators configuration for any suitable client settings, as described
66665 in chapter <xref linkend="CHAPSMTPAUTH"/>.
66666 </para>
66667 <para>
66668 <indexterm role="concept">
66669 <primary>carriage return</primary>
66670 </indexterm>
66671 <indexterm role="concept">
66672 <primary>linefeed</primary>
66673 </indexterm>
66674 Responses from the remote host are supposed to be terminated by CR followed by
66675 LF. However, there are known to be hosts that do not send CR characters, so in
66676 order to be able to interwork with such hosts, Exim treats LF on its own as a
66677 line terminator.
66678 </para>
66679 <para>
66680 If a message contains a number of different addresses, all those with the same
66681 characteristics (for example, the same envelope sender) that resolve to the
66682 same set of hosts, in the same order, are sent in a single SMTP transaction,
66683 even if they are for different domains, unless there are more than the setting
66684 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
66685 they are split into groups containing no more than <option>max_rcpt</option>s addresses
66686 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
66687 in parallel sessions. The order of hosts with identical MX values is not
66688 significant when checking whether addresses can be batched in this way.
66689 </para>
66690 <para>
66691 When the <command>smtp</command> transport suffers a temporary failure that is not
66692 message-related, Exim updates its transport-specific database, which contains
66693 records indexed by host name that remember which messages are waiting for each
66694 particular host. It also updates the retry database with new retry times.
66695 </para>
66696 <para>
66697 <indexterm role="concept">
66698 <primary>hints database</primary>
66699 <secondary>retry keys</secondary>
66700 </indexterm>
66701 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
66702 a multi-homed host is broken, it will soon be skipped most of the time.
66703 See the next section for more detail about error handling.
66704 </para>
66705 <para>
66706 <indexterm role="concept">
66707 <primary>SMTP</primary>
66708 <secondary>passed connection</secondary>
66709 </indexterm>
66710 <indexterm role="concept">
66711 <primary>SMTP</primary>
66712 <secondary>batching over TCP/IP</secondary>
66713 </indexterm>
66714 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
66715 looks in the hints database for the transport to see if there are any queued
66716 messages waiting for the host to which it is connected. If it finds one, it
66717 creates a new Exim process using the <option>-MC</option> option (which can only be used by
66718 a process running as root or the Exim user) and passes the TCP/IP socket to it
66719 so that it can deliver another message using the same socket. The new process
66720 does only those deliveries that are routed to the connected host, and may in
66721 turn pass the socket on to a third process, and so on.
66722 </para>
66723 <para>
66724 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
66725 limit the number of messages sent down a single TCP/IP connection.
66726 </para>
66727 <para>
66728 <indexterm role="concept">
66729 <primary>asterisk</primary>
66730 <secondary>after IP address</secondary>
66731 </indexterm>
66732 The second and subsequent messages delivered down an existing connection are
66733 identified in the main log by the addition of an asterisk after the closing
66734 square bracket of the IP address.
66735 </para>
66736 </section>
66737 <section id="SECToutSMTPerr">
66738 <title>Errors in outgoing SMTP</title>
66739 <para>
66740 <indexterm role="concept">
66741 <primary>error</primary>
66742 <secondary>in outgoing SMTP</secondary>
66743 </indexterm>
66744 <indexterm role="concept">
66745 <primary>SMTP</primary>
66746 <secondary>errors in outgoing</secondary>
66747 </indexterm>
66748 <indexterm role="concept">
66749 <primary>host</primary>
66750 <secondary>error</secondary>
66751 </indexterm>
66752 Three different kinds of error are recognized for outgoing SMTP: host errors,
66753 message errors, and recipient errors.
66754 </para>
66755 <variablelist>
66756 <varlistentry>
66757 <term><emphasis role="bold">Host errors</emphasis></term>
66758 <listitem>
66759 <para>
66760 A host error is not associated with a particular message or with a
66761 particular recipient of a message. The host errors are:
66762 </para>
66763 <itemizedlist>
66764 <listitem>
66765 <para>
66766 Connection refused or timed out,
66767 </para>
66768 </listitem>
66769 <listitem>
66770 <para>
66771 Any error response code on connection,
66772 </para>
66773 </listitem>
66774 <listitem>
66775 <para>
66776 Any error response code to EHLO or HELO,
66777 </para>
66778 </listitem>
66779 <listitem>
66780 <para>
66781 Loss of connection at any time, except after <quote>.</quote>,
66782 </para>
66783 </listitem>
66784 <listitem>
66785 <para>
66786 I/O errors at any time,
66787 </para>
66788 </listitem>
66789 <listitem>
66790 <para>
66791 Timeouts during the session, other than in response to MAIL, RCPT or
66792 the <quote>.</quote> at the end of the data.
66793 </para>
66794 </listitem>
66795 </itemizedlist>
66796 <para>
66797 For a host error, a permanent error response on connection, or in response to
66798 EHLO, causes all addresses routed to the host to be failed. Any other host
66799 error causes all addresses to be deferred, and retry data to be created for the
66800 host. It is not tried again, for any message, until its retry time arrives. If
66801 the current set of addresses are not all delivered in this run (to some
66802 alternative host), the message is added to the list of those waiting for this
66803 host, so if it is still undelivered when a subsequent successful delivery is
66804 made to the host, it will be sent down the same SMTP connection.
66805 </para>
66806 </listitem></varlistentry>
66807 <varlistentry>
66808 <term><emphasis role="bold">Message errors</emphasis></term>
66809 <listitem>
66810 <para>
66811 <indexterm role="concept">
66812 <primary>message</primary>
66813 <secondary>error</secondary>
66814 </indexterm>
66815 A message error is associated with a particular message when sent to a
66816 particular host, but not with a particular recipient of the message. The
66817 message errors are:
66818 </para>
66819 <itemizedlist>
66820 <listitem>
66821 <para>
66822 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
66823 the data,
66824 </para>
66825 </listitem>
66826 <listitem>
66827 <para>
66828 Timeout after MAIL,
66829 </para>
66830 </listitem>
66831 <listitem>
66832 <para>
66833 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
66834 timeout after the DATA command itself is treated as a host error, as is loss of
66835 connection at any other time.
66836 </para>
66837 </listitem>
66838 </itemizedlist>
66839 <para>
66840 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
66841 to be failed, and a delivery error report to be returned to the sender. A
66842 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
66843 addresses to be deferred. Retry data is not created for the host, but instead,
66844 a retry record for the combination of host plus message id is created. The
66845 message is not added to the list of those waiting for this host. This ensures
66846 that the failing message will not be sent to this host again until the retry
66847 time arrives. However, other messages that are routed to the host are not
66848 affected, so if it is some property of the message that is causing the error,
66849 it will not stop the delivery of other mail.
66850 </para>
66851 <para>
66852 If the remote host specified support for the SIZE parameter in its response
66853 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
66854 over-large message will cause a message error because the error arrives as a
66855 response to MAIL.
66856 </para>
66857 </listitem></varlistentry>
66858 <varlistentry>
66859 <term><emphasis role="bold">Recipient errors</emphasis></term>
66860 <listitem>
66861 <para>
66862 <indexterm role="concept">
66863 <primary>recipient</primary>
66864 <secondary>error</secondary>
66865 </indexterm>
66866 A recipient error is associated with a particular recipient of a message. The
66867 recipient errors are:
66868 </para>
66869 <itemizedlist>
66870 <listitem>
66871 <para>
66872 Any error response to RCPT,
66873 </para>
66874 </listitem>
66875 <listitem>
66876 <para>
66877 Timeout after RCPT.
66878 </para>
66879 </listitem>
66880 </itemizedlist>
66881 <para>
66882 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
66883 recipient address to be failed, and a bounce message to be returned to the
66884 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
66885 address to be deferred, and routing retry data to be created for it. This is
66886 used to delay processing of the address in subsequent queue runs, until its
66887 routing retry time arrives. This applies to all messages, but because it
66888 operates only in queue runs, one attempt will be made to deliver a new message
66889 to the failing address before the delay starts to operate. This ensures that,
66890 if the failure is really related to the message rather than the recipient
66891 (<quote>message too big for this recipient</quote> is a possible example), other messages
66892 have a chance of getting delivered. If a delivery to the address does succeed,
66893 the retry information gets cleared, so all stuck messages get tried again, and
66894 the retry clock is reset.
66895 </para>
66896 <para>
66897 The message is not added to the list of those waiting for this host. Use of the
66898 host for other messages is unaffected, and except in the case of a timeout,
66899 other recipients are processed independently, and may be successfully delivered
66900 in the current SMTP session. After a timeout it is of course impossible to
66901 proceed with the session, so all addresses get deferred. However, those other
66902 than the one that failed do not suffer any subsequent retry delays. Therefore,
66903 if one recipient is causing trouble, the others have a chance of getting
66904 through when a subsequent delivery attempt occurs before the failing
66905 recipient&#x2019;s retry time.
66906 </para>
66907 </listitem></varlistentry>
66908 </variablelist>
66909 <para>
66910 In all cases, if there are other hosts (or IP addresses) available for the
66911 current set of addresses (for example, from multiple MX records), they are
66912 tried in this run for any undelivered addresses, subject of course to their
66913 own retry data. In other words, recipient error retry data does not take effect
66914 until the next delivery attempt.
66915 </para>
66916 <para>
66917 Some hosts have been observed to give temporary error responses to every
66918 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
66919 would be nice if such circumstances could be recognized, and defer data for the
66920 host itself created, but this is not possible within the current Exim design.
66921 What actually happens is that retry data for every (host, message) combination
66922 is created.
66923 </para>
66924 <para>
66925 The reason that timeouts after MAIL and RCPT are treated specially is that
66926 these can sometimes arise as a result of the remote host&#x2019;s verification
66927 procedures. Exim makes this assumption, and treats them as if a temporary error
66928 response had been received. A timeout after <quote>.</quote> is treated specially because
66929 it is known that some broken implementations fail to recognize the end of the
66930 message if the last character of the last line is a binary zero. Thus, it is
66931 helpful to treat this case as a message error.
66932 </para>
66933 <para>
66934 Timeouts at other times are treated as host errors, assuming a problem with the
66935 host, or the connection to it. If a timeout after MAIL, RCPT,
66936 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
66937 the timeout is likely to occur at some other point in the dialogue, causing it
66938 then to be treated as a host error.
66939 </para>
66940 <para>
66941 There is experimental evidence that some MTAs drop the connection after the
66942 terminating <quote>.</quote> if they do not like the contents of the message for some
66943 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
66944 should be given. That is why Exim treats this case as a message rather than a
66945 host error, in order not to delay other messages to the same host.
66946 </para>
66947 </section>
66948 <section id="SECID233">
66949 <title>Incoming SMTP messages over TCP/IP</title>
66950 <para>
66951 <indexterm role="concept">
66952 <primary>SMTP</primary>
66953 <secondary>incoming over TCP/IP</secondary>
66954 </indexterm>
66955 <indexterm role="concept">
66956 <primary>incoming SMTP over TCP/IP</primary>
66957 </indexterm>
66958 <indexterm role="concept">
66959 <primary>inetd</primary>
66960 </indexterm>
66961 <indexterm role="concept">
66962 <primary>daemon</primary>
66963 </indexterm>
66964 Incoming SMTP messages can be accepted in one of two ways: by running a
66965 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
66966 <filename>/etc/inetd.conf</filename> should be like this:
66967 </para>
66968 <literallayout class="monospaced">
66969 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
66970 </literallayout>
66971 <para>
66972 Exim distinguishes between this case and the case of a locally running user
66973 agent using the <option>-bs</option> option by checking whether or not the standard input is
66974 a socket. When it is, either the port must be privileged (less than 1024), or
66975 the caller must be root or the Exim user. If any other user passes a socket
66976 with an unprivileged port number, Exim prints a message on the standard error
66977 stream and exits with an error code.
66978 </para>
66979 <para>
66980 By default, Exim does not make a log entry when a remote host connects or
66981 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
66982 unexpected. It can be made to write such log entries by setting the
66983 <option>smtp_connection</option> log selector.
66984 </para>
66985 <para>
66986 <indexterm role="concept">
66987 <primary>carriage return</primary>
66988 </indexterm>
66989 <indexterm role="concept">
66990 <primary>linefeed</primary>
66991 </indexterm>
66992 Commands from the remote host are supposed to be terminated by CR followed by
66993 LF. However, there are known to be hosts that do not send CR characters. In
66994 order to be able to interwork with such hosts, Exim treats LF on its own as a
66995 line terminator.
66996 Furthermore, because common code is used for receiving messages from all
66997 sources, a CR on its own is also interpreted as a line terminator. However, the
66998 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
66999 </para>
67000 <para>
67001 <indexterm role="concept">
67002 <primary>EHLO</primary>
67003 <secondary>invalid data</secondary>
67004 </indexterm>
67005 <indexterm role="concept">
67006 <primary>HELO</primary>
67007 <secondary>invalid data</secondary>
67008 </indexterm>
67009 One area that sometimes gives rise to problems concerns the EHLO or
67010 HELO commands. Some clients send syntactically invalid versions of these
67011 commands, which Exim rejects by default. (This is nothing to do with verifying
67012 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
67013 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
67014 match the broken hosts that send invalid commands.
67015 </para>
67016 <para>
67017 <indexterm role="concept">
67018 <primary>SIZE option on MAIL command</primary>
67019 </indexterm>
67020 <indexterm role="concept">
67021 <primary>MAIL</primary>
67022 <secondary>SIZE option</secondary>
67023 </indexterm>
67024 The amount of disk space available is checked whenever SIZE is received on
67025 a MAIL command, independently of whether <option>message_size_limit</option> or
67026 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
67027 false. A temporary error is given if there is not enough space. If
67028 <option>check_spool_space</option> is set, the check is for that amount of space plus the
67029 value given with SIZE, that is, it checks that the addition of the incoming
67030 message will not reduce the space below the threshold.
67031 </para>
67032 <para>
67033 When a message is successfully received, Exim includes the local message id in
67034 its response to the final <quote>.</quote> that terminates the data. If the remote host
67035 logs this text it can help with tracing what has happened to a message.
67036 </para>
67037 <para>
67038 The Exim daemon can limit the number of simultaneous incoming connections it is
67039 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
67040 number of simultaneous incoming connections from a single remote host (see the
67041 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
67042 rejected using the SMTP temporary error code 421.
67043 </para>
67044 <para>
67045 The Exim daemon does not rely on the SIGCHLD signal to detect when a
67046 subprocess has finished, as this can get lost at busy times. Instead, it looks
67047 for completed subprocesses every time it wakes up. Provided there are other
67048 things happening (new incoming calls, starts of queue runs), completed
67049 processes will be noticed and tidied away. On very quiet systems you may
67050 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
67051 it will be noticed when the daemon next wakes up.
67052 </para>
67053 <para>
67054 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
67055 and can also be set up to reject SMTP calls from non-reserved hosts at times of
67056 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
67057 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
67058 applies in both the daemon and <emphasis>inetd</emphasis> cases.
67059 </para>
67060 <para>
67061 Exim normally starts a delivery process for each message received, though this
67062 can be varied by means of the <option>-odq</option> command line option and the
67063 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
67064 number of simultaneously running delivery processes started in this way from
67065 SMTP input can be limited by the <option>smtp_accept_queue</option> and
67066 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
67067 subsequently received messages are just put on the input queue without starting
67068 a delivery process.
67069 </para>
67070 <para>
67071 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
67072 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
67073 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
67074 handled by an entirely independent Exim process. Control by load average is,
67075 however, available with <emphasis>inetd</emphasis>.
67076 </para>
67077 <para>
67078 Exim can be configured to verify addresses in incoming SMTP commands as they
67079 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
67080 to rewrite addresses at this time &ndash; before any syntax checking is done. See
67081 section <xref linkend="SECTrewriteS"/>.
67082 </para>
67083 <para>
67084 Exim can also be configured to limit the rate at which a client host submits
67085 MAIL and RCPT commands in a single SMTP session. See the
67086 <option>smtp_ratelimit_hosts</option> option.
67087 </para>
67088 </section>
67089 <section id="SECID234">
67090 <title>Unrecognized SMTP commands</title>
67091 <para>
67092 <indexterm role="concept">
67093 <primary>SMTP</primary>
67094 <secondary>unrecognized commands</secondary>
67095 </indexterm>
67096 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
67097 commands during a single SMTP connection, it drops the connection after sending
67098 the error response to the last command. The default value for
67099 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
67100 abuse that subvert web servers into making connections to SMTP ports; in these
67101 circumstances, a number of non-SMTP lines are sent first.
67102 </para>
67103 </section>
67104 <section id="SECID235">
67105 <title>Syntax and protocol errors in SMTP commands</title>
67106 <para>
67107 <indexterm role="concept">
67108 <primary>SMTP</primary>
67109 <secondary>syntax errors</secondary>
67110 </indexterm>
67111 <indexterm role="concept">
67112 <primary>SMTP</primary>
67113 <secondary>protocol errors</secondary>
67114 </indexterm>
67115 A syntax error is detected if an SMTP command is recognized, but there is
67116 something syntactically wrong with its data, for example, a malformed email
67117 address in a RCPT command. Protocol errors include invalid command
67118 sequencing such as RCPT before MAIL. If Exim receives more than
67119 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
67120 drops the connection after sending the error response to the last command. The
67121 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
67122 broken clients that loop sending bad commands (yes, it has been seen).
67123 </para>
67124 </section>
67125 <section id="SECID236">
67126 <title>Use of non-mail SMTP commands</title>
67127 <para>
67128 <indexterm role="concept">
67129 <primary>SMTP</primary>
67130 <secondary>non-mail commands</secondary>
67131 </indexterm>
67132 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
67133 DATA. Exim counts such commands, and drops the connection if there are too
67134 many of them in a single SMTP session. This action catches some
67135 denial-of-service attempts and things like repeated failing AUTHs, or a mad
67136 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
67137 defines what <quote>too many</quote> means. Its default value is 10.
67138 </para>
67139 <para>
67140 When a new message is expected, one occurrence of RSET is not counted. This
67141 allows a client to send one RSET between messages (this is not necessary,
67142 but some clients do it). Exim also allows one uncounted occurrence of HELO
67143 or EHLO, and one occurrence of STARTTLS between messages. After
67144 starting up a TLS session, another EHLO is expected, and so it too is not
67145 counted.
67146 </para>
67147 <para>
67148 The first occurrence of AUTH in a connection, or immediately following
67149 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
67150 RCPT, DATA, and QUIT are counted.
67151 </para>
67152 <para>
67153 You can control which hosts are subject to the limit set by
67154 <option>smtp_accept_max_nonmail</option> by setting
67155 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
67156 the limit apply to all hosts. This option means that you can exclude any
67157 specific badly-behaved hosts that you have to live with.
67158 </para>
67159 </section>
67160 <section id="SECID237">
67161 <title>The VRFY and EXPN commands</title>
67162 <para>
67163 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
67164 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
67165 appropriate) in order to decide whether the command should be accepted or not.
67166 </para>
67167 <para>
67168 <indexterm role="concept">
67169 <primary>VRFY</primary>
67170 <secondary>processing</secondary>
67171 </indexterm>
67172 When no ACL is defined for VRFY, or if it rejects without
67173 setting an explicit response code, the command is accepted
67174 (with a 252 SMTP response code)
67175 in order to support awkward clients that do a VRFY before every RCPT.
67176 When VRFY is accepted, it runs exactly the same code as when Exim is
67177 called with the <option>-bv</option> option, and returns 250/451/550
67178 SMTP response codes.
67179 </para>
67180 <para>
67181 <indexterm role="concept">
67182 <primary>EXPN</primary>
67183 <secondary>processing</secondary>
67184 </indexterm>
67185 If no ACL for EXPN is defined, the command is rejected.
67186 When EXPN is accepted, a single-level expansion of the address is done.
67187 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
67188 than a verification (the <option>-bv</option> option). If an unqualified local part is given
67189 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
67190 of VRFY and EXPN commands are logged on the main and reject logs, and
67191 VRFY verification failures are logged on the main log for consistency with
67192 RCPT failures.
67193 </para>
67194 </section>
67195 <section id="SECTETRN">
67196 <title>The ETRN command</title>
67197 <para>
67198 <indexterm role="concept">
67199 <primary>ETRN</primary>
67200 <secondary>processing</secondary>
67201 </indexterm>
67202 <indexterm role="concept">
67203 <primary>ESMTP extensions</primary>
67204 <secondary>ETRN</secondary>
67205 </indexterm>
67206 RFC 1985 describes an ESMTP command called ETRN that is designed to
67207 overcome the security problems of the TURN command (which has fallen into
67208 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
67209 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
67210 should be accepted or not. If no ACL is defined, the command is rejected.
67211 </para>
67212 <para>
67213 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
67214 delivery to certain hosts. As Exim does not organize its message queue by host,
67215 the only form of ETRN that is supported by default is the one where the
67216 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
67217 specific to the SMTP server. A valid ETRN command causes a run of Exim with
67218 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
67219 argument. For example,
67220 </para>
67221 <literallayout class="monospaced">
67222 ETRN #brigadoon
67223 </literallayout>
67224 <para>
67225 runs the command
67226 </para>
67227 <literallayout class="monospaced">
67228 exim -R brigadoon
67229 </literallayout>
67230 <para>
67231 which causes a delivery attempt on all messages with undelivered addresses
67232 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
67233 default), Exim prevents the simultaneous execution of more than one queue run
67234 for the same argument string as a result of an ETRN command. This stops
67235 a misbehaving client from starting more than one queue runner at once.
67236 </para>
67237 <para>
67238 <indexterm role="concept">
67239 <primary>hints database</primary>
67240 <secondary>ETRN serialization</secondary>
67241 </indexterm>
67242 Exim implements the serialization by means of a hints database in which a
67243 record is written whenever a process is started by ETRN, and deleted when
67244 the process completes. However, Exim does not keep the SMTP session waiting for
67245 the ETRN process to complete. Once ETRN is accepted, the client is sent
67246 a <quote>success</quote> return code. Obviously there is scope for hints records to get
67247 left lying around if there is a system or program crash. To guard against this,
67248 Exim ignores any records that are more than six hours old.
67249 </para>
67250 <para>
67251 <indexterm role="option">
67252 <primary><option>smtp_etrn_command</option></primary>
67253 </indexterm>
67254 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
67255 used. This specifies a command that is run whenever ETRN is received,
67256 whatever the form of its argument. For
67257 example:
67258 </para>
67259 <literallayout class="monospaced">
67260 smtp_etrn_command = /etc/etrn_command $domain \
67261                     $sender_host_address
67262 </literallayout>
67263 <para>
67264 <indexterm role="variable">
67265 <primary><varname>$domain</varname></primary>
67266 </indexterm>
67267 The string is split up into arguments which are independently expanded. The
67268 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
67269 and no syntax checking is done on the contents of this argument. Exim does not
67270 wait for the command to complete, so its status code is not checked. Exim runs
67271 under its own uid and gid when receiving incoming SMTP, so it is not possible
67272 for it to change them before running the command.
67273 </para>
67274 </section>
67275 <section id="SECID238">
67276 <title>Incoming local SMTP</title>
67277 <para>
67278 <indexterm role="concept">
67279 <primary>SMTP</primary>
67280 <secondary>local incoming</secondary>
67281 </indexterm>
67282 Some user agents use SMTP to pass messages to their local MTA using the
67283 standard input and output, as opposed to passing the envelope on the command
67284 line and writing the message to the standard input. This is supported by the
67285 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
67286 messages over TCP/IP (including the use of ACLs), except that the envelope
67287 sender given in a MAIL command is ignored unless the caller is trusted. In
67288 an ACL you can detect this form of SMTP input by testing for an empty host
67289 identification. It is common to have this as the first line in the ACL that
67290 runs for RCPT commands:
67291 </para>
67292 <literallayout class="monospaced">
67293 accept hosts = :
67294 </literallayout>
67295 <para>
67296 This accepts SMTP messages from local processes without doing any other tests.
67297 </para>
67298 </section>
67299 <section id="SECTbatchSMTP">
67300 <title>Outgoing batched SMTP</title>
67301 <para>
67302 <indexterm role="concept">
67303 <primary>SMTP</primary>
67304 <secondary>batched outgoing</secondary>
67305 </indexterm>
67306 <indexterm role="concept">
67307 <primary>batched SMTP output</primary>
67308 </indexterm>
67309 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
67310 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
67311 be output in BSMTP format. No SMTP responses are possible for this form of
67312 delivery. All it is doing is using SMTP commands as a way of transmitting the
67313 envelope along with the message.
67314 </para>
67315 <para>
67316 The message is written to the file or pipe preceded by the SMTP commands
67317 MAIL and RCPT, and followed by a line containing a single dot. Lines in
67318 the message that start with a dot have an extra dot added. The SMTP command
67319 HELO is not normally used. If it is required, the <option>message_prefix</option> option
67320 can be used to specify it.
67321 </para>
67322 <para>
67323 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
67324 one recipient address at a time by default. However, you can arrange for them
67325 to handle several addresses at once by setting the <option>batch_max</option> option. When
67326 this is done for BSMTP, messages may contain multiple RCPT commands. See
67327 chapter <xref linkend="CHAPbatching"/> for more details.
67328 </para>
67329 <para>
67330 <indexterm role="variable">
67331 <primary><varname>$host</varname></primary>
67332 </indexterm>
67333 When one or more addresses are routed to a BSMTP transport by a router that
67334 sets up a host list, the name of the first host on the list is available to the
67335 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
67336 router:
67337 </para>
67338 <literallayout class="monospaced">
67339 begin routers
67340 route_append:
67341   driver = manualroute
67342   transport = smtp_appendfile
67343   route_list = domain.example  batch.host.example
67344
67345 begin transports
67346 smtp_appendfile:
67347   driver = appendfile
67348   directory = /var/bsmtp/$host
67349   batch_max = 1000
67350   use_bsmtp
67351   user = exim
67352 </literallayout>
67353 <para>
67354 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
67355 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
67356 message (unless there are more than 1000 recipients).
67357 </para>
67358 </section>
67359 <section id="SECTincomingbatchedSMTP">
67360 <title>Incoming batched SMTP</title>
67361 <para>
67362 <indexterm role="concept">
67363 <primary>SMTP</primary>
67364 <secondary>batched incoming</secondary>
67365 </indexterm>
67366 <indexterm role="concept">
67367 <primary>batched SMTP input</primary>
67368 </indexterm>
67369 The <option>-bS</option> command line option causes Exim to accept one or more messages by
67370 reading SMTP on the standard input, but to generate no responses. If the caller
67371 is trusted, the senders in the MAIL commands are believed; otherwise the
67372 sender is always the caller of Exim. Unqualified senders and receivers are not
67373 rejected (there seems little point) but instead just get qualified. HELO
67374 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
67375 as NOOP; QUIT quits.
67376 </para>
67377 <para>
67378 Minimal policy checking is done for BSMTP input. Only the non-SMTP
67379 ACL is run in the same way as for non-SMTP local input.
67380 </para>
67381 <para>
67382 If an error is detected while reading a message, including a missing <quote>.</quote> at
67383 the end, Exim gives up immediately. It writes details of the error to the
67384 standard output in a stylized way that the calling program should be able to
67385 make some use of automatically, for example:
67386 </para>
67387 <literallayout class="monospaced">
67388 554 Unexpected end of file
67389 Transaction started in line 10
67390 Error detected in line 14
67391 </literallayout>
67392 <para>
67393 It writes a more verbose version, for human consumption, to the standard error
67394 file, for example:
67395 </para>
67396 <literallayout class="monospaced">
67397 An error was detected while processing a file of BSMTP input.
67398 The error message was:
67399
67400 501 '&gt;' missing at end of address
67401
67402 The SMTP transaction started in line 10.
67403 The error was detected in line 12.
67404 The SMTP command at fault was:
67405
67406 rcpt to:&lt;malformed@in.com.plete
67407
67408 1 previous message was successfully processed.
67409 The rest of the batch was abandoned.
67410 </literallayout>
67411 <para>
67412 The return code from Exim is zero only if there were no errors. It is 1 if some
67413 messages were accepted before an error was detected, and 2 if no messages were
67414 accepted.
67415 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
67416 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
67417 </para>
67418 </section>
67419 </chapter>
67420
67421 <chapter id="CHAPemsgcust">
67422 <title>Customizing bounce and warning messages</title>
67423 <titleabbrev>Customizing messages</titleabbrev>
67424 <para>
67425 When a message fails to be delivered, or remains in the queue for more than a
67426 configured amount of time, Exim sends a message to the original sender, or
67427 to an alternative configured address. The text of these messages is built into
67428 the code of Exim, but it is possible to change it, either by adding a single
67429 string, or by replacing each of the paragraphs by text supplied in a file.
67430 </para>
67431 <para>
67432 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
67433 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
67434 option. Exim also adds the line
67435 </para>
67436 <literallayout class="monospaced">
67437 Auto-Submitted: auto-generated
67438 </literallayout>
67439 <para>
67440 to all warning and bounce messages,
67441 </para>
67442 <section id="SECID239">
67443 <title>Customizing bounce messages</title>
67444 <para>
67445 <indexterm role="concept">
67446 <primary>customizing</primary>
67447 <secondary>bounce message</secondary>
67448 </indexterm>
67449 <indexterm role="concept">
67450 <primary>bounce message</primary>
67451 <secondary>customizing</secondary>
67452 </indexterm>
67453 If <option>bounce_message_text</option> is set, its contents are included in the default
67454 message immediately after <quote>This message was created automatically by mail
67455 delivery software.</quote> The string is not expanded. It is not used if
67456 <option>bounce_message_file</option> is set.
67457 </para>
67458 <para>
67459 When <option>bounce_message_file</option> is set, it must point to a template file for
67460 constructing error messages. The file consists of a series of text items,
67461 separated by lines consisting of exactly four asterisks. If the file cannot be
67462 opened, default text is used and a message is written to the main and panic
67463 logs. If any text item in the file is empty, default text is used for that
67464 item.
67465 </para>
67466 <para>
67467 <indexterm role="variable">
67468 <primary><varname>$bounce_recipient</varname></primary>
67469 </indexterm>
67470 <indexterm role="variable">
67471 <primary><varname>$bounce_return_size_limit</varname></primary>
67472 </indexterm>
67473 Each item of text that is read from the file is expanded, and there are two
67474 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
67475 the recipient of an error message while it is being created, and
67476 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
67477 option, rounded to a whole number.
67478 </para>
67479 <para>
67480 The items must appear in the file in the following order:
67481 </para>
67482 <itemizedlist>
67483 <listitem>
67484 <para>
67485 The first item is included in the headers, and should include at least a
67486 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
67487 </para>
67488 </listitem>
67489 <listitem>
67490 <para>
67491 The second item forms the start of the error message. After it, Exim lists the
67492 failing addresses with their error messages.
67493 </para>
67494 </listitem>
67495 <listitem>
67496 <para>
67497 The third item is used to introduce any text from pipe transports that is to be
67498 returned to the sender. It is omitted if there is no such text.
67499 </para>
67500 </listitem>
67501 <listitem>
67502 <para>
67503 The fourth, fifth and sixth items will be ignored and may be empty.
67504 The fields exist for back-compatibility
67505 </para>
67506 </listitem>
67507 </itemizedlist>
67508 <para>
67509 The default state (<option>bounce_message_file</option> unset) is equivalent to the
67510 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
67511 other lines have been split in order to fit them on the page:
67512 </para>
67513 <literallayout class="monospaced">
67514 Subject: Mail delivery failed
67515   ${if eq{$sender_address}{$bounce_recipient}
67516   {: returning message to sender}}
67517 ****
67518 This message was created automatically by mail delivery software.
67519
67520 A message ${if eq{$sender_address}{$bounce_recipient}
67521   {that you sent }{sent by
67522
67523 &lt;$sender_address&gt;
67524
67525 }}could not be delivered to all of its recipients.
67526 This is a permanent error. The following address(es) failed:
67527 ****
67528 The following text was generated during the delivery attempt(s):
67529 ****
67530 ------ This is a copy of the message, including all the headers.
67531   ------
67532 ****
67533 ------ The body of the message is $message_size characters long;
67534   only the first
67535 ------ $bounce_return_size_limit or so are included here.
67536 ****
67537 </literallayout>
67538 </section>
67539 <section id="SECTcustwarn">
67540 <title>Customizing warning messages</title>
67541 <para>
67542 <indexterm role="concept">
67543 <primary>customizing</primary>
67544 <secondary>warning message</secondary>
67545 </indexterm>
67546 <indexterm role="concept">
67547 <primary>warning of delay</primary>
67548 <secondary>customizing the message</secondary>
67549 </indexterm>
67550 The option <option>warn_message_file</option> can be pointed at a template file for use when
67551 warnings about message delays are created. In this case there are only three
67552 text sections:
67553 </para>
67554 <itemizedlist>
67555 <listitem>
67556 <para>
67557 The first item is included in the headers, and should include at least a
67558 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
67559 </para>
67560 </listitem>
67561 <listitem>
67562 <para>
67563 The second item forms the start of the warning message. After it, Exim lists
67564 the delayed addresses.
67565 </para>
67566 </listitem>
67567 <listitem>
67568 <para>
67569 The third item then ends the message.
67570 </para>
67571 </listitem>
67572 </itemizedlist>
67573 <para>
67574 The default state is equivalent to the following file, except that some lines
67575 have been split here, in order to fit them on the page:
67576 </para>
67577 <literallayout class="monospaced">
67578 Subject: Warning: message $message_exim_id delayed
67579   $warn_message_delay
67580 ****
67581 This message was created automatically by mail delivery software.
67582
67583 A message ${if eq{$sender_address}{$warn_message_recipients}
67584 {that you sent }{sent by
67585
67586 &lt;$sender_address&gt;
67587
67588 }}has not been delivered to all of its recipients after
67589 more than $warn_message_delay in the queue on $primary_hostname.
67590
67591 The message identifier is:     $message_exim_id
67592 The subject of the message is: $h_subject
67593 The date of the message is:    $h_date
67594
67595 The following address(es) have not yet been delivered:
67596 ****
67597 No action is required on your part. Delivery attempts will
67598 continue for some time, and this warning may be repeated at
67599 intervals if the message remains undelivered. Eventually the
67600 mail delivery software will give up, and when that happens,
67601 the message will be returned to you.
67602 </literallayout>
67603 <para>
67604 <indexterm role="variable">
67605 <primary><varname>$warn_message_delay</varname></primary>
67606 </indexterm>
67607 <indexterm role="variable">
67608 <primary><varname>$warn_message_recipients</varname></primary>
67609 </indexterm>
67610 However, in the default state the subject and date lines are omitted if no
67611 appropriate headers exist. During the expansion of this file,
67612 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
67613 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
67614 of recipients for the warning message. There may be more than one if there are
67615 multiple addresses with different <option>errors_to</option> settings on the routers that
67616 handled them.
67617 </para>
67618 </section>
67619 </chapter>
67620
67621 <chapter id="CHAPcomconreq">
67622 <title>Some common configuration settings</title>
67623 <para>
67624 This chapter discusses some configuration settings that seem to be fairly
67625 common. More examples and discussion can be found in the Exim book.
67626 </para>
67627 <section id="SECID240">
67628 <title>Sending mail to a smart host</title>
67629 <para>
67630 <indexterm role="concept">
67631 <primary>smart host</primary>
67632 <secondary>example router</secondary>
67633 </indexterm>
67634 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
67635 should replace the default <command>dnslookup</command> router with a router which does the
67636 routing explicitly:
67637 </para>
67638 <literallayout class="monospaced">
67639 send_to_smart_host:
67640   driver = manualroute
67641   route_list = !+local_domains smart.host.name
67642   transport = remote_smtp
67643 </literallayout>
67644 <para>
67645 You can use the smart host&#x2019;s IP address instead of the name if you wish.
67646 If you are using Exim only to submit messages to a smart host, and not for
67647 receiving incoming messages, you can arrange for it to do the submission
67648 synchronously by setting the <option>mua_wrapper</option> option (see chapter
67649 <xref linkend="CHAPnonqueueing"/>).
67650 </para>
67651 </section>
67652 <section id="SECTmailinglists">
67653 <title>Using Exim to handle mailing lists</title>
67654 <para>
67655 <indexterm role="concept">
67656 <primary>mailing lists</primary>
67657 </indexterm>
67658 Exim can be used to run simple mailing lists, but for large and/or complicated
67659 requirements, the use of additional specialized mailing list software such as
67660 Majordomo or Mailman is recommended.
67661 </para>
67662 <para>
67663 The <command>redirect</command> router can be used to handle mailing lists where each list
67664 is maintained in a separate file, which can therefore be managed by an
67665 independent manager. The <option>domains</option> router option can be used to run these
67666 lists in a separate domain from normal mail. For example:
67667 </para>
67668 <literallayout class="monospaced">
67669 lists:
67670   driver = redirect
67671   domains = lists.example
67672   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
67673   forbid_pipe
67674   forbid_file
67675   errors_to = ${quote_local_part:$local_part-request}@lists.example
67676   no_more
67677 </literallayout>
67678 <para>
67679 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
67680 in that domain, it looks for a file that matches the local part. If there is no
67681 such file, the router declines, but because <option>no_more</option> is set, no subsequent
67682 routers are tried, and so the whole delivery fails.
67683 </para>
67684 <para>
67685 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
67686 expanded into a filename or a pipe delivery, which is usually inappropriate in
67687 a mailing list.
67688 </para>
67689 <para>
67690 <indexterm role="option">
67691 <primary><option>errors_to</option></primary>
67692 </indexterm>
67693 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
67694 taken from a mailing list are to be sent to the given address rather than the
67695 original sender of the message. However, before acting on this, Exim verifies
67696 the error address, and ignores it if verification fails.
67697 </para>
67698 <para>
67699 For example, using the configuration above, mail sent to
67700 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
67701 <filename>/usr/lists/dicts</filename>, with error reports directed to
67702 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
67703 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
67704 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
67705 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
67706 or <option>local_part_suffix</option> options) to handle addresses of the form
67707 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
67708 </para>
67709 </section>
67710 <section id="SECID241">
67711 <title>Syntax errors in mailing lists</title>
67712 <para>
67713 <indexterm role="concept">
67714 <primary>mailing lists</primary>
67715 <secondary>syntax errors in</secondary>
67716 </indexterm>
67717 If an entry in redirection data contains a syntax error, Exim normally defers
67718 delivery of the original address. That means that a syntax error in a mailing
67719 list holds up all deliveries to the list. This may not be appropriate when a
67720 list is being maintained automatically from data supplied by users, and the
67721 addresses are not rigorously checked.
67722 </para>
67723 <para>
67724 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
67725 entries that fail to parse, noting the incident in the log. If in addition
67726 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
67727 whenever a broken address is skipped. It is usually appropriate to set
67728 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
67729 </para>
67730 </section>
67731 <section id="SECID242">
67732 <title>Re-expansion of mailing lists</title>
67733 <para>
67734 <indexterm role="concept">
67735 <primary>mailing lists</primary>
67736 <secondary>re-expansion of</secondary>
67737 </indexterm>
67738 Exim remembers every individual address to which a message has been delivered,
67739 in order to avoid duplication, but it normally stores only the original
67740 recipient addresses with a message. If all the deliveries to a mailing list
67741 cannot be done at the first attempt, the mailing list is re-expanded when the
67742 delivery is next tried. This means that alterations to the list are taken into
67743 account at each delivery attempt, so addresses that have been added to
67744 the list since the message arrived will therefore receive a copy of the
67745 message, even though it pre-dates their subscription.
67746 </para>
67747 <para>
67748 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
67749 on the <command>redirect</command> router. If this is done, any addresses generated by the
67750 router that fail to deliver at the first attempt are added to the message as
67751 <quote>top level</quote> addresses, and the parent address that generated them is marked
67752 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
67753 subsequent delivery attempts. The disadvantage of this is that if any of the
67754 failing addresses are incorrect, correcting them in the file has no effect on
67755 pre-existing messages.
67756 </para>
67757 <para>
67758 The original top-level address is remembered with each of the generated
67759 addresses, and is output in any log messages. However, any intermediate parent
67760 addresses are not recorded. This makes a difference to the log only if the
67761 <option>all_parents</option> selector is set, but for mailing lists there is normally only
67762 one level of expansion anyway.
67763 </para>
67764 </section>
67765 <section id="SECID243">
67766 <title>Closed mailing lists</title>
67767 <para>
67768 <indexterm role="concept">
67769 <primary>mailing lists</primary>
67770 <secondary>closed</secondary>
67771 </indexterm>
67772 The examples so far have assumed open mailing lists, to which anybody may
67773 send mail. It is also possible to set up closed lists, where mail is accepted
67774 from specified senders only. This is done by making use of the generic
67775 <option>senders</option> option to restrict the router that handles the list.
67776 </para>
67777 <para>
67778 The following example uses the same file as a list of recipients and as a list
67779 of permitted senders. It requires three routers:
67780 </para>
67781 <literallayout class="monospaced">
67782 lists_request:
67783   driver = redirect
67784   domains = lists.example
67785   local_part_suffix = -request
67786   local_parts = ${lookup {$local_part} dsearch,filter=file {/usr/lists}}
67787   file = /usr/lists/${local_part_data}-request
67788   no_more
67789
67790 lists_post:
67791   driver = redirect
67792   domains = lists.example
67793   senders = ${if exists {/usr/lists/$local_part}\
67794              {lsearch;/usr/lists/$local_part}{*}}
67795   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
67796   forbid_pipe
67797   forbid_file
67798   errors_to = ${quote_local_part:$local_part-request}@lists.example
67799   no_more
67800
67801 lists_closed:
67802   driver = redirect
67803   domains = lists.example
67804   allow_fail
67805   data = :fail: $local_part@lists.example is a closed mailing list
67806 </literallayout>
67807 <para>
67808 All three routers have the same <option>domains</option> setting, so for any other domains,
67809 they are all skipped. The first router runs only if the local part ends in
67810 <option>-request</option>. It handles messages to the list manager(s) by means of an open
67811 mailing list.
67812 </para>
67813 <para>
67814 The second router runs only if the <option>senders</option> precondition is satisfied. It
67815 checks for the existence of a list that corresponds to the local part, and then
67816 checks that the sender is on the list by means of a linear search. It is
67817 necessary to check for the existence of the file before trying to search it,
67818 because otherwise Exim thinks there is a configuration error. If the file does
67819 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
67820 means that the router runs, but because there is no list, declines, and
67821 <option>no_more</option> ensures that no further routers are run. The address fails with an
67822 <quote>unrouteable address</quote> error.
67823 </para>
67824 <para>
67825 The third router runs only if the second router is skipped, which happens when
67826 a mailing list exists, but the sender is not on it. This router forcibly fails
67827 the address, giving a suitable error message.
67828 </para>
67829 </section>
67830 <section id="SECTverp">
67831 <title>Variable Envelope Return Paths (VERP)</title>
67832 <para>
67833 <indexterm role="concept">
67834 <primary>VERP</primary>
67835 </indexterm>
67836 <indexterm role="concept">
67837 <primary>Variable Envelope Return Paths</primary>
67838 </indexterm>
67839 <indexterm role="concept">
67840 <primary>envelope from</primary>
67841 </indexterm>
67842 <indexterm role="concept">
67843 <primary>envelope sender</primary>
67844 </indexterm>
67845 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;
67846 are a way of helping mailing list administrators discover which subscription
67847 address is the cause of a particular delivery failure. The idea is to encode
67848 the original recipient address in the outgoing envelope sender address, so that
67849 if the message is forwarded by another host and then subsequently bounces, the
67850 original recipient can be extracted from the recipient address of the bounce.
67851 </para>
67852 <para>
67853 <indexterm role="option">
67854 <primary><option>errors_to</option></primary>
67855 </indexterm>
67856 <indexterm role="option">
67857 <primary><option>return_path</option></primary>
67858 </indexterm>
67859 Envelope sender addresses can be modified by Exim using two different
67860 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
67861 list examples), or the <option>return_path</option> option on a transport. The second of
67862 these is effective only if the message is successfully delivered to another
67863 host; it is not used for errors detected on the local host (see the description
67864 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
67865 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
67866 </para>
67867 <literallayout class="monospaced">
67868 verp_smtp:
67869   driver = smtp
67870   max_rcpt = 1
67871   return_path = \
67872     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
67873       {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
67874 </literallayout>
67875 <para>
67876 This has the effect of rewriting the return path (envelope sender) on outgoing
67877 SMTP messages, if the local part of the original return path ends in
67878 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
67879 local part and domain of the recipient into the return path. Suppose, for
67880 example, that a message whose return path has been set to
67881 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
67882 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
67883 rewritten as
67884 </para>
67885 <literallayout class="monospaced">
67886 somelist-request+subscriber=other.dom.example@your.dom.example
67887 </literallayout>
67888 <para>
67889 <indexterm role="variable">
67890 <primary><varname>$local_part</varname></primary>
67891 </indexterm>
67892 For this to work, you must tell Exim to send multiple copies of messages that
67893 have more than one recipient, so that each copy has just one recipient. This is
67894 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
67895 might be sent to several different recipients in the same domain, in which case
67896 <varname>$local_part</varname> is not available in the transport, because it is not unique.
67897 </para>
67898 <para>
67899 Unless your host is doing nothing but mailing list deliveries, you should
67900 probably use a separate transport for the VERP deliveries, so as not to use
67901 extra resources in making one-per-recipient copies for other deliveries. This
67902 can easily be done by expanding the <option>transport</option> option in the router:
67903 </para>
67904 <literallayout class="monospaced">
67905 dnslookup:
67906   driver = dnslookup
67907   domains = ! +local_domains
67908   transport = \
67909     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
67910       {verp_smtp}{remote_smtp}}
67911   no_more
67912 </literallayout>
67913 <para>
67914 If you want to change the return path using <option>errors_to</option> in a router instead
67915 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
67916 routers that handle mailing list addresses. This will ensure that all delivery
67917 errors, including those detected on the local host, are sent to the VERP
67918 address.
67919 </para>
67920 <para>
67921 On a host that does no local deliveries and has no manual routing, only the
67922 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
67923 SMTP deliveries. Every mailing list recipient has its own return path value,
67924 and so Exim must hand them to the transport one at a time. Here is an example
67925 of a <command>dnslookup</command> router that implements VERP:
67926 </para>
67927 <literallayout class="monospaced">
67928 verp_dnslookup:
67929   driver = dnslookup
67930   domains = ! +local_domains
67931   transport = remote_smtp
67932   errors_to = \
67933     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
67934      {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
67935   no_more
67936 </literallayout>
67937 <para>
67938 Before you start sending out messages with VERPed return paths, you must also
67939 configure Exim to accept the bounce messages that come back to those paths.
67940 Typically this is done by setting a <option>local_part_suffix</option> option for a
67941 router, and using this to route the messages to wherever you want to handle
67942 them.
67943 </para>
67944 <para>
67945 The overhead incurred in using VERP depends very much on the size of the
67946 message, the number of recipient addresses that resolve to the same remote
67947 host, and the speed of the connection over which the message is being sent. If
67948 a lot of addresses resolve to the same host and the connection is slow, sending
67949 a separate copy of the message for each address may take substantially longer
67950 than sending a single copy with many recipients (for which VERP cannot be
67951 used).
67952 </para>
67953 </section>
67954 <section id="SECTvirtualdomains">
67955 <title>Virtual domains</title>
67956 <para>
67957 <indexterm role="concept">
67958 <primary>virtual domains</primary>
67959 </indexterm>
67960 <indexterm role="concept">
67961 <primary>domain</primary>
67962 <secondary>virtual</secondary>
67963 </indexterm>
67964 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
67965 meanings:
67966 </para>
67967 <itemizedlist>
67968 <listitem>
67969 <para>
67970 A domain for which there are no real mailboxes; all valid local parts are
67971 aliases for other email addresses. Common examples are organizational
67972 top-level domains and <quote>vanity</quote> domains.
67973 </para>
67974 </listitem>
67975 <listitem>
67976 <para>
67977 One of a number of independent domains that are all handled by the same host,
67978 with mailboxes on that host, but where the mailbox owners do not necessarily
67979 have login accounts on that host.
67980 </para>
67981 </listitem>
67982 </itemizedlist>
67983 <para>
67984 The first usage is probably more common, and does seem more <quote>virtual</quote> than
67985 the second. This kind of domain can be handled in Exim with a straightforward
67986 aliasing router. One approach is to create a separate alias file for each
67987 virtual domain. Exim can test for the existence of the alias file to determine
67988 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
67989 to a router of this form:
67990 </para>
67991 <literallayout class="monospaced">
67992 virtual:
67993   driver = redirect
67994   domains = dsearch;/etc/mail/virtual
67995   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
67996   no_more
67997 </literallayout>
67998 <para revisionflag="changed">
67999 The <option>domains</option> option specifies that the router is to be skipped, unless there
68000 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
68001 domain that is being processed.
68002 The <command>dsearch</command> lookup used results in an untainted version of <varname>$domain</varname>
68003 being placed into the <varname>$domain_data</varname> variable.
68004 </para>
68005 <para>
68006 When the router runs, it looks up the local
68007 part in the file to find a new address (or list of addresses). The <option>no_more</option>
68008 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
68009 string), Exim gives up on the address without trying any subsequent routers.
68010 </para>
68011 <para>
68012 This one router can handle all the virtual domains because the alias filenames
68013 follow a fixed pattern. Permissions can be arranged so that appropriate people
68014 can edit the different alias files. A successful aliasing operation results in
68015 a new envelope recipient address, which is then routed from scratch.
68016 </para>
68017 <para>
68018 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
68019 way. One approach is to create a file for each domain containing a list of
68020 valid local parts, and use it in a router like this:
68021 </para>
68022 <literallayout class="monospaced">
68023 my_domains:
68024   driver = accept
68025   domains = dsearch;/etc/mail/domains
68026   local_parts = lsearch;/etc/mail/domains/$domain
68027   transport = my_mailboxes
68028 </literallayout>
68029 <para>
68030 The address is accepted if there is a file for the domain, and the local part
68031 can be found in the file. The <option>domains</option> option is used to check for the
68032 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
68033 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
68034 because that option is tested after <option>local_parts</option>. The transport is as
68035 follows:
68036 </para>
68037 <literallayout class="monospaced">
68038 my_mailboxes:
68039   driver = appendfile
68040   file = /var/mail/$domain/$local_part_data
68041   user = mail
68042 </literallayout>
68043 <para>
68044 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
68045 required, to specify which uid is to be used for writing to the mailboxes.
68046 </para>
68047 <para>
68048 The configuration shown here is just one example of how you might support this
68049 requirement. There are many other ways this kind of configuration can be set
68050 up, for example, by using a database instead of separate files to hold all the
68051 information about the domains.
68052 </para>
68053 </section>
68054 <section id="SECTmulbox">
68055 <title>Multiple user mailboxes</title>
68056 <para>
68057 <indexterm role="concept">
68058 <primary>multiple mailboxes</primary>
68059 </indexterm>
68060 <indexterm role="concept">
68061 <primary>mailbox</primary>
68062 <secondary>multiple</secondary>
68063 </indexterm>
68064 <indexterm role="concept">
68065 <primary>local part</primary>
68066 <secondary>prefix</secondary>
68067 </indexterm>
68068 <indexterm role="concept">
68069 <primary>local part</primary>
68070 <secondary>suffix</secondary>
68071 </indexterm>
68072 Heavy email users often want to operate with multiple mailboxes, into which
68073 incoming mail is automatically sorted. A popular way of handling this is to
68074 allow users to use multiple sender addresses, so that replies can easily be
68075 identified. Users are permitted to add prefixes or suffixes to their local
68076 parts for this purpose. The wildcard facility of the generic router options
68077 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
68078 example, consider this router:
68079 </para>
68080 <literallayout class="monospaced">
68081 userforward:
68082   driver = redirect
68083   check_local_user
68084   file = $home/.forward
68085   local_part_suffix = -*
68086   local_part_suffix_optional
68087   allow_filter
68088 </literallayout>
68089 <para>
68090 <indexterm role="variable">
68091 <primary><varname>$local_part_suffix</varname></primary>
68092 </indexterm>
68093 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
68094 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
68095 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
68096 </para>
68097 <literallayout class="monospaced">
68098 if $local_part_suffix contains -special then
68099 save /home/$local_part/Mail/special
68100 endif
68101 </literallayout>
68102 <para>
68103 If the filter file does not exist, or does not deal with such addresses, they
68104 fall through to subsequent routers, and, assuming no subsequent use of the
68105 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
68106 control over which suffixes are valid.
68107 </para>
68108 <para>
68109 Alternatively, a suffix can be used to trigger the use of a different
68110 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
68111 another MTA:
68112 </para>
68113 <literallayout class="monospaced">
68114 userforward:
68115   driver = redirect
68116   check_local_user
68117   local_part_suffix = -*
68118   local_part_suffix_optional
68119   file = ${lookup {.forward$local_part_suffix} dsearch,ret=full {$home} {$value}fail}
68120   allow_filter
68121 </literallayout>
68122 <para>
68123 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
68124 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
68125 does not exist, or does not deal with the address, it is passed on to
68126 subsequent routers, which could, if required, look for an unqualified
68127 <filename>.forward</filename> file to use as a default.
68128 </para>
68129 </section>
68130 <section id="SECID244">
68131 <title>Simplified vacation processing</title>
68132 <para>
68133 <indexterm role="concept">
68134 <primary>vacation processing</primary>
68135 </indexterm>
68136 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
68137 a pipe command in a <filename>.forward</filename> file
68138 (see section <xref linkend="SECTspecitredli"/> for syntax details).
68139 This is prone to error by inexperienced users. There are two features of Exim
68140 that can be used to make this process simpler for users:
68141 </para>
68142 <itemizedlist>
68143 <listitem>
68144 <para>
68145 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
68146 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
68147 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
68148 <filename>.forward</filename> file are then much simpler. For example:
68149 </para>
68150 <literallayout class="monospaced">
68151 spqr, vacation-spqr
68152 </literallayout>
68153 </listitem>
68154 <listitem>
68155 <para>
68156 The <option>require_files</option> generic router option can be used to trigger a
68157 vacation delivery by checking for the existence of a certain file in the
68158 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
68159 ensure that the original delivery also proceeds. In this case, all the user has
68160 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
68161 message.
68162 </para>
68163 </listitem>
68164 </itemizedlist>
68165 <para>
68166 Another advantage of both these methods is that they both work even when the
68167 use of arbitrary pipes by users is locked out.
68168 </para>
68169 </section>
68170 <section id="SECID245">
68171 <title>Taking copies of mail</title>
68172 <para>
68173 <indexterm role="concept">
68174 <primary>message</primary>
68175 <secondary>copying every</secondary>
68176 </indexterm>
68177 Some installations have policies that require archive copies of all messages to
68178 be made. A single copy of each message can easily be taken by an appropriate
68179 command in a system filter, which could, for example, use a different file for
68180 each day&#x2019;s messages.
68181 </para>
68182 <para>
68183 There is also a shadow transport mechanism that can be used to take copies of
68184 messages that are successfully delivered by local transports, one copy per
68185 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
68186 notification of delivery by sites that insist on doing such things.
68187 </para>
68188 </section>
68189 <section id="SECID246">
68190 <title>Intermittently connected hosts</title>
68191 <para>
68192 <indexterm role="concept">
68193 <primary>intermittently connected hosts</primary>
68194 </indexterm>
68195 It has become quite common (because it is cheaper) for hosts to connect to the
68196 Internet periodically rather than remain connected all the time. The normal
68197 arrangement is that mail for such hosts accumulates on a system that is
68198 permanently connected.
68199 </para>
68200 <para>
68201 Exim was designed for use on permanently connected hosts, and so it is not
68202 particularly well-suited to use in an intermittently connected environment.
68203 Nevertheless there are some features that can be used.
68204 </para>
68205 </section>
68206 <section id="SECID247">
68207 <title>Exim on the upstream server host</title>
68208 <para>
68209 It is tempting to arrange for incoming mail for the intermittently connected
68210 host to remain in Exim&#x2019;s queue until the client connects. However, this
68211 approach does not scale very well. Two different kinds of waiting message are
68212 being mixed up in the same queue &ndash; those that cannot be delivered because of
68213 some temporary problem, and those that are waiting for their destination host
68214 to connect. This makes it hard to manage the queue, as well as wasting
68215 resources, because each queue runner scans the entire queue.
68216 </para>
68217 <para>
68218 A better approach is to separate off those messages that are waiting for an
68219 intermittently connected host. This can be done by delivering these messages
68220 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
68221 format, from where they are transmitted by other software when their
68222 destination connects. This makes it easy to collect all the mail for one host
68223 in a single directory, and to apply local timeout rules on a per-message basis
68224 if required.
68225 </para>
68226 <para>
68227 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
68228 you are doing this, you should configure Exim with a long retry period for the
68229 intermittent host. For example:
68230 </para>
68231 <literallayout class="monospaced">
68232 cheshire.wonderland.fict.example    *   F,5d,24h
68233 </literallayout>
68234 <para>
68235 This stops a lot of failed delivery attempts from occurring, but Exim remembers
68236 which messages it has queued up for that host. Once the intermittent host comes
68237 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
68238 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
68239 causes all the queued up messages to be delivered, often down a single SMTP
68240 connection. While the host remains connected, any new messages get delivered
68241 immediately.
68242 </para>
68243 <para>
68244 If the connecting hosts do not have fixed IP addresses, that is, if a host is
68245 issued with a different IP address each time it connects, Exim&#x2019;s retry
68246 mechanisms on the holding host get confused, because the IP address is normally
68247 used as part of the key string for holding retry information. This can be
68248 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
68249 Since this has disadvantages for permanently connected hosts, it is best to
68250 arrange a separate transport for the intermittently connected ones.
68251 </para>
68252 </section>
68253 <section id="SECID248">
68254 <title>Exim on the intermittently connected client host</title>
68255 <para>
68256 The value of <option>smtp_accept_queue_per_connection</option> should probably be
68257 increased, or even set to zero (that is, disabled) on the intermittently
68258 connected host, so that all incoming messages down a single connection get
68259 delivered immediately.
68260 </para>
68261 <para>
68262 <indexterm role="concept">
68263 <primary>SMTP</primary>
68264 <secondary>passed connection</secondary>
68265 </indexterm>
68266 <indexterm role="concept">
68267 <primary>SMTP</primary>
68268 <secondary>multiple deliveries</secondary>
68269 </indexterm>
68270 <indexterm role="concept">
68271 <primary>multiple SMTP deliveries</primary>
68272 </indexterm>
68273 <indexterm role="concept">
68274 <primary>first pass routing</primary>
68275 </indexterm>
68276 Mail waiting to be sent from an intermittently connected host will probably
68277 not have been routed, because without a connection DNS lookups are not
68278 possible. This means that if a normal queue run is done at connection time,
68279 each message is likely to be sent in a separate SMTP session. This can be
68280 avoided by starting the queue run with a command line option beginning with
68281 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
68282 first pass, routing is done but no deliveries take place. The second pass is a
68283 normal queue run; since all the messages have been previously routed, those
68284 destined for the same host are likely to get sent as multiple deliveries in a
68285 single SMTP connection.
68286 </para>
68287 </section>
68288 </chapter>
68289
68290 <chapter id="CHAPnonqueueing">
68291 <title>Using Exim as a non-queueing client</title>
68292 <titleabbrev>Exim as a non-queueing client</titleabbrev>
68293 <para>
68294 <indexterm role="concept">
68295 <primary>client, non-queueing</primary>
68296 </indexterm>
68297 <indexterm role="concept">
68298 <primary>smart host</primary>
68299 <secondary>suppressing queueing</secondary>
68300 </indexterm>
68301 On a personal computer, it is a common requirement for all
68302 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
68303 configured to operate that way, for all the popular operating systems.
68304 However, there are some MUAs for Unix-like systems that cannot be so
68305 configured: they submit messages using the command line interface of
68306 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
68307 messages this way.
68308 </para>
68309 <para>
68310 If the personal computer runs continuously, there is no problem, because it can
68311 run a conventional MTA that handles delivery to the smart host, and deal with
68312 any delays via its queueing mechanism. However, if the computer does not run
68313 continuously or runs different operating systems at different times, queueing
68314 email is not desirable.
68315 </para>
68316 <para>
68317 There is therefore a requirement for something that can provide the
68318 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
68319 any queueing or retrying facilities. Furthermore, the delivery to the smart
68320 host should be synchronous, so that if it fails, the sending MUA is immediately
68321 informed. In other words, we want something that extends an MUA that submits
68322 to a local MTA via the command line so that it behaves like one that submits
68323 to a remote smart host using TCP/SMTP.
68324 </para>
68325 <para>
68326 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
68327 that do this job. However, people have found them to be lacking in various
68328 ways. For instance, you might want to allow aliasing and forwarding to be done
68329 before sending a message to the smart host.
68330 </para>
68331 <para>
68332 Exim already had the necessary infrastructure for doing this job. Just a few
68333 tweaks were needed to make it behave as required, though it is somewhat of an
68334 overkill to use a fully-featured MTA for this purpose.
68335 </para>
68336 <para>
68337 <indexterm role="option">
68338 <primary><option>mua_wrapper</option></primary>
68339 </indexterm>
68340 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
68341 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
68342 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
68343 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
68344 compatible router and transport configuration. Typically there will be just one
68345 router and one transport, sending everything to a smart host.
68346 </para>
68347 <para>
68348 When run in MUA wrapping mode, the behaviour of Exim changes in the
68349 following ways:
68350 </para>
68351 <itemizedlist>
68352 <listitem>
68353 <para>
68354 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
68355 In other words, the only way to submit messages is via the command line.
68356 </para>
68357 </listitem>
68358 <listitem>
68359 <para>
68360 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
68361 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
68362 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
68363 does not finish until the delivery attempt is complete. If the delivery is
68364 successful, a zero return code is given.
68365 </para>
68366 </listitem>
68367 <listitem>
68368 <para>
68369 Address redirection is permitted, but the final routing for all addresses must
68370 be to the same remote transport, and to the same list of hosts. Furthermore,
68371 the return address (envelope sender) must be the same for all recipients, as
68372 must any added or deleted header lines. In other words, it must be possible to
68373 deliver the message in a single SMTP transaction, however many recipients there
68374 are.
68375 </para>
68376 </listitem>
68377 <listitem>
68378 <para>
68379 If these conditions are not met, or if routing any address results in a
68380 failure or defer status, or if Exim is unable to deliver all the recipients
68381 successfully to one of the smart hosts, delivery of the entire message fails.
68382 </para>
68383 </listitem>
68384 <listitem>
68385 <para>
68386 Because no queueing is allowed, all failures are treated as permanent; there
68387 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
68388 smart host. Furthermore, because only a single yes/no response can be given to
68389 the caller, it is not possible to deliver to some recipients and not others. If
68390 there is an error (temporary or permanent) for any recipient, all are failed.
68391 </para>
68392 </listitem>
68393 <listitem>
68394 <para>
68395 If more than one smart host is listed, Exim will try another host after a
68396 connection failure or a timeout, in the normal way. However, if this kind of
68397 failure happens for all the hosts, the delivery fails.
68398 </para>
68399 </listitem>
68400 <listitem>
68401 <para>
68402 When delivery fails, an error message is written to the standard error stream
68403 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
68404 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
68405 are ever generated.
68406 </para>
68407 </listitem>
68408 <listitem>
68409 <para>
68410 No retry data is maintained, and any retry rules are ignored.
68411 </para>
68412 </listitem>
68413 <listitem>
68414 <para>
68415 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
68416 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
68417 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
68418 </para>
68419 </listitem>
68420 </itemizedlist>
68421 <para>
68422 The overall effect is that Exim makes a single synchronous attempt to deliver
68423 the message, failing if there is any kind of problem. Because no local
68424 deliveries are done and no daemon can be run, Exim does not need root
68425 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
68426 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
68427 the advantages and disadvantages of running without root privilege.
68428 </para>
68429 </chapter>
68430
68431 <chapter id="CHAPlog">
68432 <title>Log files</title>
68433 <para>
68434 <indexterm role="concept" id="IIDloggen" class="startofrange">
68435 <primary>log</primary>
68436 <secondary>general description</secondary>
68437 </indexterm>
68438 <indexterm role="concept">
68439 <primary>log</primary>
68440 <secondary>types of</secondary>
68441 </indexterm>
68442 Exim writes three different logs, referred to as the main log, the reject log,
68443 and the panic log:
68444 </para>
68445 <itemizedlist>
68446 <listitem>
68447 <para>
68448 <indexterm role="concept">
68449 <primary>main log</primary>
68450 </indexterm>
68451 The main log records the arrival of each message and each delivery in a single
68452 line in each case. The format is as compact as possible, in an attempt to keep
68453 down the size of log files. Two-character flag sequences make it easy to pick
68454 out these lines. A number of other events are recorded in the main log. Some of
68455 them are optional, in which case the <option>log_selector</option> option controls whether
68456 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
68457 analysis of main log files, is provided in the Exim distribution (see section
68458 <xref linkend="SECTmailstat"/>).
68459 </para>
68460 </listitem>
68461 <listitem>
68462 <para>
68463 <indexterm role="concept">
68464 <primary>reject log</primary>
68465 </indexterm>
68466 The reject log records information from messages that are rejected as a result
68467 of a configuration option (that is, for policy reasons).
68468 The first line of each rejection is a copy of the line that is also written to
68469 the main log. Then, if the message&#x2019;s header has been read at the time the log
68470 is written, its contents are written to this log. Only the original header
68471 lines are available; header lines added by ACLs are not logged. You can use the
68472 reject log to check that your policy controls are working correctly; on a busy
68473 host this may be easier than scanning the main log for rejection messages. You
68474 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
68475 false.
68476 </para>
68477 </listitem>
68478 <listitem>
68479 <para>
68480 <indexterm role="concept">
68481 <primary>panic log</primary>
68482 </indexterm>
68483 <indexterm role="concept">
68484 <primary>system log</primary>
68485 </indexterm>
68486 When certain serious errors occur, Exim writes entries to its panic log. If the
68487 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
68488 are usually written to the main log as well, but can get lost amid the mass of
68489 other entries. The panic log should be empty under normal circumstances. It is
68490 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
68491 regularly, in order to become aware of any problems. When Exim cannot open its
68492 panic log, it tries as a last resort to write to the system log (syslog). This
68493 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
68494 message itself is written at priority LOG_CRIT.
68495 </para>
68496 </listitem>
68497 </itemizedlist>
68498 <para>
68499 Every log line starts with a timestamp, in the format shown in the following
68500 example. Note that many of the examples shown in this chapter are line-wrapped.
68501 In the log file, this would be all on one line:
68502 </para>
68503 <literallayout class="monospaced">
68504 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
68505   by QUIT
68506 </literallayout>
68507 <para>
68508 By default, the timestamps are in the local timezone. There are two
68509 ways of changing this:
68510 </para>
68511 <itemizedlist>
68512 <listitem>
68513 <para>
68514 You can set the <option>timezone</option> option to a different time zone; in particular, if
68515 you set
68516 </para>
68517 <literallayout class="monospaced">
68518 timezone = UTC
68519 </literallayout>
68520 <para>
68521 the timestamps will be in UTC (aka GMT).
68522 </para>
68523 </listitem>
68524 <listitem>
68525 <para>
68526 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
68527 example:
68528 </para>
68529 <literallayout class="monospaced">
68530 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
68531 </literallayout>
68532 </listitem>
68533 </itemizedlist>
68534 <para>
68535 <indexterm role="concept">
68536 <primary>log</primary>
68537 <secondary>process ids in</secondary>
68538 </indexterm>
68539 <indexterm role="concept">
68540 <primary>pid (process id)</primary>
68541 <secondary>in log lines</secondary>
68542 </indexterm>
68543 Exim does not include its process id in log lines by default, but you can
68544 request that it does so by specifying the <literal>pid</literal> log selector (see section
68545 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
68546 brackets, immediately after the time and date.
68547 </para>
68548 <section id="SECTwhelogwri">
68549 <title>Where the logs are written</title>
68550 <para>
68551 <indexterm role="concept">
68552 <primary>log</primary>
68553 <secondary>destination</secondary>
68554 </indexterm>
68555 <indexterm role="concept">
68556 <primary>log</primary>
68557 <secondary>to file</secondary>
68558 </indexterm>
68559 <indexterm role="concept">
68560 <primary>log</primary>
68561 <secondary>to syslog</secondary>
68562 </indexterm>
68563 <indexterm role="concept">
68564 <primary>syslog</primary>
68565 </indexterm>
68566 The logs may be written to local files, or to syslog, or both. However, it
68567 should be noted that many syslog implementations use UDP as a transport, and
68568 are therefore unreliable in the sense that messages are not guaranteed to
68569 arrive at the loghost, nor is the ordering of messages necessarily maintained.
68570 It has also been reported that on large log files (tens of megabytes) you may
68571 need to tweak syslog to prevent it syncing the file with each write &ndash; on
68572 Linux this has been seen to make syslog take 90% plus of CPU time.
68573 </para>
68574 <para>
68575 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
68576 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the runtime
68577 configuration. This latter string is expanded, so it can contain, for example,
68578 references to the host name:
68579 </para>
68580 <literallayout class="monospaced">
68581 log_file_path = /var/log/$primary_hostname/exim_%slog
68582 </literallayout>
68583 <para>
68584 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
68585 rather than at runtime, because then the setting is available right from the
68586 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
68587 before it has read the configuration file (for example, an error in the
68588 configuration file) it will not use the path you want, and may not be able to
68589 log at all.
68590 </para>
68591 <para>
68592 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
68593 list, currently limited to at most two items. This is one option where the
68594 facility for changing a list separator may not be used. The list must always be
68595 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
68596 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
68597 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
68598 implying the use of a default path.
68599 </para>
68600 <para>
68601 When Exim encounters an empty item in the list, it searches the list defined by
68602 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
68603 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
68604 mean <quote>use the path specified at build time</quote>. It no such item exists, log
68605 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
68606 equivalent to the setting:
68607 </para>
68608 <literallayout class="monospaced">
68609 log_file_path = $spool_directory/log/%slog
68610 </literallayout>
68611 <para>
68612 If you do not specify anything at build time or runtime,
68613 or if you unset the option at runtime (i.e. <literal>log_file_path = </literal>),
68614 that is where the logs are written.
68615 </para>
68616 <para>
68617 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log filenames
68618 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
68619 </para>
68620 <para>
68621 Here are some examples of possible settings:
68622 </para>
68623 <literallayout>
68624 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
68625 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
68626 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
68627 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
68628 </literallayout>
68629 <para>
68630 If there are more than two paths in the list, the first is used and a panic
68631 error is logged.
68632 </para>
68633 </section>
68634 <section id="SECID285">
68635 <title>Logging to local files that are periodically <quote>cycled</quote></title>
68636 <para>
68637 <indexterm role="concept">
68638 <primary>log</primary>
68639 <secondary>cycling local files</secondary>
68640 </indexterm>
68641 <indexterm role="concept">
68642 <primary>cycling logs</primary>
68643 </indexterm>
68644 <indexterm role="concept">
68645 <primary><emphasis>exicyclog</emphasis></primary>
68646 </indexterm>
68647 <indexterm role="concept">
68648 <primary>log</primary>
68649 <secondary>local files; writing to</secondary>
68650 </indexterm>
68651 Some operating systems provide centralized and standardized methods for cycling
68652 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
68653 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
68654 main and reject logs each time it is called. The maximum number of old logs to
68655 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
68656 </para>
68657 <para>
68658 An Exim delivery process opens the main log when it first needs to write to it,
68659 and it keeps the file open in case subsequent entries are required &ndash; for
68660 example, if a number of different deliveries are being done for the same
68661 message. However, remote SMTP deliveries can take a long time, and this means
68662 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
68663 something similar is being used to rename log files on a regular basis. To
68664 ensure that a switch of log files is noticed as soon as possible, Exim calls
68665 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
68666 does not exist, or its inode has changed, the old file is closed and Exim
68667 tries to open the main log from scratch. Thus, an old log file may remain open
68668 for quite some time, but no Exim processes should write to it once it has been
68669 renamed.
68670 </para>
68671 </section>
68672 <section id="SECTdatlogfil">
68673 <title>Datestamped log files</title>
68674 <para>
68675 <indexterm role="concept">
68676 <primary>log</primary>
68677 <secondary>datestamped files</secondary>
68678 </indexterm>
68679 Instead of cycling the main and reject log files by renaming them
68680 periodically, some sites like to use files whose names contain a datestamp,
68681 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
68682 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
68683 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
68684 point where the datestamp is required. For example:
68685 </para>
68686 <literallayout class="monospaced">
68687 log_file_path = /var/spool/exim/log/%slog-%D
68688 log_file_path = /var/log/exim-%s-%D.log
68689 log_file_path = /var/spool/exim/log/%D-%slog
68690 log_file_path = /var/log/exim/%s.%M
68691 </literallayout>
68692 <para>
68693 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
68694 examples of names generated by the above examples:
68695 </para>
68696 <literallayout class="monospaced">
68697 /var/spool/exim/log/mainlog-20021225
68698 /var/log/exim-reject-20021225.log
68699 /var/spool/exim/log/20021225-mainlog
68700 /var/log/exim/main.200212
68701 </literallayout>
68702 <para>
68703 When this form of log file is specified, Exim automatically switches to new
68704 files at midnight. It does not make any attempt to compress old logs; you
68705 will need to write your own script if you require this. You should not
68706 run <emphasis>exicyclog</emphasis> with this form of logging.
68707 </para>
68708 <para>
68709 The location of the panic log is also determined by <option>log_file_path</option>, but it
68710 is not datestamped, because rotation of the panic log does not make sense.
68711 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
68712 the string. In addition, if it immediately follows a slash, a following
68713 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
68714 character is removed. Thus, the four examples above would give these panic
68715 log names:
68716 </para>
68717 <literallayout class="monospaced">
68718 /var/spool/exim/log/paniclog
68719 /var/log/exim-panic.log
68720 /var/spool/exim/log/paniclog
68721 /var/log/exim/panic
68722 </literallayout>
68723 </section>
68724 <section id="SECID249">
68725 <title>Logging to syslog</title>
68726 <para>
68727 <indexterm role="concept">
68728 <primary>log</primary>
68729 <secondary>syslog; writing to</secondary>
68730 </indexterm>
68731 The use of syslog does not change what Exim logs or the format of its messages,
68732 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
68733 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
68734 that, the same strings are written to syslog as to log files. The syslog
68735 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
68736 by default, but you can change these by setting the <option>syslog_facility</option> and
68737 <option>syslog_processname</option> options, respectively. If Exim was compiled with
68738 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
68739 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
68740 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
68741 the time and host name to each line.
68742 The three log streams are mapped onto syslog priorities as follows:
68743 </para>
68744 <itemizedlist>
68745 <listitem>
68746 <para>
68747 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
68748 </para>
68749 </listitem>
68750 <listitem>
68751 <para>
68752 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
68753 </para>
68754 </listitem>
68755 <listitem>
68756 <para>
68757 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
68758 </para>
68759 </listitem>
68760 </itemizedlist>
68761 <para>
68762 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
68763 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
68764 these are routed by syslog to the same place. You can suppress this duplication
68765 by setting <option>syslog_duplication</option> false.
68766 </para>
68767 <para>
68768 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
68769 entries contain multiple lines when headers are included. To cope with both
68770 these cases, entries written to syslog are split into separate <function>syslog()</function>
68771 calls at each internal newline, and also after a maximum of
68772 870 data characters. (This allows for a total syslog line length of 1024, when
68773 additions such as timestamps are added.) If you are running a syslog
68774 replacement that can handle lines longer than the 1024 characters allowed by
68775 RFC 3164, you should set
68776 </para>
68777 <literallayout class="monospaced">
68778 SYSLOG_LONG_LINES=yes
68779 </literallayout>
68780 <para>
68781 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
68782 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
68783 </para>
68784 <para>
68785 To make it easy to re-assemble split lines later, each component of a split
68786 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;]
68787 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
68788 components in the entry. The / delimiter is used when the line was split
68789 because it was too long; if it was split because of an internal newline, the \
68790 delimiter is used. For example, supposing the length limit to be 50 instead of
68791 870, the following would be the result of a typical rejection message to
68792 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
68793 name, and pid as added by syslog:
68794 </para>
68795 <literallayout class="monospaced">
68796 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
68797 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
68798 [3/5]  when scanning for sender: missing or malformed lo
68799 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
68800 [5/5] mple&gt;)
68801 </literallayout>
68802 <para>
68803 The same error might cause the following lines to be written to <quote>rejectlog</quote>
68804 (LOG_NOTICE):
68805 </para>
68806 <literallayout class="monospaced">
68807 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
68808 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
68809 [3/18] er when scanning for sender: missing or malformed
68810 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
68811 [5\18] .example&gt;)
68812 [6\18] Recipients: ph10@some.domain.cam.example
68813 [7\18] P Received: from [127.0.0.1] (ident=ph10)
68814 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
68815 [9\18]        id 16RdAL-0006pc-00
68816 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
68817 [11\18] 09:43 +0100
68818 [12\18] F From: &lt;&gt;
68819 [13\18]   Subject: this is a test header
68820 [18\18]   X-something: this is another header
68821 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
68822 [16\18] le&gt;
68823 [17\18] B Bcc:
68824 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
68825 </literallayout>
68826 <para>
68827 Log lines that are neither too long nor contain newlines are written to syslog
68828 without modification.
68829 </para>
68830 <para>
68831 If only syslog is being used, the Exim monitor is unable to provide a log tail
68832 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
68833 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
68834 where it is.
68835 </para>
68836 </section>
68837 <section id="SECID250">
68838 <title>Log line flags</title>
68839 <para>
68840 One line is written to the main log for each message received, and for each
68841 successful, unsuccessful, and delayed delivery. These lines can readily be
68842 picked out by the distinctive two-character flags that immediately follow the
68843 timestamp. The flags are:
68844 </para>
68845 <literallayout>
68846 <literal>&lt;=</literal>     message arrival
68847 <literal>(=</literal>     message fakereject
68848 <literal>=&gt;</literal>     normal message delivery
68849 <literal>-&gt;</literal>     additional address in same delivery
68850 <literal>&gt;&gt;</literal>     cutthrough message delivery
68851 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
68852 <literal>**</literal>     delivery failed; address bounced
68853 <literal>==</literal>     delivery deferred; temporary problem
68854 </literallayout>
68855 </section>
68856 <section id="SECID251">
68857 <title>Logging message reception</title>
68858 <para>
68859 <indexterm role="concept">
68860 <primary>log</primary>
68861 <secondary>reception line</secondary>
68862 </indexterm>
68863 The format of the single-line entry in the main log that is written for every
68864 message received is shown in the basic example below, which is split over
68865 several lines in order to fit it on the page:
68866 </para>
68867 <literallayout class="monospaced">
68868 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
68869   H=mailer.fict.example [192.168.123.123] U=exim
68870   P=smtp S=5678 id=&lt;incoming message id&gt;
68871 </literallayout>
68872 <para>
68873 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
68874 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
68875 generated, this is followed by an item of the form
68876 </para>
68877 <literallayout class="monospaced">
68878 R=&lt;message id&gt;
68879 </literallayout>
68880 <para>
68881 which is a reference to the message that caused the bounce to be sent.
68882 </para>
68883 <para>
68884 <indexterm role="concept">
68885 <primary>HELO</primary>
68886 </indexterm>
68887 <indexterm role="concept">
68888 <primary>EHLO</primary>
68889 </indexterm>
68890 For messages from other hosts, the H and U fields identify the remote host and
68891 record the RFC 1413 identity of the user that sent the message, if one was
68892 received. The number given in square brackets is the IP address of the sending
68893 host. If there is a single, unparenthesized  host name in the H field, as
68894 above, it has been verified to correspond to the IP address (see the
68895 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
68896 by the remote host in the SMTP HELO or EHLO command, and has not been
68897 verified. If verification yields a different name to that given for HELO or
68898 EHLO, the verified name appears first, followed by the HELO or EHLO
68899 name in parentheses.
68900 </para>
68901 <para>
68902 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
68903 without brackets, in the HELO or EHLO command, leading to entries in
68904 the log containing text like these examples:
68905 </para>
68906 <literallayout class="monospaced">
68907 H=(10.21.32.43) [192.168.8.34]
68908 H=([10.21.32.43]) [192.168.8.34]
68909 </literallayout>
68910 <para>
68911 This can be confusing. Only the final address in square brackets can be relied
68912 on.
68913 </para>
68914 <para>
68915 For locally generated messages (that is, messages not received over TCP/IP),
68916 the H field is omitted, and the U field contains the login name of the caller
68917 of Exim.
68918 </para>
68919 <para>
68920 <indexterm role="concept">
68921 <primary>authentication</primary>
68922 <secondary>logging</secondary>
68923 </indexterm>
68924 <indexterm role="concept">
68925 <primary>AUTH</primary>
68926 <secondary>logging</secondary>
68927 </indexterm>
68928 For all messages, the P field specifies the protocol used to receive the
68929 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
68930 of incoming SMTP messages, the value indicates whether or not any SMTP
68931 extensions (ESMTP), encryption, or authentication were used. If the SMTP
68932 session was encrypted, there is an additional X field that records the cipher
68933 suite that was used.
68934 </para>
68935 <para>
68936 <indexterm role="concept">
68937 <primary>log</primary>
68938 <secondary>protocol</secondary>
68939 </indexterm>
68940 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
68941 hosts that have authenticated themselves using the SMTP AUTH command. The first
68942 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
68943 there is an additional item A= followed by the name of the authenticator that
68944 was used. If an authenticated identification was set up by the authenticator&#x2019;s
68945 <option>server_set_id</option> option, this is logged too, separated by a colon from the
68946 authenticator name.
68947 </para>
68948 <para>
68949 <indexterm role="concept">
68950 <primary>size</primary>
68951 <secondary>of message</secondary>
68952 </indexterm>
68953 The id field records the existing message id, if present. The size of the
68954 received message is given by the S field. When the message is delivered,
68955 headers may be removed or added, so that the size of delivered copies of the
68956 message may not correspond with this value (and indeed may be different to each
68957 other).
68958 </para>
68959 <para>
68960 The <option>log_selector</option> option can be used to request the logging of additional
68961 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
68962 </para>
68963 </section>
68964 <section id="SECID252">
68965 <title>Logging deliveries</title>
68966 <para>
68967 <indexterm role="concept">
68968 <primary>log</primary>
68969 <secondary>delivery line</secondary>
68970 </indexterm>
68971 The format of the single-line entry in the main log that is written for every
68972 delivery is shown in one of the examples below, for local and remote
68973 deliveries, respectively. Each example has been split into multiple lines in order
68974 to fit it on the page:
68975 </para>
68976 <literallayout class="monospaced">
68977 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
68978   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
68979 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
68980   monk@holistic.fict.example R=dnslookup T=remote_smtp
68981   H=holistic.fict.example [192.168.234.234]
68982 </literallayout>
68983 <para>
68984 For ordinary local deliveries, the original address is given in angle brackets
68985 after the final delivery address, which might be a pipe or a file. If
68986 intermediate address(es) exist between the original and the final address, the
68987 last of these is given in parentheses after the final address. The R and T
68988 fields record the router and transport that were used to process the address.
68989 </para>
68990 <para>
68991 If SMTP AUTH was used for the delivery there is an additional item A=
68992 followed by the name of the authenticator that was used.
68993 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
68994 option, this is logged too, separated by a colon from the authenticator name.
68995 </para>
68996 <para>
68997 If a shadow transport was run after a successful local delivery, the log line
68998 for the successful delivery has an item added on the end, of the form
68999 </para>
69000 <literallayout>
69001 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
69002 </literallayout>
69003 <para>
69004 If the shadow transport did not succeed, the error message is put in
69005 parentheses afterwards.
69006 </para>
69007 <para>
69008 <indexterm role="concept">
69009 <primary>asterisk</primary>
69010 <secondary>after IP address</secondary>
69011 </indexterm>
69012 When more than one address is included in a single delivery (for example, two
69013 SMTP RCPT commands in one transaction) the second and subsequent addresses are
69014 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
69015 down a single SMTP connection, an asterisk follows the IP address in the log
69016 lines for the second and subsequent messages.
69017 When two or more messages are delivered down a single TLS connection, the
69018 DNS and some TLS-related information logged for the first message delivered
69019 will not be present in the log lines for the second and subsequent messages.
69020 TLS cipher information is still available.
69021 </para>
69022 <para>
69023 <indexterm role="concept">
69024 <primary>delivery</primary>
69025 <secondary>cutthrough; logging</secondary>
69026 </indexterm>
69027 <indexterm role="concept">
69028 <primary>cutthrough</primary>
69029 <secondary>logging</secondary>
69030 </indexterm>
69031 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
69032 line precedes the reception line, since cutthrough waits for a possible
69033 rejection from the destination in case it can reject the sourced item.
69034 </para>
69035 <para>
69036 The generation of a reply message by a filter file gets logged as a
69037 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
69038 </para>
69039 <para>
69040 The <option>log_selector</option> option can be used to request the logging of additional
69041 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
69042 </para>
69043 </section>
69044 <section id="SECID253">
69045 <title>Discarded deliveries</title>
69046 <para>
69047 <indexterm role="concept">
69048 <primary>discarded messages</primary>
69049 </indexterm>
69050 <indexterm role="concept">
69051 <primary>message</primary>
69052 <secondary>discarded</secondary>
69053 </indexterm>
69054 <indexterm role="concept">
69055 <primary>delivery</primary>
69056 <secondary>discarded; logging</secondary>
69057 </indexterm>
69058 When a message is discarded as a result of the command <quote>seen finish</quote> being
69059 obeyed in a filter file which generates no deliveries, a log entry of the form
69060 </para>
69061 <literallayout class="monospaced">
69062 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
69063   &lt;low.club@bridge.example&gt; R=userforward
69064 </literallayout>
69065 <para>
69066 is written, to record why no deliveries are logged. When a message is discarded
69067 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
69068 </para>
69069 <literallayout class="monospaced">
69070 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
69071   &lt;hole@nowhere.example&gt; R=blackhole_router
69072 </literallayout>
69073 </section>
69074 <section id="SECID254">
69075 <title>Deferred deliveries</title>
69076 <para>
69077 When a delivery is deferred, a line of the following form is logged:
69078 </para>
69079 <literallayout class="monospaced">
69080 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
69081   R=dnslookup T=smtp defer (146): Connection refused
69082 </literallayout>
69083 <para>
69084 In the case of remote deliveries, the error is the one that was given for the
69085 last IP address that was tried. Details of individual SMTP failures are also
69086 written to the log, so the above line would be preceded by something like
69087 </para>
69088 <literallayout class="monospaced">
69089 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
69090   mail1.endrest.example [192.168.239.239]: Connection refused
69091 </literallayout>
69092 <para>
69093 When a deferred address is skipped because its retry time has not been reached,
69094 a message is written to the log, but this can be suppressed by setting an
69095 appropriate value in <option>log_selector</option>.
69096 </para>
69097 </section>
69098 <section id="SECID255">
69099 <title>Delivery failures</title>
69100 <para>
69101 <indexterm role="concept">
69102 <primary>delivery</primary>
69103 <secondary>failure; logging</secondary>
69104 </indexterm>
69105 If a delivery fails because an address cannot be routed, a line of the
69106 following form is logged:
69107 </para>
69108 <literallayout class="monospaced">
69109 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
69110   &lt;jim@trek99.example&gt;: unknown mail domain
69111 </literallayout>
69112 <para>
69113 If a delivery fails at transport time, the router and transport are shown, and
69114 the response from the remote host is included, as in this example:
69115 </para>
69116 <literallayout class="monospaced">
69117 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
69118   R=dnslookup T=remote_smtp: SMTP error from remote mailer
69119   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
69120   pbmail3.py.example [192.168.63.111]: 553 5.3.0
69121   &lt;ace400@pb.example&gt;...Addressee unknown
69122 </literallayout>
69123 <para>
69124 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
69125 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
69126 disabling PIPELINING. The log lines for all forms of delivery failure are
69127 flagged with <literal>**</literal>.
69128 </para>
69129 </section>
69130 <section id="SECID256">
69131 <title>Fake deliveries</title>
69132 <para>
69133 <indexterm role="concept">
69134 <primary>delivery</primary>
69135 <secondary>fake; logging</secondary>
69136 </indexterm>
69137 If a delivery does not actually take place because the <option>-N</option> option has been
69138 used to suppress it, a normal delivery line is written to the log, except that
69139 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
69140 </para>
69141 </section>
69142 <section id="SECID257">
69143 <title>Completion</title>
69144 <para>
69145 A line of the form
69146 </para>
69147 <literallayout class="monospaced">
69148 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
69149 </literallayout>
69150 <para>
69151 is written to the main log when a message is about to be removed from the spool
69152 at the end of its processing.
69153 </para>
69154 </section>
69155 <section id="SECID258">
69156 <title>Summary of Fields in Log Lines</title>
69157 <para>
69158 <indexterm role="concept">
69159 <primary>log</primary>
69160 <secondary>summary of fields</secondary>
69161 </indexterm>
69162 A summary of the field identifiers that are used in log lines is shown in
69163 the following table:
69164 </para>
69165 <literallayout>
69166 <literal>A   </literal>        authenticator name (and optional id and sender)
69167 <literal>C   </literal>        SMTP confirmation on delivery
69168 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
69169 <literal>CV  </literal>        certificate verification status
69170 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
69171 <literal>DKIM</literal>        domain verified in incoming message
69172 <literal>DN  </literal>        distinguished name from peer certificate
69173 <literal>DS  </literal>        DNSSEC secured lookups
69174 <literal>DT  </literal>        on <literal>=&gt;</literal>, <emphasis>==</emphasis> and <emphasis>**</emphasis> lines: time taken for, or to attempt, a delivery
69175 <literal>F   </literal>        sender address (on delivery lines)
69176 <literal>H   </literal>        host name and IP address
69177 <literal>I   </literal>        local interface used
69178 <literal>id  </literal>        message id (from header) for incoming message
69179 <literal>K   </literal>        CHUNKING extension used
69180 <literal>L   </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: PIPELINING extension used
69181 <literal>M8S </literal>        8BITMIME status for incoming message
69182 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
69183 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
69184 <literal>PRDR</literal>        PRDR extension used
69185 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
69186 <literal>Q   </literal>        alternate queue name
69187 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
69188 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
69189 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
69190 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
69191 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
69192 <literal>S   </literal>        size of message in bytes
69193 <literal>SNI </literal>        server name indication from TLS client hello
69194 <literal>ST  </literal>        shadow transport name
69195 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
69196 <literal>TFO </literal>        connection took advantage of TCP Fast Open
69197 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
69198 <literal>U   </literal>        local user or RFC 1413 identity
69199 <literal>X   </literal>        TLS cipher suite
69200 </literallayout>
69201 </section>
69202 <section id="SECID259">
69203 <title>Other log entries</title>
69204 <para>
69205 Various other types of log entry are written from time to time. Most should be
69206 self-explanatory. Among the more common are:
69207 </para>
69208 <itemizedlist>
69209 <listitem>
69210 <para>
69211 <indexterm role="concept">
69212 <primary>retry</primary>
69213 <secondary>time not reached</secondary>
69214 </indexterm>
69215 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
69216 during routing or local delivery, and the time to retry has not yet arrived.
69217 This message is not written to an individual message log file unless it happens
69218 during the first delivery attempt.
69219 </para>
69220 </listitem>
69221 <listitem>
69222 <para>
69223 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
69224 temporary errors during remote delivery, and the retry time has not yet arrived
69225 for any of the hosts to which it is routed.
69226 </para>
69227 </listitem>
69228 <listitem>
69229 <para>
69230 <indexterm role="concept">
69231 <primary>spool directory</primary>
69232 <secondary>file locked</secondary>
69233 </indexterm>
69234 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
69235 some other Exim process is already working on the message. This can be quite
69236 common if queue running processes are started at frequent intervals. The
69237 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
69238 doing.
69239 </para>
69240 </listitem>
69241 <listitem>
69242 <para>
69243 <indexterm role="concept">
69244 <primary>error</primary>
69245 <secondary>ignored</secondary>
69246 </indexterm>
69247 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
69248 message:
69249 </para>
69250 <orderedlist numeration="arabic">
69251 <listitem>
69252 <para>
69253 Exim failed to deliver a bounce message whose age was greater than
69254 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
69255 </para>
69256 </listitem>
69257 <listitem>
69258 <para>
69259 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
69260 failed. The delivery was discarded.
69261 </para>
69262 </listitem>
69263 <listitem>
69264 <para>
69265 A delivery set up by a router configured with
69266 </para>
69267 <literallayout class="monospaced">
69268     errors_to = &lt;&gt;
69269 </literallayout>
69270 <para>
69271 failed. The delivery was discarded.
69272 </para>
69273 </listitem>
69274 </orderedlist>
69275 </listitem>
69276 <listitem>
69277 <para>
69278 <indexterm role="concept">
69279 <primary>DKIM</primary>
69280 <secondary>log line</secondary>
69281 </indexterm>
69282 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
69283 logging and the message has a DKIM signature header.
69284 </para>
69285 </listitem>
69286 </itemizedlist>
69287 </section>
69288 <section id="SECTlogselector">
69289 <title>Reducing or increasing what is logged</title>
69290 <para>
69291 <indexterm role="concept">
69292 <primary>log</primary>
69293 <secondary>selectors</secondary>
69294 </indexterm>
69295 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
69296 default logging, or you can request additional logging. The value of
69297 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
69298 example:
69299 </para>
69300 <literallayout class="monospaced">
69301 log_selector = +arguments -retry_defer
69302 </literallayout>
69303 <para>
69304 The list of optional log items is in the following table, with the default
69305 selection marked by asterisks:
69306 </para>
69307 <literallayout>
69308 <literal> 8bitmime                   </literal>  received 8BITMIME status
69309 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
69310 <literal> address_rewrite            </literal>  address rewriting
69311 <literal> all_parents                </literal>  all parents in =&gt; lines
69312 <literal> arguments                  </literal>  command line arguments
69313 <literal>*connection_reject          </literal>  connection rejections
69314 <literal>*delay_delivery             </literal>  immediate delivery delayed
69315 <literal> deliver_time               </literal>  time taken to attempt delivery
69316 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
69317 <literal>*dkim                       </literal>  DKIM verified domain on &lt;= lines
69318 <literal> dkim_verbose               </literal>  separate full DKIM verification result line, per signature
69319 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
69320 <literal> dnssec                     </literal>  DNSSEC secured lookups
69321 <literal>*etrn                       </literal>  ETRN commands
69322 <literal>*host_lookup_failed         </literal>  as it says
69323 <literal> ident_timeout              </literal>  timeout for ident connection
69324 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
69325 <literal> incoming_port              </literal>  remote port on &lt;= lines
69326 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
69327 <literal> millisec                   </literal>  millisecond timestamps and RT,QT,DT,D times
69328 <literal>*msg_id                     </literal>  on &lt;= lines, Message-ID: header value
69329 <literal> msg_id_created             </literal>  on &lt;= lines, Message-ID: header value when one had to be added
69330 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
69331 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
69332 <literal>*queue_run                  </literal>  start and end queue runs
69333 <literal> queue_time                 </literal>  time on queue for one recipient
69334 <literal> queue_time_overall         </literal>  time on queue for whole message
69335 <literal> pid                        </literal>  Exim process id
69336 <literal> pipelining                 </literal>  PIPELINING use, on &lt;= and =&gt; lines
69337 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
69338 <literal> receive_time               </literal>  time taken to receive message
69339 <literal> received_recipients        </literal>  recipients on &lt;= lines
69340 <literal> received_sender            </literal>  sender on &lt;= lines
69341 <literal>*rejected_header            </literal>  header contents on reject log
69342 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
69343 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
69344 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
69345 <literal>*sender_verify_fail         </literal>  sender verification failures
69346 <literal>*size_reject                </literal>  rejection because too big
69347 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
69348 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
69349 <literal> smtp_connection            </literal>  incoming SMTP connections
69350 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
69351 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
69352 <literal> smtp_no_mail               </literal>  session with no MAIL commands
69353 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
69354 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
69355 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
69356 <literal>*tls_certificate_verified   </literal>  certificate verification status
69357 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
69358 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
69359 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
69360 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
69361
69362 <literal> all                        </literal>  all of the above
69363 </literallayout>
69364 <para>
69365 See also the <option>slow_lookup_log</option> main configuration option,
69366 section <xref linkend="SECID99"/>
69367 </para>
69368 <para>
69369 More details on each of these items follows:
69370 </para>
69371 <itemizedlist>
69372 <listitem>
69373 <para>
69374 <indexterm role="concept">
69375 <primary>8BITMIME</primary>
69376 </indexterm>
69377 <indexterm role="concept">
69378 <primary>log</primary>
69379 <secondary>8BITMIME</secondary>
69380 </indexterm>
69381 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
69382 which may help in tracking down interoperability issues with ancient MTAs
69383 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
69384 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
69385 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
69386 </para>
69387 </listitem>
69388 <listitem>
69389 <para>
69390 <indexterm role="concept">
69391 <primary><option>warn</option> ACL verb</primary>
69392 <secondary>log when skipping</secondary>
69393 </indexterm>
69394 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
69395 its conditions cannot be evaluated, a log line to this effect is written if
69396 this log selector is set.
69397 </para>
69398 </listitem>
69399 <listitem>
69400 <para>
69401 <indexterm role="concept">
69402 <primary>log</primary>
69403 <secondary>rewriting</secondary>
69404 </indexterm>
69405 <indexterm role="concept">
69406 <primary>rewriting</primary>
69407 <secondary>logging</secondary>
69408 </indexterm>
69409 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
69410 rewrites, but not to rewrites in filters run as an unprivileged user (because
69411 such users cannot access the log).
69412 </para>
69413 </listitem>
69414 <listitem>
69415 <para>
69416 <indexterm role="concept">
69417 <primary>log</primary>
69418 <secondary>full parentage</secondary>
69419 </indexterm>
69420 <option>all_parents</option>: Normally only the original and final addresses are logged on
69421 delivery lines; with this selector, intermediate parents are given in
69422 parentheses between them.
69423 </para>
69424 </listitem>
69425 <listitem>
69426 <para>
69427 <indexterm role="concept">
69428 <primary>log</primary>
69429 <secondary>Exim arguments</secondary>
69430 </indexterm>
69431 <indexterm role="concept">
69432 <primary>Exim arguments, logging</primary>
69433 </indexterm>
69434 <option>arguments</option>: This causes Exim to write the arguments with which it was called
69435 to the main log, preceded by the current working directory. This is a debugging
69436 feature, added to make it easier to find out how certain MUAs call
69437 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
69438 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
69439 that are empty or that contain white space are quoted. Non-printing characters
69440 are shown as escape sequences. This facility cannot log unrecognized arguments,
69441 because the arguments are checked before the configuration file is read. The
69442 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
69443 between the caller and Exim.
69444 </para>
69445 </listitem>
69446 <listitem>
69447 <para>
69448 <indexterm role="concept">
69449 <primary>log</primary>
69450 <secondary>connection rejections</secondary>
69451 </indexterm>
69452 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
69453 connection is rejected, for whatever reason.
69454 </para>
69455 </listitem>
69456 <listitem>
69457 <para>
69458 <indexterm role="concept">
69459 <primary>log</primary>
69460 <secondary>delayed delivery</secondary>
69461 </indexterm>
69462 <indexterm role="concept">
69463 <primary>delayed delivery, logging</primary>
69464 </indexterm>
69465 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
69466 started for an incoming message because the load is too high or too many
69467 messages were received on one connection. Logging does not occur if no delivery
69468 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
69469 </para>
69470 </listitem>
69471 <listitem>
69472 <para>
69473 <indexterm role="concept">
69474 <primary>log</primary>
69475 <secondary>delivery duration</secondary>
69476 </indexterm>
69477 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
69478 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
69479 If millisecond logging is enabled, short times will be shown with greater
69480 precision, eg. <literal>DT=0.304s</literal>.
69481 </para>
69482 </listitem>
69483 <listitem>
69484 <para>
69485 <indexterm role="concept">
69486 <primary>log</primary>
69487 <secondary>message size on delivery</secondary>
69488 </indexterm>
69489 <indexterm role="concept">
69490 <primary>size</primary>
69491 <secondary>of message</secondary>
69492 </indexterm>
69493 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
69494 the <quote>=&gt;</quote> line, tagged with S=.
69495 </para>
69496 </listitem>
69497 <listitem>
69498 <para>
69499 <indexterm role="concept">
69500 <primary>log</primary>
69501 <secondary>DKIM verification</secondary>
69502 </indexterm>
69503 <indexterm role="concept">
69504 <primary>DKIM</primary>
69505 <secondary>verification logging</secondary>
69506 </indexterm>
69507 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
69508 verifies successfully a tag of DKIM is added, with one of the verified domains.
69509 </para>
69510 </listitem>
69511 <listitem>
69512 <para>
69513 <indexterm role="concept">
69514 <primary>log</primary>
69515 <secondary>DKIM verification</secondary>
69516 </indexterm>
69517 <indexterm role="concept">
69518 <primary>DKIM</primary>
69519 <secondary>verification logging</secondary>
69520 </indexterm>
69521 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
69522 </para>
69523 </listitem>
69524 <listitem>
69525 <para>
69526 <indexterm role="concept">
69527 <primary>log</primary>
69528 <secondary>dnslist defer</secondary>
69529 </indexterm>
69530 <indexterm role="concept">
69531 <primary>DNS list</primary>
69532 <secondary>logging defer</secondary>
69533 </indexterm>
69534 <indexterm role="concept">
69535 <primary>black list (DNS)</primary>
69536 </indexterm>
69537 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
69538 DNS black list suffers a temporary error.
69539 </para>
69540 </listitem>
69541 <listitem>
69542 <para>
69543 <indexterm role="concept">
69544 <primary>log</primary>
69545 <secondary>dnssec</secondary>
69546 </indexterm>
69547 <indexterm role="concept">
69548 <primary>dnssec</primary>
69549 <secondary>logging</secondary>
69550 </indexterm>
69551 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
69552 dns lookups gave secure results a tag of DS is added.
69553 For acceptance this covers the reverse and forward lookups for host name verification.
69554 It does not cover helo-name verification.
69555 For delivery this covers the SRV, MX, A and/or AAAA lookups.
69556 </para>
69557 </listitem>
69558 <listitem>
69559 <para>
69560 <indexterm role="concept">
69561 <primary>log</primary>
69562 <secondary>ETRN commands</secondary>
69563 </indexterm>
69564 <indexterm role="concept">
69565 <primary>ETRN</primary>
69566 <secondary>logging</secondary>
69567 </indexterm>
69568 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
69569 is run to determine whether or not it is actually accepted. An invalid ETRN
69570 command, or one received within a message transaction is not logged by this
69571 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
69572 </para>
69573 </listitem>
69574 <listitem>
69575 <para>
69576 <indexterm role="concept">
69577 <primary>log</primary>
69578 <secondary>host lookup failure</secondary>
69579 </indexterm>
69580 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
69581 any addresses, or when a lookup of an IP address fails to find a host name, a
69582 log line is written. This logging does not apply to direct DNS lookups when
69583 routing email addresses, but it does apply to <quote>byname</quote> lookups.
69584 </para>
69585 </listitem>
69586 <listitem>
69587 <para>
69588 <indexterm role="concept">
69589 <primary>log</primary>
69590 <secondary>ident timeout</secondary>
69591 </indexterm>
69592 <indexterm role="concept">
69593 <primary>RFC 1413</primary>
69594 <secondary>logging timeout</secondary>
69595 </indexterm>
69596 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
69597 client&#x2019;s ident port times out.
69598 </para>
69599 </listitem>
69600 <listitem>
69601 <para>
69602 <indexterm role="concept">
69603 <primary>log</primary>
69604 <secondary>incoming interface</secondary>
69605 </indexterm>
69606 <indexterm role="concept">
69607 <primary>log</primary>
69608 <secondary>local interface</secondary>
69609 </indexterm>
69610 <indexterm role="concept">
69611 <primary>log</primary>
69612 <secondary>local address and port</secondary>
69613 </indexterm>
69614 <indexterm role="concept">
69615 <primary>TCP/IP</primary>
69616 <secondary>logging local address and port</secondary>
69617 </indexterm>
69618 <indexterm role="concept">
69619 <primary>interface</primary>
69620 <secondary>logging</secondary>
69621 </indexterm>
69622 <option>incoming_interface</option>: The interface on which a message was received is added
69623 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
69624 followed by a colon and the port number. The local interface and port are also
69625 added to other SMTP log lines, for example, <quote>SMTP connection from</quote>, to
69626 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
69627 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
69628 </para>
69629 </listitem>
69630 <listitem>
69631 <para>
69632 <indexterm role="concept">
69633 <primary>log</primary>
69634 <secondary>incoming proxy address</secondary>
69635 </indexterm>
69636 <indexterm role="concept">
69637 <primary>proxy</primary>
69638 <secondary>logging proxy address</secondary>
69639 </indexterm>
69640 <indexterm role="concept">
69641 <primary>TCP/IP</primary>
69642 <secondary>logging proxy address</secondary>
69643 </indexterm>
69644 <option>proxy</option>: The internal (closest to the system running Exim) IP address
69645 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
69646 on a proxied connection
69647 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
69648 See <xref linkend="SECTproxyInbound"/> for more information.
69649 </para>
69650 </listitem>
69651 <listitem>
69652 <para>
69653 <indexterm role="concept">
69654 <primary>log</primary>
69655 <secondary>incoming remote port</secondary>
69656 </indexterm>
69657 <indexterm role="concept">
69658 <primary>port</primary>
69659 <secondary>logging remote</secondary>
69660 </indexterm>
69661 <indexterm role="concept">
69662 <primary>TCP/IP</primary>
69663 <secondary>logging incoming remote port</secondary>
69664 </indexterm>
69665 <indexterm role="variable">
69666 <primary><varname>$sender_fullhost</varname></primary>
69667 </indexterm>
69668 <indexterm role="variable">
69669 <primary><varname>$sender_rcvhost</varname></primary>
69670 </indexterm>
69671 <option>incoming_port</option>: The remote port number from which a message was received is
69672 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
69673 in square brackets, and separated from it by a colon. This is implemented by
69674 changing the value that is put in the <varname>$sender_fullhost</varname> and
69675 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
69676 important with the widening use of NAT (see RFC 2505).
69677 </para>
69678 </listitem>
69679 <listitem>
69680 <para>
69681 <indexterm role="concept">
69682 <primary>log</primary>
69683 <secondary>dropped connection</secondary>
69684 </indexterm>
69685 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
69686 connection is unexpectedly dropped.
69687 </para>
69688 </listitem>
69689 <listitem>
69690 <para>
69691 <indexterm role="concept">
69692 <primary>log</primary>
69693 <secondary>millisecond timestamps</secondary>
69694 </indexterm>
69695 <indexterm role="concept">
69696 <primary>millisecond</primary>
69697 <secondary>logging</secondary>
69698 </indexterm>
69699 <indexterm role="concept">
69700 <primary>timestamps</primary>
69701 <secondary>millisecond, in logs</secondary>
69702 </indexterm>
69703 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
69704 appended to the seconds value.
69705 </para>
69706 </listitem>
69707 <listitem>
69708 <para>
69709 <indexterm role="concept">
69710 <primary>log</primary>
69711 <secondary>message id</secondary>
69712 </indexterm>
69713 <option>msg_id</option>: The value of the Message-ID: header.
69714 </para>
69715 </listitem>
69716 <listitem>
69717 <para>
69718 <option>msg_id_created</option>: The value of the Message-ID: header, when one had to be created.
69719 This will be either because the message is a bounce, or was submitted locally
69720 (submission mode) without one.
69721 The field identifier will have an asterix appended: <quote>id*=</quote>.
69722 </para>
69723 </listitem>
69724 <listitem>
69725 <para>
69726 <indexterm role="concept">
69727 <primary>log</primary>
69728 <secondary>outgoing interface</secondary>
69729 </indexterm>
69730 <indexterm role="concept">
69731 <primary>log</primary>
69732 <secondary>local interface</secondary>
69733 </indexterm>
69734 <indexterm role="concept">
69735 <primary>log</primary>
69736 <secondary>local address and port</secondary>
69737 </indexterm>
69738 <indexterm role="concept">
69739 <primary>TCP/IP</primary>
69740 <secondary>logging local address and port</secondary>
69741 </indexterm>
69742 <indexterm role="concept">
69743 <primary>interface</primary>
69744 <secondary>logging</secondary>
69745 </indexterm>
69746 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
69747 interface on which a message was sent is added to delivery lines as an I= tag
69748 followed by IP address in square brackets. You can disable this by turning
69749 off the <option>outgoing_interface</option> option.
69750 </para>
69751 </listitem>
69752 <listitem>
69753 <para>
69754 <indexterm role="concept">
69755 <primary>log</primary>
69756 <secondary>outgoing remote port</secondary>
69757 </indexterm>
69758 <indexterm role="concept">
69759 <primary>port</primary>
69760 <secondary>logging outgoing remote</secondary>
69761 </indexterm>
69762 <indexterm role="concept">
69763 <primary>TCP/IP</primary>
69764 <secondary>logging outgoing remote port</secondary>
69765 </indexterm>
69766 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
69767 containing =&gt; tags) following the IP address.
69768 The local port is also added if <option>incoming_interface</option> and
69769 <option>outgoing_interface</option> are both enabled.
69770 This option is not included in the default setting, because for most ordinary
69771 configurations, the remote port number is always 25 (the SMTP port), and the
69772 local port is a random ephemeral port.
69773 </para>
69774 </listitem>
69775 <listitem>
69776 <para>
69777 <indexterm role="concept">
69778 <primary>log</primary>
69779 <secondary>process ids in</secondary>
69780 </indexterm>
69781 <indexterm role="concept">
69782 <primary>pid (process id)</primary>
69783 <secondary>in log lines</secondary>
69784 </indexterm>
69785 <option>pid</option>: The current process id is added to every log line, in square brackets,
69786 immediately after the time and date.
69787 </para>
69788 </listitem>
69789 <listitem>
69790 <para>
69791 <indexterm role="concept">
69792 <primary>log</primary>
69793 <secondary>pipelining</secondary>
69794 </indexterm>
69795 <indexterm role="concept">
69796 <primary>pipelining</primary>
69797 <secondary>logging outgoing</secondary>
69798 </indexterm>
69799 <option>pipelining</option>: A field is added to delivery and accept
69800 log lines when the ESMTP PIPELINING extension was used.
69801 The field is a single "L".
69802 </para>
69803 <para>
69804 On accept lines, where PIPELINING was offered but not used by the client,
69805 the field has a minus appended.
69806 </para>
69807 <para>
69808 <indexterm role="concept">
69809 <primary>pipelining</primary>
69810 <secondary>early connection</secondary>
69811 </indexterm>
69812 If Exim is built with the SUPPORT_PIPE_CONNECT build option
69813 accept "L" fields have a period appended if the feature was
69814 offered but not used, or an asterisk appended if used.
69815 Delivery "L" fields have an asterisk appended if used.
69816 </para>
69817 </listitem>
69818 <listitem>
69819 <para>
69820 <indexterm role="concept">
69821 <primary>log</primary>
69822 <secondary>queue run</secondary>
69823 </indexterm>
69824 <indexterm role="concept">
69825 <primary>queue runner</primary>
69826 <secondary>logging</secondary>
69827 </indexterm>
69828 <option>queue_run</option>: The start and end of every queue run are logged.
69829 </para>
69830 </listitem>
69831 <listitem>
69832 <para>
69833 <indexterm role="concept">
69834 <primary>log</primary>
69835 <secondary>queue time</secondary>
69836 </indexterm>
69837 <option>queue_time</option>: The amount of time the message has been in the queue on the
69838 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
69839 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
69840 includes reception time as well as the delivery time for the current address.
69841 This means that it may be longer than the difference between the arrival and
69842 delivery log line times, because the arrival log line is not written until the
69843 message has been successfully received.
69844 If millisecond logging is enabled, short times will be shown with greater
69845 precision, eg. <literal>QT=1.578s</literal>.
69846 </para>
69847 </listitem>
69848 <listitem>
69849 <para>
69850 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
69851 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
69852 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
69853 message, so it includes reception time as well as the total delivery time.
69854 </para>
69855 </listitem>
69856 <listitem>
69857 <para>
69858 <indexterm role="concept">
69859 <primary>log</primary>
69860 <secondary>receive duration</secondary>
69861 </indexterm>
69862 <option>receive_time</option>: For each message, the amount of real time it has taken to
69863 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
69864 If millisecond logging is enabled, short times will be shown with greater
69865 precision, eg. <literal>RT=0.204s</literal>.
69866 </para>
69867 </listitem>
69868 <listitem>
69869 <para>
69870 <indexterm role="concept">
69871 <primary>log</primary>
69872 <secondary>recipients</secondary>
69873 </indexterm>
69874 <option>received_recipients</option>: The recipients of a message are listed in the main log
69875 as soon as the message is received. The list appears at the end of the log line
69876 that is written when a message is received, preceded by the word <quote>for</quote>. The
69877 addresses are listed after they have been qualified, but before any rewriting
69878 has taken place.
69879 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
69880 in the list.
69881 </para>
69882 </listitem>
69883 <listitem>
69884 <para>
69885 <indexterm role="concept">
69886 <primary>log</primary>
69887 <secondary>sender reception</secondary>
69888 </indexterm>
69889 <option>received_sender</option>: The unrewritten original sender of a message is added to
69890 the end of the log line that records the message&#x2019;s arrival, after the word
69891 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
69892 </para>
69893 </listitem>
69894 <listitem>
69895 <para>
69896 <indexterm role="concept">
69897 <primary>log</primary>
69898 <secondary>header lines for rejection</secondary>
69899 </indexterm>
69900 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
69901 rejection is written to the reject log, the complete header is added to the
69902 log. Header logging can be turned off individually for messages that are
69903 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
69904 </para>
69905 </listitem>
69906 <listitem>
69907 <para>
69908 <indexterm role="concept">
69909 <primary>log</primary>
69910 <secondary>retry defer</secondary>
69911 </indexterm>
69912 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
69913 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
69914 message is always omitted from individual message logs after the first delivery
69915 attempt.
69916 </para>
69917 </listitem>
69918 <listitem>
69919 <para>
69920 <indexterm role="concept">
69921 <primary>log</primary>
69922 <secondary>return path</secondary>
69923 </indexterm>
69924 <option>return_path_on_delivery</option>: The return path that is being transmitted with
69925 the message is included in delivery and bounce lines, using the tag P=.
69926 This is omitted if no delivery actually happens, for example, if routing fails,
69927 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
69928 </para>
69929 </listitem>
69930 <listitem>
69931 <para>
69932 <indexterm role="concept">
69933 <primary>log</primary>
69934 <secondary>sender on delivery</secondary>
69935 </indexterm>
69936 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
69937 and bounce line, tagged by F= (for <quote>from</quote>).
69938 This is the original sender that was received with the message; it is not
69939 necessarily the same as the outgoing return path.
69940 </para>
69941 </listitem>
69942 <listitem>
69943 <para>
69944 <indexterm role="concept">
69945 <primary>log</primary>
69946 <secondary>sender verify failure</secondary>
69947 </indexterm>
69948 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
69949 gives details of a sender verification failure is not written. Log lines for
69950 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
69951 detail is lost.
69952 </para>
69953 </listitem>
69954 <listitem>
69955 <para>
69956 <indexterm role="concept">
69957 <primary>log</primary>
69958 <secondary>size rejection</secondary>
69959 </indexterm>
69960 <option>size_reject</option>: A log line is written whenever a message is rejected because
69961 it is too big.
69962 </para>
69963 </listitem>
69964 <listitem>
69965 <para>
69966 <indexterm role="concept">
69967 <primary>log</primary>
69968 <secondary>frozen messages; skipped</secondary>
69969 </indexterm>
69970 <indexterm role="concept">
69971 <primary>frozen messages</primary>
69972 <secondary>logging skipping</secondary>
69973 </indexterm>
69974 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
69975 queue run because it is frozen or because another process is already delivering
69976 it.
69977 <indexterm role="concept">
69978 <primary><quote>spool file is locked</quote></primary>
69979 </indexterm>
69980 The message that is written is <quote>spool file is locked</quote>.
69981 </para>
69982 </listitem>
69983 <listitem>
69984 <para>
69985 <indexterm role="concept">
69986 <primary>log</primary>
69987 <secondary>smtp confirmation</secondary>
69988 </indexterm>
69989 <indexterm role="concept">
69990 <primary>SMTP</primary>
69991 <secondary>logging confirmation</secondary>
69992 </indexterm>
69993 <indexterm role="concept">
69994 <primary>LMTP</primary>
69995 <secondary>logging confirmation</secondary>
69996 </indexterm>
69997 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
69998 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
69999 A number of MTAs (including Exim) return an identifying string in this
70000 response.
70001 </para>
70002 </listitem>
70003 <listitem>
70004 <para>
70005 <indexterm role="concept">
70006 <primary>log</primary>
70007 <secondary>SMTP connections</secondary>
70008 </indexterm>
70009 <indexterm role="concept">
70010 <primary>SMTP</primary>
70011 <secondary>logging connections</secondary>
70012 </indexterm>
70013 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
70014 established or closed, unless the connection is from a host that matches
70015 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
70016 only when the closure is unexpected.) This applies to connections from local
70017 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
70018 dropped in the middle of a message, a log line is always written, whether or
70019 not this selector is set, but otherwise nothing is written at the start and end
70020 of connections unless this selector is enabled.
70021 </para>
70022 <para>
70023 For TCP/IP connections to an Exim daemon, the current number of connections is
70024 included in the log message for each new connection, but note that the count is
70025 reset if the daemon is restarted.
70026 Also, because connections are closed (and the closure is logged) in
70027 subprocesses, the count may not include connections that have been closed but
70028 whose termination the daemon has not yet noticed. Thus, while it is possible to
70029 match up the opening and closing of connections in the log, the value of the
70030 logged counts may not be entirely accurate.
70031 </para>
70032 </listitem>
70033 <listitem>
70034 <para>
70035 <indexterm role="concept">
70036 <primary>log</primary>
70037 <secondary>SMTP transaction; incomplete</secondary>
70038 </indexterm>
70039 <indexterm role="concept">
70040 <primary>SMTP</primary>
70041 <secondary>logging incomplete transactions</secondary>
70042 </indexterm>
70043 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
70044 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
70045 and the message sender plus any accepted recipients are included in the log
70046 line. This can provide evidence of dictionary attacks.
70047 </para>
70048 </listitem>
70049 <listitem>
70050 <para>
70051 <indexterm role="concept">
70052 <primary>log</primary>
70053 <secondary>non-MAIL SMTP sessions</secondary>
70054 </indexterm>
70055 <indexterm role="concept">
70056 <primary>MAIL</primary>
70057 <secondary>logging session without</secondary>
70058 </indexterm>
70059 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
70060 connection terminates without having issued a MAIL command. This includes both
70061 the case when the connection is dropped, and the case when QUIT is used. It
70062 does not include cases where the connection is rejected right at the start (by
70063 an ACL, or because there are too many connections, or whatever). These cases
70064 already have their own log lines.
70065 </para>
70066 <para>
70067 The log line that is written contains the identity of the client in the usual
70068 way, followed by D= and a time, which records the duration of the connection.
70069 If the connection was authenticated, this fact is logged exactly as it is for
70070 an incoming message, with an A= item. If the connection was encrypted, CV=,
70071 DN=, and X= items may appear as they do for an incoming message, controlled by
70072 the same logging options.
70073 </para>
70074 <para>
70075 Finally, if any SMTP commands were issued during the connection, a C= item
70076 is added to the line, listing the commands that were used. For example,
70077 </para>
70078 <literallayout class="monospaced">
70079 C=EHLO,QUIT
70080 </literallayout>
70081 <para>
70082 shows that the client issued QUIT straight after EHLO. If there were fewer
70083 than 20 commands, they are all listed. If there were more than 20 commands,
70084 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
70085 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
70086 have been aborted before 20 non-mail commands are processed.
70087 </para>
70088 </listitem>
70089 <listitem>
70090 <para>
70091 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
70092 colon-separated, is appended to the A= item for a message arrival or delivery
70093 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
70094 was accepted or used.
70095 </para>
70096 </listitem>
70097 <listitem>
70098 <para>
70099 <indexterm role="concept">
70100 <primary>log</primary>
70101 <secondary>SMTP protocol error</secondary>
70102 </indexterm>
70103 <indexterm role="concept">
70104 <primary>SMTP</primary>
70105 <secondary>logging protocol error</secondary>
70106 </indexterm>
70107 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
70108 encountered. Exim does not have perfect detection of all protocol errors
70109 because of transmission delays and the use of pipelining. If PIPELINING has
70110 been advertised to a client, an Exim server assumes that the client will use
70111 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
70112 received after rejecting MAIL) as protocol errors.
70113 </para>
70114 </listitem>
70115 <listitem>
70116 <para>
70117 <indexterm role="concept">
70118 <primary>SMTP</primary>
70119 <secondary>logging syntax errors</secondary>
70120 </indexterm>
70121 <indexterm role="concept">
70122 <primary>SMTP</primary>
70123 <secondary>syntax errors; logging</secondary>
70124 </indexterm>
70125 <indexterm role="concept">
70126 <primary>SMTP</primary>
70127 <secondary>unknown command; logging</secondary>
70128 </indexterm>
70129 <indexterm role="concept">
70130 <primary>log</primary>
70131 <secondary>unknown SMTP command</secondary>
70132 </indexterm>
70133 <indexterm role="concept">
70134 <primary>log</primary>
70135 <secondary>SMTP syntax error</secondary>
70136 </indexterm>
70137 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
70138 encountered. An unrecognized command is treated as a syntax error. For an
70139 external connection, the host identity is given; for an internal connection
70140 using <option>-bs</option> the sender identification (normally the calling user) is given.
70141 </para>
70142 </listitem>
70143 <listitem>
70144 <para>
70145 <indexterm role="concept">
70146 <primary>log</primary>
70147 <secondary>subject</secondary>
70148 </indexterm>
70149 <indexterm role="concept">
70150 <primary>subject, logging</primary>
70151 </indexterm>
70152 <option>subject</option>: The subject of the message is added to the arrival log line,
70153 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
70154 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
70155 specifies whether characters with values greater than 127 should be logged
70156 unchanged, or whether they should be rendered as escape sequences.
70157 </para>
70158 </listitem>
70159 <listitem>
70160 <para>
70161 <indexterm role="concept">
70162 <primary>log</primary>
70163 <secondary>certificate verification</secondary>
70164 </indexterm>
70165 <indexterm role="concept">
70166 <primary>log</primary>
70167 <secondary>DANE</secondary>
70168 </indexterm>
70169 <indexterm role="concept">
70170 <primary>DANE</primary>
70171 <secondary>logging</secondary>
70172 </indexterm>
70173 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
70174 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
70175 verified
70176 using a CA trust anchor,
70177 <literal>CA=dane</literal> if using a DNS trust anchor,
70178 and <literal>CV=no</literal> if not.
70179 </para>
70180 </listitem>
70181 <listitem>
70182 <para>
70183 <indexterm role="concept">
70184 <primary>log</primary>
70185 <secondary>TLS cipher</secondary>
70186 </indexterm>
70187 <indexterm role="concept">
70188 <primary>TLS</primary>
70189 <secondary>logging cipher</secondary>
70190 </indexterm>
70191 <option>tls_cipher</option>: When a message is sent or received over an encrypted
70192 connection, the cipher suite used is added to the log line, preceded by X=.
70193 </para>
70194 </listitem>
70195 <listitem>
70196 <para>
70197 <indexterm role="concept">
70198 <primary>log</primary>
70199 <secondary>TLS peer DN</secondary>
70200 </indexterm>
70201 <indexterm role="concept">
70202 <primary>TLS</primary>
70203 <secondary>logging peer DN</secondary>
70204 </indexterm>
70205 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
70206 connection, and a certificate is supplied by the remote host, the peer DN is
70207 added to the log line, preceded by DN=.
70208 </para>
70209 </listitem>
70210 <listitem>
70211 <para>
70212 <indexterm role="concept">
70213 <primary>log</primary>
70214 <secondary>TLS SNI</secondary>
70215 </indexterm>
70216 <indexterm role="concept">
70217 <primary>TLS</primary>
70218 <secondary>logging SNI</secondary>
70219 </indexterm>
70220 <option>tls_sni</option>: When a message is received over an encrypted connection, and
70221 the remote host provided the Server Name Indication extension, the SNI is
70222 added to the log line, preceded by SNI=.
70223 </para>
70224 </listitem>
70225 <listitem>
70226 <para>
70227 <indexterm role="concept">
70228 <primary>log</primary>
70229 <secondary>DNS failure in list</secondary>
70230 </indexterm>
70231 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
70232 result of a list match is failure because a DNS lookup failed.
70233 </para>
70234 </listitem>
70235 </itemizedlist>
70236 </section>
70237 <section id="SECID260">
70238 <title>Message log</title>
70239 <para>
70240 <indexterm role="concept">
70241 <primary>message</primary>
70242 <secondary>log file for</secondary>
70243 </indexterm>
70244 <indexterm role="concept">
70245 <primary>log</primary>
70246 <secondary>message log; description of</secondary>
70247 </indexterm>
70248 <indexterm role="concept">
70249 <primary><filename>msglog</filename> directory</primary>
70250 </indexterm>
70251 <indexterm role="option">
70252 <primary><option>preserve_message_logs</option></primary>
70253 </indexterm>
70254 In addition to the general log files, Exim writes a log file for each message
70255 that it handles. The names of these per-message logs are the message ids, and
70256 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
70257 message log contains copies of the log lines that apply to the message. This
70258 makes it easier to inspect the status of an individual message without having
70259 to search the main log. A message log is deleted when processing of the message
70260 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
70261 only with great care because they can fill up your disk very quickly.
70262 </para>
70263 <para>
70264 On a heavily loaded system, it may be desirable to disable the use of
70265 per-message logs, in order to reduce disk I/O. This can be done by setting the
70266 <option>message_logs</option> option false.
70267 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
70268 </para>
70269 </section>
70270 </chapter>
70271
70272 <chapter id="CHAPutils">
70273 <title>Exim utilities</title>
70274 <para>
70275 <indexterm role="concept" id="IIDutils" class="startofrange">
70276 <primary>utilities</primary>
70277 </indexterm>
70278 A number of utility scripts and programs are supplied with Exim and are
70279 described in this chapter. There is also the Exim Monitor, which is covered in
70280 the next chapter. The utilities described here are:
70281 </para>
70282 <informaltable frame="none">
70283 <tgroup cols="3" colsep="0" rowsep="0">
70284 <colspec colwidth="7*" align="left"/>
70285 <colspec colwidth="15*" align="left"/>
70286 <colspec colwidth="40*" align="left"/>
70287 <tbody>
70288 <row>
70289 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
70290 <entry><emphasis>exiwhat</emphasis></entry>
70291 <entry>list what Exim processes are doing</entry>
70292 </row>
70293 <row>
70294 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
70295 <entry><emphasis>exiqgrep</emphasis></entry>
70296 <entry>grep the queue</entry>
70297 </row>
70298 <row>
70299 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
70300 <entry><emphasis>exiqsumm</emphasis></entry>
70301 <entry>summarize the queue</entry>
70302 </row>
70303 <row>
70304 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
70305 <entry><emphasis>exigrep</emphasis></entry>
70306 <entry>search the main log</entry>
70307 </row>
70308 <row>
70309 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
70310 <entry><emphasis>exipick</emphasis></entry>
70311 <entry>select messages on various criteria</entry>
70312 </row>
70313 <row>
70314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
70315 <entry><emphasis>exicyclog</emphasis></entry>
70316 <entry>cycle (rotate) log files</entry>
70317 </row>
70318 <row>
70319 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
70320 <entry><emphasis>eximstats</emphasis></entry>
70321 <entry>extract statistics from the log</entry>
70322 </row>
70323 <row>
70324 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
70325 <entry><emphasis>exim_checkaccess</emphasis></entry>
70326 <entry>check address acceptance from given IP</entry>
70327 </row>
70328 <row>
70329 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
70330 <entry><emphasis>exim_dbmbuild</emphasis></entry>
70331 <entry>build a DBM file</entry>
70332 </row>
70333 <row>
70334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
70335 <entry><emphasis>exinext</emphasis></entry>
70336 <entry>extract retry information</entry>
70337 </row>
70338 <row>
70339 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
70340 <entry><emphasis>exim_dumpdb</emphasis></entry>
70341 <entry>dump a hints database</entry>
70342 </row>
70343 <row>
70344 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
70345 <entry><emphasis>exim_tidydb</emphasis></entry>
70346 <entry>clean up a hints database</entry>
70347 </row>
70348 <row>
70349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
70350 <entry><emphasis>exim_fixdb</emphasis></entry>
70351 <entry>patch a hints database</entry>
70352 </row>
70353 <row>
70354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
70355 <entry><emphasis>exim_lock</emphasis></entry>
70356 <entry>lock a mailbox file</entry>
70357 </row>
70358 </tbody>
70359 </tgroup>
70360 </informaltable>
70361 <para>
70362 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
70363 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
70364 <emphasis role="bold"><ulink url="https://duncanthrax.net/exilog/">https://duncanthrax.net/exilog/</ulink></emphasis> for details.
70365 </para>
70366 <section id="SECTfinoutwha">
70367 <title>Finding out what Exim processes are doing (exiwhat)</title>
70368 <para>
70369 <indexterm role="concept">
70370 <primary><emphasis>exiwhat</emphasis></primary>
70371 </indexterm>
70372 <indexterm role="concept">
70373 <primary>process, querying</primary>
70374 </indexterm>
70375 <indexterm role="concept">
70376 <primary>SIGUSR1</primary>
70377 </indexterm>
70378 On operating systems that can restart a system call after receiving a signal
70379 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
70380 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
70381 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
70382 processes it can find, having first emptied the file. It then waits for one
70383 second to allow the Exim processes to react before displaying the results. In
70384 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
70385 send the signal to the Exim processes, so it is normally run as root.
70386 </para>
70387 <para>
70388 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
70389 use by system administrators. It is not sensible, for example, to set up a
70390 script that sends SIGUSR1 signals to Exim processes at short intervals.
70391 </para>
70392 <para>
70393 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
70394 varies in different operating systems. Not only are different options used,
70395 but the format of the output is different. For this reason, there are some
70396 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
70397 it doesn&#x2019;t seem to be working for you, check the following compile-time
70398 options:
70399 </para>
70400 <literallayout>
70401 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
70402 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
70403 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
70404 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
70405 </literallayout>
70406 <para>
70407 An example of typical output from <emphasis>exiwhat</emphasis> is
70408 </para>
70409 <literallayout class="monospaced">
70410 164 daemon: -q1h, listening on port 25
70411 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
70412 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
70413   [10.19.42.42] (editor@ref.example)
70414 10592 handling incoming call from [192.168.243.242]
70415 10628 accepting a local non-SMTP message
70416 </literallayout>
70417 <para>
70418 The first number in the output line is the process number. The third line has
70419 been split here, in order to fit it on the page.
70420 </para>
70421 </section>
70422 <section id="SECTgreptheque">
70423 <title>Selective queue listing (exiqgrep)</title>
70424 <para>
70425 <indexterm role="concept">
70426 <primary><emphasis>exiqgrep</emphasis></primary>
70427 </indexterm>
70428 <indexterm role="concept">
70429 <primary>queue</primary>
70430 <secondary>grepping</secondary>
70431 </indexterm>
70432 This utility is a Perl script contributed by Matt Hubbard. It runs
70433 </para>
70434 <literallayout class="monospaced">
70435 exim -bpu
70436 </literallayout>
70437 <para>
70438 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
70439 </para>
70440 <literallayout class="monospaced">
70441 exim -bp
70442 </literallayout>
70443 <para>
70444 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
70445 contain alternate exim configuration the queue management might be using.
70446 </para>
70447 <para>
70448 to obtain a queue listing, and then greps the output to select messages
70449 that match given criteria. The following selection options are available:
70450 </para>
70451 <variablelist>
70452 <varlistentry>
70453 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70454 <listitem>
70455 <para>
70456 Match the sender address using a case-insensitive search. The field that is
70457 tested is enclosed in angle brackets, so you can test for bounce messages with
70458 </para>
70459 <literallayout class="monospaced">
70460 exiqgrep -f '^&lt;&gt;$'
70461 </literallayout>
70462 </listitem></varlistentry>
70463 <varlistentry>
70464 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70465 <listitem>
70466 <para>
70467 Match a recipient address using a case-insensitive search. The field that is
70468 tested is not enclosed in angle brackets.
70469 </para>
70470 </listitem></varlistentry>
70471 <varlistentry>
70472 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70473 <listitem>
70474 <para>
70475 Match against the size field.
70476 </para>
70477 </listitem></varlistentry>
70478 <varlistentry>
70479 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
70480 <listitem>
70481 <para>
70482 Match messages that are younger than the given time.
70483 </para>
70484 </listitem></varlistentry>
70485 <varlistentry>
70486 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
70487 <listitem>
70488 <para>
70489 Match messages that are older than the given time.
70490 </para>
70491 </listitem></varlistentry>
70492 <varlistentry>
70493 <term><emphasis role="bold">-z</emphasis></term>
70494 <listitem>
70495 <para>
70496 Match only frozen messages.
70497 </para>
70498 </listitem></varlistentry>
70499 <varlistentry>
70500 <term><emphasis role="bold">-x</emphasis></term>
70501 <listitem>
70502 <para>
70503 Match only non-frozen messages.
70504 </para>
70505 </listitem></varlistentry>
70506 <varlistentry>
70507 <term><emphasis role="bold">-G</emphasis>&nbsp;&lt;<emphasis>queuename</emphasis>&gt;</term>
70508 <listitem>
70509 <para>
70510 Match only messages in the given queue.  Without this, the default queue is searched.
70511 </para>
70512 </listitem></varlistentry>
70513 </variablelist>
70514 <para>
70515 The following options control the format of the output:
70516 </para>
70517 <variablelist>
70518 <varlistentry>
70519 <term><emphasis role="bold">-c</emphasis></term>
70520 <listitem>
70521 <para>
70522 Display only the count of matching messages.
70523 </para>
70524 </listitem></varlistentry>
70525 <varlistentry>
70526 <term><emphasis role="bold">-l</emphasis></term>
70527 <listitem>
70528 <para>
70529 Long format &ndash; display the full message information as output by Exim. This is
70530 the default.
70531 </para>
70532 </listitem></varlistentry>
70533 <varlistentry>
70534 <term><emphasis role="bold">-i</emphasis></term>
70535 <listitem>
70536 <para>
70537 Display message ids only.
70538 </para>
70539 </listitem></varlistentry>
70540 <varlistentry>
70541 <term><emphasis role="bold">-b</emphasis></term>
70542 <listitem>
70543 <para>
70544 Brief format &ndash; one line per message.
70545 </para>
70546 </listitem></varlistentry>
70547 <varlistentry>
70548 <term><emphasis role="bold">-R</emphasis></term>
70549 <listitem>
70550 <para>
70551 Display messages in reverse order.
70552 </para>
70553 </listitem></varlistentry>
70554 <varlistentry>
70555 <term><emphasis role="bold">-a</emphasis></term>
70556 <listitem>
70557 <para>
70558 Include delivered recipients in queue listing.
70559 </para>
70560 </listitem></varlistentry>
70561 </variablelist>
70562 <para>
70563 There is one more option, <option>-h</option>, which outputs a list of options.
70564 </para>
70565 </section>
70566 <section id="SECTsumtheque">
70567 <title>Summarizing the queue (exiqsumm)</title>
70568 <para>
70569 <indexterm role="concept">
70570 <primary><emphasis>exiqsumm</emphasis></primary>
70571 </indexterm>
70572 <indexterm role="concept">
70573 <primary>queue</primary>
70574 <secondary>summary</secondary>
70575 </indexterm>
70576 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
70577 -bp</literal> and produces a summary of the messages in the queue. Thus, you use it by
70578 running a command such as
70579 </para>
70580 <literallayout class="monospaced">
70581 exim -bp | exiqsumm
70582 </literallayout>
70583 <para>
70584 The output consists of one line for each domain that has messages waiting for
70585 it, as in the following example:
70586 </para>
70587 <literallayout class="monospaced">
70588 3   2322   74m   66m  msn.com.example
70589 </literallayout>
70590 <para>
70591 Each line lists the number of pending deliveries for a domain, their total
70592 volume, and the length of time that the oldest and the newest messages have
70593 been waiting. Note that the number of pending deliveries is greater than the
70594 number of messages when messages have more than one recipient.
70595 </para>
70596 <para>
70597 A summary line is output at the end. By default the output is sorted on the
70598 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
70599 the output to be sorted by oldest message and by count of messages,
70600 respectively. There are also three options that split the messages for each
70601 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
70602 separates frozen messages, and <option>-s</option> separates messages according to their
70603 sender.
70604 </para>
70605 <para>
70606 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
70607 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
70608 generated by aliasing or forwarding are included (unless the <option>one_time</option>
70609 option of the <command>redirect</command> router has been used to convert them into <quote>top
70610 level</quote> addresses).
70611 </para>
70612 </section>
70613 <section id="SECTextspeinf">
70614 <title>Extracting specific information from the log (exigrep)</title>
70615 <para>
70616 <indexterm role="concept">
70617 <primary><emphasis>exigrep</emphasis></primary>
70618 </indexterm>
70619 <indexterm role="concept">
70620 <primary>log</primary>
70621 <secondary>extracts; grepping for</secondary>
70622 </indexterm>
70623 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
70624 files for entries that match a given pattern. When it finds a match, it
70625 extracts all the log entries for the relevant message, not just those that
70626 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
70627 given message, or all mail for a given user, or for a given host, for example.
70628 The input files can be in Exim log format or syslog format.
70629 If a matching log line is not associated with a specific message, it is
70630 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
70631 </para>
70632 <literallayout>
70633 <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>
70634 </literallayout>
70635 <para>
70636 If no log filenames are given on the command line, the standard input is read.
70637 </para>
70638 <para>
70639 The <option>-t</option> argument specifies a number of seconds. It adds an additional
70640 condition for message selection. Messages that are complete are shown only if
70641 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds in the queue.
70642 </para>
70643 <para>
70644 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
70645 makes it case-sensitive. This may give a performance improvement when searching
70646 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
70647 option; with <option>-I</option> they do not. In both cases it is possible to change the
70648 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
70649 </para>
70650 <para>
70651 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
70652 pattern as standing for themselves. Otherwise the pattern must be a Perl
70653 regular expression.
70654 </para>
70655 <para>
70656 The <option>-v</option> option inverts the matching condition. That is, a line is selected
70657 if it does <emphasis>not</emphasis> match the pattern.
70658 </para>
70659 <para>
70660 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
70661 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
70662 normally.
70663 </para>
70664 <para>
70665 Example of <option>-M</option>:
70666 user_a sends a message to user_b, which generates a bounce back to user_b. If
70667 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
70668 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
70669 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
70670 when searching for <quote>user_a</quote> will show both messages since the bounce is
70671 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
70672 search term.
70673 </para>
70674 <para>
70675 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
70676 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
70677 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
70678 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
70679 autodetection of some well known compression extensions.
70680 </para>
70681 </section>
70682 <section id="SECTexipick">
70683 <title>Selecting messages by various criteria (exipick)</title>
70684 <para>
70685 <indexterm role="concept">
70686 <primary><emphasis>exipick</emphasis></primary>
70687 </indexterm>
70688 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
70689 lists messages from the queue according to a variety of criteria. For details
70690 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
70691 the <option>--help</option> option.
70692 </para>
70693 </section>
70694 <section id="SECTcyclogfil">
70695 <title>Cycling log files (exicyclog)</title>
70696 <para>
70697 <indexterm role="concept">
70698 <primary>log</primary>
70699 <secondary>cycling local files</secondary>
70700 </indexterm>
70701 <indexterm role="concept">
70702 <primary>cycling logs</primary>
70703 </indexterm>
70704 <indexterm role="concept">
70705 <primary><emphasis>exicyclog</emphasis></primary>
70706 </indexterm>
70707 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
70708 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
70709 you are using log files with datestamps in their names (see section
70710 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
70711 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
70712 There are two command line options for <emphasis>exicyclog</emphasis>:
70713 </para>
70714 <itemizedlist>
70715 <listitem>
70716 <para>
70717 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
70718 default that is set when Exim is built. The default default is 10.
70719 </para>
70720 </listitem>
70721 <listitem>
70722 <para>
70723 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
70724 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
70725 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
70726 configuration.
70727 </para>
70728 </listitem>
70729 </itemizedlist>
70730 <para>
70731 Each time <emphasis>exicyclog</emphasis> is run the filenames get <quote>shuffled down</quote> by one. If
70732 the main log filename is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
70733 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
70734 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
70735 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
70736 logs are handled similarly.
70737 </para>
70738 <para>
70739 If the limit is greater than 99, the script uses 3-digit numbers such as
70740 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
70741 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
70742 any existing log files.
70743 </para>
70744 <para>
70745 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
70746 the end are deleted. All files with numbers greater than 01 are compressed,
70747 using a compression command which is configured by the COMPRESS_COMMAND
70748 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
70749 root <option>crontab</option> entry of the form
70750 </para>
70751 <literallayout class="monospaced">
70752 1 0 * * * su exim -c /usr/exim/bin/exicyclog
70753 </literallayout>
70754 <para>
70755 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
70756 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
70757 </para>
70758 </section>
70759 <section id="SECTmailstat">
70760 <title>Mail statistics (eximstats)</title>
70761 <para>
70762 <indexterm role="concept">
70763 <primary>statistics</primary>
70764 </indexterm>
70765 <indexterm role="concept">
70766 <primary><emphasis>eximstats</emphasis></primary>
70767 </indexterm>
70768 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
70769 information from log files. The output is either plain text, or HTML.
70770 </para>
70771 <para>
70772 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
70773 latest version is the result of some extensive revision by Steve Campbell. A
70774 lot of information is given by default, but there are options for suppressing
70775 various parts of it. Following any options, the arguments to the script are a
70776 list of files, which should be main log files. For example:
70777 </para>
70778 <literallayout class="monospaced">
70779 eximstats -nr /var/spool/exim/log/mainlog.01
70780 </literallayout>
70781 <para>
70782 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
70783 messages received from or delivered to various hosts. The information is sorted
70784 both by message count and by volume, and the top fifty hosts in each category
70785 are listed on the standard output. Similar information, based on email
70786 addresses or domains instead of hosts can be requested by means of various
70787 options. For messages delivered and received locally, similar statistics are
70788 also produced per user.
70789 </para>
70790 <para>
70791 The output also includes total counts and statistics about delivery errors, and
70792 histograms showing the number of messages received and deliveries made in each
70793 hour of the day. A delivery with more than one address in its envelope (for
70794 example, an SMTP transaction with more than one RCPT command) is counted
70795 as a single delivery by <emphasis>eximstats</emphasis>.
70796 </para>
70797 <para>
70798 Though normally more deliveries than receipts are reported (as messages may
70799 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
70800 messages received than delivered, even though the queue is empty at the start
70801 and end of the period in question. If an incoming message contains no valid
70802 recipients, no deliveries are recorded for it. A bounce message is handled as
70803 an entirely separate message.
70804 </para>
70805 <para>
70806 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
70807 of messages received and deliveries made, and the number of hosts involved in
70808 each case. It also outputs the number of messages that were delayed (that is,
70809 not completely delivered at the first attempt), and the number that had at
70810 least one address that failed.
70811 </para>
70812 <para>
70813 The remainder of the output is in sections that can be independently disabled
70814 or modified by various options. It consists of a summary of deliveries by
70815 transport, histograms of messages received and delivered per time interval
70816 (default per hour), information about the time messages spent in the queue,
70817 a list of relayed messages, lists of the top fifty sending hosts, local
70818 senders, destination hosts, and destination local users by count and by volume,
70819 and a list of delivery errors that occurred.
70820 </para>
70821 <para>
70822 The relay information lists messages that were actually relayed, that is, they
70823 came from a remote host and were directly delivered to some other remote host,
70824 without being processed (for example, for aliasing or forwarding) locally.
70825 </para>
70826 <para>
70827 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
70828 outputs. These are documented in the Perl script itself, and can be extracted
70829 by running the command <command>perldoc</command> on the script. For example:
70830 </para>
70831 <literallayout class="monospaced">
70832 perldoc /usr/exim/bin/eximstats
70833 </literallayout>
70834 </section>
70835 <section id="SECTcheckaccess">
70836 <title>Checking access policy (exim_checkaccess)</title>
70837 <para>
70838 <indexterm role="concept">
70839 <primary><emphasis>exim_checkaccess</emphasis></primary>
70840 </indexterm>
70841 <indexterm role="concept">
70842 <primary>policy control</primary>
70843 <secondary>checking access</secondary>
70844 </indexterm>
70845 <indexterm role="concept">
70846 <primary>checking access</primary>
70847 </indexterm>
70848 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
70849 debugging output, in order to check what Exim is doing when it is applying
70850 policy controls to incoming SMTP mail. However, not everybody is sufficiently
70851 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
70852 sometimes you just want to answer the question <quote>Does this address have
70853 access?</quote> without bothering with any further details.
70854 </para>
70855 <para>
70856 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
70857 two arguments, an IP address and an email address:
70858 </para>
70859 <literallayout class="monospaced">
70860 exim_checkaccess 10.9.8.7 A.User@a.domain.example
70861 </literallayout>
70862 <para>
70863 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
70864 given email address would be accepted in a RCPT command in a TCP/IP
70865 connection from the host with the given IP address. The output of the utility
70866 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
70867 </para>
70868 <literallayout class="monospaced">
70869 Rejected:
70870 550 Relay not permitted
70871 </literallayout>
70872 <para>
70873 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
70874 for the MAIL command, but you can change this by providing additional
70875 options. These are passed directly to the Exim command. For example, to specify
70876 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
70877 you can use:
70878 </para>
70879 <literallayout class="monospaced">
70880 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
70881                  -f himself@there.example
70882 </literallayout>
70883 <para>
70884 Note that these additional Exim command line items must be given after the two
70885 mandatory arguments.
70886 </para>
70887 <para>
70888 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
70889 while running its checks. You can run checks that include callouts by using
70890 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
70891 </para>
70892 </section>
70893 <section id="SECTdbmbuild">
70894 <title>Making DBM files (exim_dbmbuild)</title>
70895 <para>
70896 <indexterm role="concept">
70897 <primary>DBM</primary>
70898 <secondary>building dbm files</secondary>
70899 </indexterm>
70900 <indexterm role="concept">
70901 <primary>building DBM files</primary>
70902 </indexterm>
70903 <indexterm role="concept">
70904 <primary><emphasis>exim_dbmbuild</emphasis></primary>
70905 </indexterm>
70906 <indexterm role="concept">
70907 <primary>lower casing</primary>
70908 </indexterm>
70909 <indexterm role="concept">
70910 <primary>binary zero</primary>
70911 <secondary>in lookup key</secondary>
70912 </indexterm>
70913 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
70914 the format used by the <command>lsearch</command> lookup (see section
70915 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
70916 names as keys and the remainder of the information as data. The lower-casing
70917 can be prevented by calling the program with the <option>-nolc</option> option.
70918 </para>
70919 <para>
70920 A terminating zero is included as part of the key string. This is expected by
70921 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
70922 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
70923 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
70924 files.
70925 </para>
70926 <para>
70927 The program requires two arguments: the name of the input file (which can be a
70928 single hyphen to indicate the standard input), and the name of the output file.
70929 It creates the output under a temporary name, and then renames it if all went
70930 well.
70931 </para>
70932 <para>
70933 <indexterm role="concept">
70934 <primary>USE_DB</primary>
70935 </indexterm>
70936 If the native DB interface is in use (USE_DB is set in a compile-time
70937 configuration file &ndash; this is common in free versions of Unix) the two
70938 filenames must be different, because in this mode the Berkeley DB functions
70939 create a single output file using exactly the name given. For example,
70940 </para>
70941 <literallayout class="monospaced">
70942 exim_dbmbuild /etc/aliases /etc/aliases.db
70943 </literallayout>
70944 <para>
70945 reads the system alias file and creates a DBM version of it in
70946 <filename>/etc/aliases.db</filename>.
70947 </para>
70948 <para>
70949 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
70950 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
70951 environment, the suffixes are added to the second argument of
70952 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
70953 when the Berkeley functions are used in compatibility mode (though this is not
70954 recommended), because in that case it adds a <filename>.db</filename> suffix to the filename.
70955 </para>
70956 <para>
70957 If a duplicate key is encountered, the program outputs a warning, and when it
70958 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
70959 option is used. By default, only the first of a set of duplicates is used &ndash;
70960 this makes it compatible with <command>lsearch</command> lookups. There is an option
70961 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
70962 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
70963 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
70964 return code is 2.
70965 </para>
70966 </section>
70967 <section id="SECTfinindret">
70968 <title>Finding individual retry times (exinext)</title>
70969 <para>
70970 <indexterm role="concept">
70971 <primary>retry</primary>
70972 <secondary>times</secondary>
70973 </indexterm>
70974 <indexterm role="concept">
70975 <primary><emphasis>exinext</emphasis></primary>
70976 </indexterm>
70977 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
70978 fish specific information out of the retry database. Given a mail domain (or a
70979 complete address), it looks up the hosts for that domain, and outputs any retry
70980 information for the hosts or for the domain. At present, the retry information
70981 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
70982 output. For example:
70983 </para>
70984 <literallayout class="monospaced">
70985 $ exinext piglet@milne.fict.example
70986 kanga.milne.example:192.168.8.1 error 146: Connection refused
70987   first failed: 21-Feb-1996 14:57:34
70988   last tried:   21-Feb-1996 14:57:34
70989   next try at:  21-Feb-1996 15:02:34
70990 roo.milne.example:192.168.8.3 error 146: Connection refused
70991   first failed: 20-Jan-1996 13:12:08
70992   last tried:   21-Feb-1996 11:42:03
70993   next try at:  21-Feb-1996 19:42:03
70994   past final cutoff time
70995 </literallayout>
70996 <para>
70997 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
70998 will give any retry information for that local part in your default domain.
70999 A message id can be used to obtain retry information pertaining to a specific
71000 message. This exists only when an attempt to deliver a message to a remote host
71001 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
71002 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
71003 run very often.
71004 </para>
71005 <para>
71006 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
71007 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
71008 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
71009 configuration file, and the second sets macros for use within the configuration
71010 file. These features are mainly to help in testing, but might also be useful in
71011 environments where more than one configuration file is in use.
71012 </para>
71013 </section>
71014 <section id="SECThindatmai">
71015 <title>Hints database maintenance</title>
71016 <para>
71017 <indexterm role="concept">
71018 <primary>hints database</primary>
71019 <secondary>maintenance</secondary>
71020 </indexterm>
71021 <indexterm role="concept">
71022 <primary>maintaining Exim&#x2019;s hints database</primary>
71023 </indexterm>
71024 Three utility programs are provided for maintaining the DBM files that Exim
71025 uses to contain its delivery hint information. Each program requires two
71026 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
71027 second is the name of the database it is to operate on. These are as follows:
71028 </para>
71029 <itemizedlist>
71030 <listitem>
71031 <para>
71032 <emphasis>retry</emphasis>: the database of retry information
71033 </para>
71034 </listitem>
71035 <listitem>
71036 <para>
71037 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
71038 for remote hosts
71039 </para>
71040 </listitem>
71041 <listitem>
71042 <para>
71043 <emphasis>callout</emphasis>: the callout cache
71044 </para>
71045 </listitem>
71046 <listitem>
71047 <para>
71048 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
71049 </para>
71050 </listitem>
71051 <listitem>
71052 <para>
71053 <emphasis>misc</emphasis>: other hints data
71054 </para>
71055 </listitem>
71056 </itemizedlist>
71057 <para>
71058 The <emphasis>misc</emphasis> database is used for
71059 </para>
71060 <itemizedlist>
71061 <listitem>
71062 <para>
71063 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
71064 </para>
71065 </listitem>
71066 <listitem>
71067 <para>
71068 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
71069 <command>smtp</command> transport)
71070 </para>
71071 </listitem>
71072 <listitem>
71073 <para>
71074 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
71075 in a transport)
71076 </para>
71077 </listitem>
71078 </itemizedlist>
71079 </section>
71080 <section id="SECID261">
71081 <title>exim_dumpdb</title>
71082 <para>
71083 <indexterm role="concept">
71084 <primary><emphasis>exim_dumpdb</emphasis></primary>
71085 </indexterm>
71086 The entire contents of a database are written to the standard output by the
71087 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
71088 spool and database names. For example, to dump the retry database:
71089 </para>
71090 <literallayout class="monospaced">
71091 exim_dumpdb /var/spool/exim retry
71092 </literallayout>
71093 <para>
71094 Two lines of output are produced for each entry:
71095 </para>
71096 <literallayout class="monospaced">
71097 T:mail.ref.example:192.168.242.242 146 77 Connection refused
71098 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
71099 </literallayout>
71100 <para>
71101 The first item on the first line is the key of the record. It starts with one
71102 of the letters R, or T, depending on whether it refers to a routing or
71103 transport retry. For a local delivery, the next part is the local address; for
71104 a remote delivery it is the name of the remote host, followed by its failing IP
71105 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
71106 transport). If the remote port is not the standard one (port 25), it is added
71107 to the IP address. Then there follows an error code, an additional error code,
71108 and a textual description of the error.
71109 </para>
71110 <para>
71111 The three times on the second line are the time of first failure, the time of
71112 the last delivery attempt, and the computed time for the next attempt. The line
71113 ends with an asterisk if the cutoff time for the last retry rule has been
71114 exceeded.
71115 </para>
71116 <para>
71117 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
71118 consists of a host name followed by a list of ids for messages that are or were
71119 waiting to be delivered to that host. If there are a very large number for any
71120 one host, continuation records, with a sequence number added to the host name,
71121 may be seen. The data in these records is often out of date, because a message
71122 may be routed to several alternative hosts, and Exim makes no effort to keep
71123 cross-references.
71124 </para>
71125 </section>
71126 <section id="SECID262">
71127 <title>exim_tidydb</title>
71128 <para>
71129 <indexterm role="concept">
71130 <primary><emphasis>exim_tidydb</emphasis></primary>
71131 </indexterm>
71132 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
71133 database. If run with no options, it removes all records that are more than 30
71134 days old. The age is calculated from the date and time that the record was last
71135 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
71136 since the first delivery failure. Information about a host that has been down
71137 for more than 30 days will remain in the database, provided that the record is
71138 updated sufficiently often.
71139 </para>
71140 <para>
71141 The cutoff date can be altered by means of the <option>-t</option> option, which must be
71142 followed by a time. For example, to remove all records older than a week from
71143 the retry database:
71144 </para>
71145 <literallayout class="monospaced">
71146 exim_tidydb -t 7d /var/spool/exim retry
71147 </literallayout>
71148 <para>
71149 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
71150 message ids. In the former these appear as data in records keyed by host &ndash;
71151 they were messages that were waiting for that host &ndash; and in the latter they
71152 are the keys for retry information for messages that have suffered certain
71153 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
71154 message ids in database records are those of messages that are still on the
71155 queue. Message ids for messages that no longer exist are removed from
71156 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
71157 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
71158 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
71159 whenever it removes information from the database.
71160 </para>
71161 <para>
71162 Certain records are automatically removed by Exim when they are no longer
71163 needed, but others are not. For example, if all the MX hosts for a domain are
71164 down, a retry record is created for each one. If the primary MX host comes back
71165 first, its record is removed when Exim successfully delivers to it, but the
71166 records for the others remain because Exim has not tried to use those hosts.
71167 </para>
71168 <para>
71169 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
71170 hints databases. You should do this at a quiet time of day, because it requires
71171 a database to be locked (and therefore inaccessible to Exim) while it does its
71172 work. Removing records from a DBM file does not normally make the file smaller,
71173 but all the common DBM libraries are able to re-use the space that is released.
71174 After an initial phase of increasing in size, the databases normally reach a
71175 point at which they no longer get any bigger, as long as they are regularly
71176 tidied.
71177 </para>
71178 <para>
71179 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
71180 databases is likely to keep on increasing.
71181 </para>
71182 </section>
71183 <section id="SECID263">
71184 <title>exim_fixdb</title>
71185 <para>
71186 <indexterm role="concept">
71187 <primary><emphasis>exim_fixdb</emphasis></primary>
71188 </indexterm>
71189 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
71190 Its main use is for testing Exim, but it might also be occasionally useful for
71191 getting round problems in a live system. It has no options, and its interface
71192 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
71193 key of a database record can then be entered, and the data for that record is
71194 displayed.
71195 </para>
71196 <para>
71197 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
71198 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
71199 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
71200 data for individual fields can be changed by typing the field number followed
71201 by new data, for example:
71202 </para>
71203 <literallayout class="monospaced">
71204 &gt; 4 951102:1000
71205 </literallayout>
71206 <para>
71207 resets the time of the next delivery attempt. Time values are given as a
71208 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
71209 used as optional separators.
71210 </para>
71211 </section>
71212 <section id="SECTmailboxmaint">
71213 <title>Mailbox maintenance (exim_lock)</title>
71214 <para>
71215 <indexterm role="concept">
71216 <primary>mailbox</primary>
71217 <secondary>maintenance</secondary>
71218 </indexterm>
71219 <indexterm role="concept">
71220 <primary><emphasis>exim_lock</emphasis></primary>
71221 </indexterm>
71222 <indexterm role="concept">
71223 <primary>locking mailboxes</primary>
71224 </indexterm>
71225 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
71226 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
71227 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
71228 a user agent while investigating a problem. The utility requires the name of
71229 the file as its first argument. If the locking is successful, the second
71230 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
71231 second argument, the value of the SHELL environment variable is used; if this
71232 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
71233 is unlocked and the utility ends. The following options are available:
71234 </para>
71235 <variablelist>
71236 <varlistentry>
71237 <term><option>-fcntl</option></term>
71238 <listitem>
71239 <para>
71240 Use <function>fcntl()</function> locking on the open mailbox.
71241 </para>
71242 </listitem></varlistentry>
71243 <varlistentry>
71244 <term><option>-flock</option></term>
71245 <listitem>
71246 <para>
71247 Use <function>flock()</function> locking on the open mailbox, provided the operating system
71248 supports it.
71249 </para>
71250 </listitem></varlistentry>
71251 <varlistentry>
71252 <term><option>-interval</option></term>
71253 <listitem>
71254 <para>
71255 This must be followed by a number, which is a number of seconds; it sets the
71256 interval to sleep between retries (default 3).
71257 </para>
71258 </listitem></varlistentry>
71259 <varlistentry>
71260 <term><option>-lockfile</option></term>
71261 <listitem>
71262 <para>
71263 Create a lock file before opening the mailbox.
71264 </para>
71265 </listitem></varlistentry>
71266 <varlistentry>
71267 <term><option>-mbx</option></term>
71268 <listitem>
71269 <para>
71270 Lock the mailbox using MBX rules.
71271 </para>
71272 </listitem></varlistentry>
71273 <varlistentry>
71274 <term><option>-q</option></term>
71275 <listitem>
71276 <para>
71277 Suppress verification output.
71278 </para>
71279 </listitem></varlistentry>
71280 <varlistentry>
71281 <term><option>-retries</option></term>
71282 <listitem>
71283 <para>
71284 This must be followed by a number; it sets the number of times to try to get
71285 the lock (default 10).
71286 </para>
71287 </listitem></varlistentry>
71288 <varlistentry>
71289 <term><option>-restore_time</option></term>
71290 <listitem>
71291 <para>
71292 This option causes <option>exim_lock</option> to restore the modified and read times to the
71293 locked file before exiting. This allows you to access a locked mailbox (for
71294 example, to take a backup copy) without disturbing the times that the user
71295 subsequently sees.
71296 </para>
71297 </listitem></varlistentry>
71298 <varlistentry>
71299 <term><option>-timeout</option></term>
71300 <listitem>
71301 <para>
71302 This must be followed by a number, which is a number of seconds; it sets a
71303 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
71304 default), a non-blocking call is used.
71305 </para>
71306 </listitem></varlistentry>
71307 <varlistentry>
71308 <term><option>-v</option></term>
71309 <listitem>
71310 <para>
71311 Generate verbose output.
71312 </para>
71313 </listitem></varlistentry>
71314 </variablelist>
71315 <para>
71316 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
71317 default is to create a lock file and also to use <function>fcntl()</function> locking on the
71318 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
71319 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
71320 requires that the directory containing the file be writeable. Locking by lock
71321 file does not last forever; Exim assumes that a lock file is expired if it is
71322 more than 30 minutes old.
71323 </para>
71324 <para>
71325 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
71326 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
71327 to be taken out on the open mailbox, and an exclusive lock on the file
71328 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
71329 number of the mailbox file. When the locking is released, if an exclusive lock
71330 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
71331 </para>
71332 <para>
71333 The default output contains verification of the locking that takes place. The
71334 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
71335 suppresses all output except error messages.
71336 </para>
71337 <para>
71338 A command such as
71339 </para>
71340 <literallayout class="monospaced">
71341 exim_lock /var/spool/mail/spqr
71342 </literallayout>
71343 <para>
71344 runs an interactive shell while the file is locked, whereas
71345 </para>
71346 <literallayout>
71347 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
71348 &lt;<emphasis>some commands</emphasis>&gt;
71349 <literal>End</literal>
71350 </literallayout>
71351 <para>
71352 runs a specific non-interactive sequence of commands while the file is locked,
71353 suppressing all verification output. A single command can be run by a command
71354 such as
71355 </para>
71356 <literallayout class="monospaced">
71357 exim_lock -q /var/spool/mail/spqr \
71358   "cp /var/spool/mail/spqr /some/where"
71359 </literallayout>
71360 <para>
71361 Note that if a command is supplied, it must be entirely contained within the
71362 second argument &ndash; hence the quotes.
71363 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
71364 </para>
71365 </section>
71366 </chapter>
71367
71368 <chapter id="CHAPeximon">
71369 <title>The Exim monitor</title>
71370 <para>
71371 <indexterm role="concept" id="IIDeximon" class="startofrange">
71372 <primary>Exim monitor</primary>
71373 <secondary>description</secondary>
71374 </indexterm>
71375 <indexterm role="concept">
71376 <primary>X-windows</primary>
71377 </indexterm>
71378 <indexterm role="concept">
71379 <primary><emphasis>eximon</emphasis></primary>
71380 </indexterm>
71381 <indexterm role="concept">
71382 <primary>Local/eximon.conf</primary>
71383 </indexterm>
71384 <indexterm role="concept">
71385 <primary><filename>exim_monitor/EDITME</filename></primary>
71386 </indexterm>
71387 The Exim monitor is an application which displays in an X window information
71388 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
71389 perform certain operations on messages from this GUI interface; however all
71390 such facilities are also available from the command line, and indeed, the
71391 monitor itself makes use of the command line to perform any actions requested.
71392 </para>
71393 <section id="SECID264">
71394 <title>Running the monitor</title>
71395 <para>
71396 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
71397 script that sets up a number of environment variables, and then runs the
71398 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
71399 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
71400 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
71401 parameters are for.
71402 </para>
71403 <para>
71404 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
71405 a particular invocation by setting up environment variables of the same names,
71406 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
71407 </para>
71408 <literallayout class="monospaced">
71409 EXIMON_LOG_DEPTH=400 eximon
71410 </literallayout>
71411 <para>
71412 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
71413 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
71414 overrides the Exim log file configuration. This makes it possible to have
71415 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
71416 syslog messages are routed to a file on the local host.
71417 </para>
71418 <para>
71419 X resources can be used to change the appearance of the window in the normal
71420 way. For example, a resource setting of the form
71421 </para>
71422 <literallayout class="monospaced">
71423 Eximon*background: gray94
71424 </literallayout>
71425 <para>
71426 changes the colour of the background to light grey rather than white. The
71427 stripcharts are drawn with both the data lines and the reference lines in
71428 black. This means that the reference lines are not visible when on top of the
71429 data. However, their colour can be changed by setting a resource called
71430 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
71431 For example, if your X server is running Unix, you could set up lighter
71432 reference lines in the stripcharts by obeying
71433 </para>
71434 <literallayout class="monospaced">
71435 xrdb -merge &lt;&lt;End
71436 Eximon*highlight: gray
71437 End
71438 </literallayout>
71439 <para>
71440 <indexterm role="concept">
71441 <primary>admin user</primary>
71442 </indexterm>
71443 In order to see the contents of messages in the queue, and to operate on them,
71444 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
71445 </para>
71446 <para>
71447 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
71448 contain X11 resource parameters interpreted by the X11 library.  In addition,
71449 if the first parameter starts with the string "gdb" then it is removed and the
71450 binary is invoked under gdb (the parameter is used as the gdb command-name, so
71451 versioned variants of gdb can be invoked).
71452 </para>
71453 <para>
71454 The monitor&#x2019;s window is divided into three parts. The first contains one or
71455 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
71456 main log file, and the third is a display of the queue of messages awaiting
71457 delivery, with two more action buttons. The following sections describe these
71458 different parts of the display.
71459 </para>
71460 </section>
71461 <section id="SECID265">
71462 <title>The stripcharts</title>
71463 <para>
71464 <indexterm role="concept">
71465 <primary>stripchart</primary>
71466 </indexterm>
71467 The first stripchart is always a count of messages in the queue. Its name can
71468 be configured by setting QUEUE_STRIPCHART_NAME in the
71469 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
71470 configuration script by regular expression matches on log file entries, making
71471 it possible to display, for example, counts of messages delivered to certain
71472 hosts or using certain transports. The supplied defaults display counts of
71473 received and delivered messages, and of local and SMTP deliveries. The default
71474 period between stripchart updates is one minute; this can be adjusted by a
71475 parameter in the <filename>Local/eximon.conf</filename> file.
71476 </para>
71477 <para>
71478 The stripchart displays rescale themselves automatically as the value they are
71479 displaying changes. There are always 10 horizontal lines in each chart; the
71480 title string indicates the value of each division when it is greater than one.
71481 For example, <quote>x2</quote> means that each division represents a value of 2.
71482 </para>
71483 <para>
71484 It is also possible to have a stripchart which shows the percentage fullness of
71485 a particular disk partition, which is useful when local deliveries are confined
71486 to a single partition.
71487 </para>
71488 <para>
71489 <indexterm role="concept">
71490 <primary><option>statvfs</option> function</primary>
71491 </indexterm>
71492 This relies on the availability of the <function>statvfs()</function> function or equivalent in
71493 the operating system. Most, but not all versions of Unix that support Exim have
71494 this. For this particular stripchart, the top of the chart always represents
71495 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
71496 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
71497 <filename>Local/eximon.conf</filename> file.
71498 </para>
71499 </section>
71500 <section id="SECID266">
71501 <title>Main action buttons</title>
71502 <para>
71503 <indexterm role="concept">
71504 <primary>size</primary>
71505 <secondary>of monitor window</secondary>
71506 </indexterm>
71507 <indexterm role="concept">
71508 <primary>Exim monitor</primary>
71509 <secondary>window size</secondary>
71510 </indexterm>
71511 <indexterm role="concept">
71512 <primary>window size</primary>
71513 </indexterm>
71514 Below the stripcharts there is an action button for quitting the monitor. Next
71515 to this is another button marked <quote>Size</quote>. They are placed here so that
71516 shrinking the window to its default minimum size leaves just the queue count
71517 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
71518 the window to expand to its maximum size, unless it is already at the maximum,
71519 in which case it is reduced to its minimum.
71520 </para>
71521 <para>
71522 When expanding to the maximum, if the window cannot be fully seen where it
71523 currently is, it is moved back to where it was the last time it was at full
71524 size. When it is expanding from its minimum size, the old position is
71525 remembered, and next time it is reduced to the minimum it is moved back there.
71526 </para>
71527 <para>
71528 The idea is that you can keep a reduced window just showing one or two
71529 stripcharts at a convenient place on your screen, easily expand it to show
71530 the full window when required, and just as easily put it back to what it was.
71531 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
71532 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
71533 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
71534 </para>
71535 <para>
71536 Normally, the monitor starts up with the window at its full size, but it can be
71537 built so that it starts up with the window at its smallest size, by setting
71538 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
71539 </para>
71540 </section>
71541 <section id="SECID267">
71542 <title>The log display</title>
71543 <para>
71544 <indexterm role="concept">
71545 <primary>log</primary>
71546 <secondary>tail of; in monitor</secondary>
71547 </indexterm>
71548 The second section of the window is an area in which a display of the tail of
71549 the main log is maintained.
71550 To save space on the screen, the timestamp on each log line is shortened by
71551 removing the date and, if <option>log_timezone</option> is set, the timezone.
71552 The log tail is not available when the only destination for logging data is
71553 syslog, unless the syslog lines are routed to a local file whose name is passed
71554 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
71555 </para>
71556 <para>
71557 The log sub-window has a scroll bar at its lefthand side which can be used to
71558 move back to look at earlier text, and the up and down arrow keys also have a
71559 scrolling effect. The amount of log that is kept depends on the setting of
71560 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
71561 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
71562 much more efficient than throwing it away line by line. The sub-window also has
71563 a horizontal scroll bar for accessing the ends of long log lines. This is the
71564 only means of horizontal scrolling; the right and left arrow keys are not
71565 available. Text can be cut from this part of the window using the mouse in the
71566 normal way. The size of this subwindow is controlled by parameters in the
71567 configuration file <filename>Local/eximon.conf</filename>.
71568 </para>
71569 <para>
71570 Searches of the text in the log window can be carried out by means of the ^R
71571 and ^S keystrokes, which default to a reverse and a forward search,
71572 respectively. The search covers only the text that is displayed in the window.
71573 It cannot go further back up the log.
71574 </para>
71575 <para>
71576 The point from which the search starts is indicated by a caret marker. This is
71577 normally at the end of the text in the window, but can be positioned explicitly
71578 by pointing and clicking with the left mouse button, and is moved automatically
71579 by a successful search. If new text arrives in the window when it is scrolled
71580 back, the caret remains where it is, but if the window is not scrolled back,
71581 the caret is moved to the end of the new text.
71582 </para>
71583 <para>
71584 Pressing ^R or ^S pops up a window into which the search text can be typed.
71585 There are buttons for selecting forward or reverse searching, for carrying out
71586 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
71587 happens and the window remains so that further searches can be done. If the
71588 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
71589 ^C is typed the search is cancelled.
71590 </para>
71591 <para>
71592 The searching facility is implemented using the facilities of the Athena text
71593 widget. By default this pops up a window containing both <quote>search</quote> and
71594 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
71595 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
71596 However, the linkers in BSDI and HP-UX seem unable to handle an externally
71597 provided version of <option>TextPop</option> when the remaining parts of the text widget
71598 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
71599 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
71600 on these systems, at the expense of having unwanted items in the search popup
71601 window.
71602 </para>
71603 </section>
71604 <section id="SECID268">
71605 <title>The queue display</title>
71606 <para>
71607 <indexterm role="concept">
71608 <primary>queue</primary>
71609 <secondary>display in monitor</secondary>
71610 </indexterm>
71611 The bottom section of the monitor window contains a list of all messages that
71612 are in the queue, which includes those currently being received or delivered,
71613 as well as those awaiting delivery. The size of this subwindow is controlled by
71614 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
71615 at which it is updated is controlled by another parameter in the same file &ndash;
71616 the default is 5 minutes, since queue scans can be quite expensive. However,
71617 there is an <quote>Update</quote> action button just above the display which can be used
71618 to force an update of the queue display at any time.
71619 </para>
71620 <para>
71621 When a host is down for some time, a lot of pending mail can build up for it,
71622 and this can make it hard to deal with other messages in the queue. To help
71623 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
71624 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
71625 type anything in here and press <quote>Return</quote>, the text is added to a chain of
71626 such texts, and if every undelivered address in a message matches at least one
71627 of the texts, the message is not displayed.
71628 </para>
71629 <para>
71630 If there is an address that does not match any of the texts, all the addresses
71631 are displayed as normal. The matching happens on the ends of addresses so, for
71632 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
71633 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
71634 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
71635 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
71636 a hide request is automatically cancelled after one hour.
71637 </para>
71638 <para>
71639 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
71640 else to the monitor window. For this reason, if you want to cut text from the
71641 queue display to use in the dialogue box, you have to do the cutting before
71642 pressing the <quote>Hide</quote> button.
71643 </para>
71644 <para>
71645 The queue display contains, for each unhidden queued message, the length of
71646 time it has been in the queue, the size of the message, the message id, the
71647 message sender, and the first undelivered recipient, all on one line. If it is
71648 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
71649 recipient to which the message has not yet been delivered, subsequent ones are
71650 listed on additional lines, up to a maximum configured number, following which
71651 an ellipsis is displayed. Recipients that have already received the message are
71652 not shown.
71653 </para>
71654 <para>
71655 <indexterm role="concept">
71656 <primary>frozen messages</primary>
71657 <secondary>display</secondary>
71658 </indexterm>
71659 If a message is frozen, an asterisk is displayed at the left-hand side.
71660 </para>
71661 <para>
71662 The queue display has a vertical scroll bar, and can also be scrolled by means
71663 of the arrow keys. Text can be cut from it using the mouse in the normal way.
71664 The text searching facilities, as described above for the log window, are also
71665 available, but the caret is always moved to the end of the text when the queue
71666 display is updated.
71667 </para>
71668 </section>
71669 <section id="SECID269">
71670 <title>The queue menu</title>
71671 <para>
71672 <indexterm role="concept">
71673 <primary>queue</primary>
71674 <secondary>menu in monitor</secondary>
71675 </indexterm>
71676 If the <option>shift</option> key is held down and the left button is clicked when the mouse
71677 pointer is over the text for any message, an action menu pops up, and the first
71678 line of the queue display for the message is highlighted. This does not affect
71679 any selected text.
71680 </para>
71681 <para>
71682 If you want to use some other event for popping up the menu, you can set the
71683 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
71684 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
71685 value set in this parameter is a standard X event description. For example, to
71686 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
71687 </para>
71688 <literallayout class="monospaced">
71689 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
71690 </literallayout>
71691 <para>
71692 The title of the menu is the message id, and it contains entries which act as
71693 follows:
71694 </para>
71695 <itemizedlist>
71696 <listitem>
71697 <para>
71698 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
71699 in a new text window.
71700 </para>
71701 </listitem>
71702 <listitem>
71703 <para>
71704 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
71705 information and headers is displayed in a new text window. See chapter
71706 <xref linkend="CHAPspool"/> for a description of the format of spool files.
71707 </para>
71708 </listitem>
71709 <listitem>
71710 <para>
71711 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
71712 displayed in a new text window. There is a default limit of 20,000 bytes to the
71713 amount of data displayed. This can be changed by setting the BODY_MAX
71714 option at compile time, or the EXIMON_BODY_MAX option at runtime.
71715 </para>
71716 </listitem>
71717 <listitem>
71718 <para>
71719 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
71720 delivery of the message. This causes an automatic thaw if the message is
71721 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
71722 a new text window. The delivery is run in a separate process, to avoid holding
71723 up the monitor while the delivery proceeds.
71724 </para>
71725 </listitem>
71726 <listitem>
71727 <para>
71728 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
71729 that the message be frozen.
71730 </para>
71731 </listitem>
71732 <listitem>
71733 <para>
71734 <indexterm role="concept">
71735 <primary>thawing messages</primary>
71736 </indexterm>
71737 <indexterm role="concept">
71738 <primary>unfreezing messages</primary>
71739 </indexterm>
71740 <indexterm role="concept">
71741 <primary>frozen messages</primary>
71742 <secondary>thawing</secondary>
71743 </indexterm>
71744 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
71745 that the message be thawed.
71746 </para>
71747 </listitem>
71748 <listitem>
71749 <para>
71750 <indexterm role="concept">
71751 <primary>delivery</primary>
71752 <secondary>forcing failure</secondary>
71753 </indexterm>
71754 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
71755 that Exim gives up trying to deliver the message. A bounce message is generated
71756 for any remaining undelivered addresses.
71757 </para>
71758 </listitem>
71759 <listitem>
71760 <para>
71761 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
71762 that the message be deleted from the system without generating a bounce
71763 message.
71764 </para>
71765 </listitem>
71766 <listitem>
71767 <para>
71768 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
71769 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
71770 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
71771 Otherwise it must be entered as a fully qualified address. Pressing RETURN
71772 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
71773 additional recipient be added to the message, unless the entry box is empty, in
71774 which case no action is taken.
71775 </para>
71776 </listitem>
71777 <listitem>
71778 <para>
71779 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
71780 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
71781 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
71782 Otherwise it must be entered as a fully qualified address. Pressing RETURN
71783 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
71784 recipient address as already delivered, unless the entry box is empty, in which
71785 case no action is taken.
71786 </para>
71787 </listitem>
71788 <listitem>
71789 <para>
71790 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
71791 mark all recipient addresses as already delivered.
71792 </para>
71793 </listitem>
71794 <listitem>
71795 <para>
71796 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
71797 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
71798 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
71799 in which case no action is taken. If you want to set an empty sender (as in
71800 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
71801 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
71802 the address is qualified with that domain.
71803 </para>
71804 </listitem>
71805 </itemizedlist>
71806 <para>
71807 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
71808 other cases when a call to Exim is made, if there is any output from Exim (in
71809 particular, if the command fails) a window containing the command and the
71810 output is displayed. Otherwise, the results of the action are normally apparent
71811 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
71812 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
71813 if no output is generated.
71814 </para>
71815 <para>
71816 The queue display is automatically updated for actions such as freezing and
71817 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
71818 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
71819 force an update of the display after one of these actions.
71820 </para>
71821 <para>
71822 In any text window that is displayed as result of a menu action, the normal
71823 cut-and-paste facility is available, and searching can be carried out using ^R
71824 and ^S, as described above for the log tail window.
71825 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
71826 </para>
71827 </section>
71828 </chapter>
71829
71830 <chapter id="CHAPsecurity">
71831 <title>Security considerations</title>
71832 <para>
71833 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
71834 <primary>security</primary>
71835 <secondary>discussion of</secondary>
71836 </indexterm>
71837 This chapter discusses a number of issues concerned with security, some of
71838 which are also covered in other parts of this manual.
71839 </para>
71840 <para>
71841 For reasons that this author does not understand, some people have promoted
71842 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
71843 existence of this chapter in the documentation. However, the intent of the
71844 chapter is simply to describe the way Exim works in relation to certain
71845 security concerns, not to make any specific claims about the effectiveness of
71846 its security as compared with other MTAs.
71847 </para>
71848 <para>
71849 What follows is a description of the way Exim is supposed to be. Best efforts
71850 have been made to try to ensure that the code agrees with the theory, but an
71851 absence of bugs can never be guaranteed. Any that are reported will get fixed
71852 as soon as possible.
71853 </para>
71854 <section id="SECID286">
71855 <title>Building a more <quote>hardened</quote> Exim</title>
71856 <para>
71857 <indexterm role="concept">
71858 <primary>security</primary>
71859 <secondary>build-time features</secondary>
71860 </indexterm>
71861 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
71862 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
71863 Exim administrator who does not have the root password, or by someone who has
71864 penetrated the Exim (but not the root) account. These options are as follows:
71865 </para>
71866 <itemizedlist>
71867 <listitem>
71868 <para>
71869 ALT_CONFIG_PREFIX can be set to a string that is required to match the
71870 start of any filenames used with the <option>-C</option> option. When it is set, these
71871 filenames are also not allowed to contain the sequence <quote>/../</quote>. (However, if
71872 the value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
71873 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
71874 default setting for <option>ALT_CONFIG_PREFIX</option>.
71875 </para>
71876 <para>
71877 If the permitted configuration files are confined to a directory to
71878 which only root has access, this guards against someone who has broken
71879 into the Exim account from running a privileged Exim with an arbitrary
71880 configuration file, and using it to break into other accounts.
71881 </para>
71882 </listitem>
71883 <listitem>
71884 <para>
71885 If a non-trusted configuration file (i.e. not the default configuration file
71886 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
71887 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
71888 the next item), then root privilege is retained only if the caller of Exim is
71889 root. This locks out the possibility of testing a configuration using <option>-C</option>
71890 right through message reception and delivery, even if the caller is root. The
71891 reception works, but by that time, Exim is running as the Exim user, so when
71892 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
71893 privilege to be lost. However, root can test reception and delivery using two
71894 separate commands.
71895 </para>
71896 </listitem>
71897 <listitem>
71898 <para>
71899 The WHITELIST_D_MACROS build option declares some macros to be safe to override
71900 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
71901 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
71902 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
71903 the restrictive side.  Requiring build-time selection of safe macros is onerous
71904 but this option is intended solely as a transition mechanism to permit
71905 previously-working configurations to continue to work after release 4.73.
71906 </para>
71907 </listitem>
71908 <listitem>
71909 <para>
71910 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
71911 is disabled.
71912 </para>
71913 </listitem>
71914 <listitem>
71915 <para>
71916 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
71917 never to be used for any deliveries. This is like the <option>never_users</option> runtime
71918 option, but it cannot be overridden; the runtime option adds additional users
71919 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
71920 is permitted to modify the runtime file from using Exim as a way to get root.
71921 </para>
71922 </listitem>
71923 </itemizedlist>
71924 </section>
71925 <section id="SECID270">
71926 <title>Root privilege</title>
71927 <para>
71928 <indexterm role="concept">
71929 <primary>setuid</primary>
71930 </indexterm>
71931 <indexterm role="concept">
71932 <primary>root privilege</primary>
71933 </indexterm>
71934 The Exim binary is normally setuid to root, which means that it gains root
71935 privilege (runs as root) when it starts execution. In some special cases (for
71936 example, when the daemon is not in use and there are no local deliveries), it
71937 may be possible to run Exim setuid to some user other than root. This is
71938 discussed in the next section. However, in most installations, root privilege
71939 is required for two things:
71940 </para>
71941 <itemizedlist>
71942 <listitem>
71943 <para>
71944 To set up a socket connected to the standard SMTP port (25) when initialising
71945 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
71946 not required.
71947 </para>
71948 </listitem>
71949 <listitem>
71950 <para>
71951 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
71952 perform local deliveries as the receiving user or as specified in the
71953 configuration.
71954 </para>
71955 </listitem>
71956 </itemizedlist>
71957 <para>
71958 It is not necessary to be root to do any of the other things Exim does, such as
71959 receiving messages and delivering them externally over SMTP, and it is
71960 obviously more secure if Exim does not run as root except when necessary.
71961 For this reason, a user and group for Exim to use must be defined in
71962 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
71963 group</quote>. Their values can be changed by the runtime configuration, though this
71964 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
71965 <emphasis>mail</emphasis> or another user name altogether.
71966 </para>
71967 <para>
71968 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
71969 abdication; the process cannot regain root afterwards. Prior to release 4.00,
71970 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
71971 </para>
71972 <para>
71973 After a new Exim process has interpreted its command line options, it changes
71974 uid and gid in the following cases:
71975 </para>
71976 <itemizedlist>
71977 <listitem>
71978 <para>
71979 <indexterm role="option">
71980 <primary><option>-C</option></primary>
71981 </indexterm>
71982 <indexterm role="option">
71983 <primary><option>-D</option></primary>
71984 </indexterm>
71985 If the <option>-C</option> option is used to specify an alternate configuration file, or if
71986 the <option>-D</option> option is used to define macro values for the configuration, and the
71987 calling process is not running as root, the uid and gid are changed to those of
71988 the calling process.
71989 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
71990 option may not be used at all.
71991 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
71992 can be supplied if the calling process is running as root, the Exim run-time
71993 user or CONFIGURE_OWNER, if defined.
71994 </para>
71995 </listitem>
71996 <listitem>
71997 <para>
71998 <indexterm role="option">
71999 <primary><option>-be</option></primary>
72000 </indexterm>
72001 <indexterm role="option">
72002 <primary><option>-bf</option></primary>
72003 </indexterm>
72004 <indexterm role="option">
72005 <primary><option>-bF</option></primary>
72006 </indexterm>
72007 If the expansion test option (<option>-be</option>) or one of the filter testing options
72008 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
72009 calling process.
72010 </para>
72011 </listitem>
72012 <listitem>
72013 <para>
72014 If the process is not a daemon process or a queue runner process or a delivery
72015 process or a process for testing address routing (started with <option>-bt</option>), the
72016 uid and gid are changed to the Exim user and group. This means that Exim always
72017 runs under its own uid and gid when receiving messages. This also applies when
72018 testing address verification
72019 <indexterm role="option">
72020 <primary><option>-bv</option></primary>
72021 </indexterm>
72022 <indexterm role="option">
72023 <primary><option>-bh</option></primary>
72024 </indexterm>
72025 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
72026 option).
72027 </para>
72028 </listitem>
72029 <listitem>
72030 <para>
72031 For a daemon, queue runner, delivery, or address testing process, the uid
72032 remains as root at this stage, but the gid is changed to the Exim group.
72033 </para>
72034 </listitem>
72035 </itemizedlist>
72036 <para>
72037 The processes that initially retain root privilege behave as follows:
72038 </para>
72039 <itemizedlist>
72040 <listitem>
72041 <para>
72042 A daemon process changes the gid to the Exim group and the uid to the Exim
72043 user after setting up one or more listening sockets. The <function>initgroups()</function>
72044 function is called, so that if the Exim user is in any additional groups, they
72045 will be used during message reception.
72046 </para>
72047 </listitem>
72048 <listitem>
72049 <para>
72050 A queue runner process retains root privilege throughout its execution. Its
72051 job is to fork a controlled sequence of delivery processes.
72052 </para>
72053 </listitem>
72054 <listitem>
72055 <para>
72056 A delivery process retains root privilege throughout most of its execution,
72057 but any actual deliveries (that is, the transports themselves) are run in
72058 subprocesses which always change to a non-root uid and gid. For local
72059 deliveries this is typically the uid and gid of the owner of the mailbox; for
72060 remote deliveries, the Exim uid and gid are used. Once all the delivery
72061 subprocesses have been run, a delivery process changes to the Exim uid and gid
72062 while doing post-delivery tidying up such as updating the retry database and
72063 generating bounce and warning messages.
72064 </para>
72065 <para>
72066 While the recipient addresses in a message are being routed, the delivery
72067 process runs as root. However, if a user&#x2019;s filter file has to be processed,
72068 this is done in a subprocess that runs under the individual user&#x2019;s uid and
72069 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
72070 </para>
72071 </listitem>
72072 <listitem>
72073 <para>
72074 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
72075 the routing is done in the same environment as a message delivery.
72076 </para>
72077 </listitem>
72078 </itemizedlist>
72079 </section>
72080 <section id="SECTrunexiwitpri">
72081 <title>Running Exim without privilege</title>
72082 <para>
72083 <indexterm role="concept">
72084 <primary>privilege, running without</primary>
72085 </indexterm>
72086 <indexterm role="concept">
72087 <primary>unprivileged running</primary>
72088 </indexterm>
72089 <indexterm role="concept">
72090 <primary>root privilege</primary>
72091 <secondary>running without</secondary>
72092 </indexterm>
72093 Some installations like to run Exim in an unprivileged state for more of its
72094 operation, for added security. Support for this mode of operation is provided
72095 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
72096 gid are changed to the Exim user and group at the start of a delivery process
72097 (and also queue runner and address testing processes). This means that address
72098 routing is no longer run as root, and the deliveries themselves cannot change
72099 to any other uid.
72100 </para>
72101 <para>
72102 <indexterm role="concept">
72103 <primary>SIGHUP</primary>
72104 </indexterm>
72105 <indexterm role="concept">
72106 <primary>daemon</primary>
72107 <secondary>restarting</secondary>
72108 </indexterm>
72109 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
72110 that the daemon can still be started in the usual way, and it can respond
72111 correctly to SIGHUP because the re-invocation regains root privilege.
72112 </para>
72113 <para>
72114 An alternative approach is to make Exim setuid to the Exim user and also setgid
72115 to the Exim group. If you do this, the daemon must be started from a root
72116 process. (Calling Exim from a root process makes it behave in the way it does
72117 when it is setuid root.) However, the daemon cannot restart itself after a
72118 SIGHUP signal because it cannot regain privilege.
72119 </para>
72120 <para>
72121 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
72122 stops Exim from trying to re-invoke itself to do a delivery after a message has
72123 been received. Such a re-invocation is a waste of resources because it has no
72124 effect.
72125 </para>
72126 <para>
72127 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
72128 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
72129 to the Exim user seems a clean approach, but there is one complication:
72130 </para>
72131 <para>
72132 In this style of operation, Exim is running with the real uid and gid set to
72133 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
72134 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
72135 that is, the real uid/gid should be reset to the effective values so as to
72136 discard any privileges that the caller may have. While some operating systems
72137 have a function that permits this action for a non-root effective uid, quite a
72138 number of them do not. Because of this lack of standardization, Exim does not
72139 address this problem at this time.
72140 </para>
72141 <para>
72142 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
72143 is to keep the Exim binary setuid to root, and to set
72144 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
72145 be used in the most straightforward way.
72146 </para>
72147 <para>
72148 If you configure Exim not to run delivery processes as root, there are a
72149 number of restrictions on what you can do:
72150 </para>
72151 <itemizedlist>
72152 <listitem>
72153 <para>
72154 You can deliver only as the Exim user/group. You should  explicitly use the
72155 <option>user</option> and <option>group</option> options to override routers or local transports that
72156 normally deliver as the recipient. This makes sure that configurations that
72157 work in this mode function the same way in normal mode. Any implicit or
72158 explicit specification of another user causes an error.
72159 </para>
72160 </listitem>
72161 <listitem>
72162 <para>
72163 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
72164 not worthwhile to include them in the configuration.
72165 </para>
72166 </listitem>
72167 <listitem>
72168 <para>
72169 Users who wish to use <filename>.forward</filename> would have to make their home directory and
72170 the file itself accessible to the Exim user. Pipe and append-to-file entries,
72171 and their equivalents in Exim filters, cannot be used. While they could be
72172 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
72173 </para>
72174 </listitem>
72175 <listitem>
72176 <para>
72177 Unless the local user mailboxes are all owned by the Exim user (possible in
72178 some POP3 or IMAP-only environments):
72179 </para>
72180 <orderedlist numeration="arabic">
72181 <listitem>
72182 <para>
72183 They must be owned by the Exim group and be writeable by that group. This
72184 implies you must set <option>mode</option> in the appendfile configuration, as well as the
72185 mode of the mailbox files themselves.
72186 </para>
72187 </listitem>
72188 <listitem>
72189 <para>
72190 You must set <option>no_check_owner</option>, since most or all of the files will not be
72191 owned by the Exim user.
72192 </para>
72193 </listitem>
72194 <listitem>
72195 <para>
72196 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
72197 on a newly created mailbox when unprivileged. This also implies that new
72198 mailboxes need to be created manually.
72199 </para>
72200 </listitem>
72201 </orderedlist>
72202 </listitem>
72203 </itemizedlist>
72204 <para>
72205 These restrictions severely restrict what can be done in local deliveries.
72206 However, there are no restrictions on remote deliveries. If you are running a
72207 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
72208 gives more security at essentially no cost.
72209 </para>
72210 <para>
72211 If you are using the <option>mua_wrapper</option> facility (see chapter
72212 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
72213 </para>
72214 </section>
72215 <section id="SECID271">
72216 <title>Delivering to local files</title>
72217 <para>
72218 Full details of the checks applied by <command>appendfile</command> before it writes to a file
72219 are given in chapter <xref linkend="CHAPappendfile"/>.
72220 </para>
72221 </section>
72222 <section id="SECTsecconslocalcmds">
72223 <title>Running local commands</title>
72224 <para>
72225 <indexterm role="concept">
72226 <primary>security</primary>
72227 <secondary>local commands</secondary>
72228 </indexterm>
72229 <indexterm role="concept">
72230 <primary>security</primary>
72231 <secondary>command injection attacks</secondary>
72232 </indexterm>
72233 There are a number of ways in which an administrator can configure Exim to run
72234 commands based upon received, untrustworthy, data. Further, in some
72235 configurations a user who can control a <filename>.forward</filename> file can also arrange to
72236 run commands. Configuration to check includes, but is not limited to:
72237 </para>
72238 <itemizedlist>
72239 <listitem>
72240 <para>
72241 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
72242 injection may be possible with this option present. It is dangerous and should
72243 be used only with considerable caution. Consider constraints which whitelist
72244 allowed characters in a variable which is to be used in a pipe transport that
72245 has <option>use_shell</option> enabled.
72246 </para>
72247 </listitem>
72248 <listitem>
72249 <para>
72250 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
72251 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
72252 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
72253 hub to which ordinary users do not have shell access, but home directories are
72254 NFS mounted (for instance) then administrators should review the list of these
72255 forbid options available, and should bear in mind that the options that may
72256 need forbidding can change as new features are added between releases.
72257 </para>
72258 </listitem>
72259 <listitem>
72260 <para>
72261 The <option>${run...}</option> expansion item does not use a shell by default, but
72262 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
72263 Such invocations should be viewed with prejudicial suspicion.
72264 </para>
72265 </listitem>
72266 <listitem>
72267 <para>
72268 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
72269 taint checking might apply to their usage.
72270 </para>
72271 </listitem>
72272 <listitem>
72273 <para>
72274 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
72275 administrators are well advised to view its use with suspicion, in case (for
72276 instance) it allows a local-part to contain embedded Exim directives.
72277 </para>
72278 </listitem>
72279 <listitem>
72280 <para>
72281 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
72282 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
72283 each can reference arbitrary lists and files, rather than just being a list
72284 of opaque strings.
72285 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
72286 real-world security vulnerabilities caused by its use with untrustworthy data
72287 injected in, for SQL injection attacks.
72288 Consider the use of the <option>inlisti</option> expansion condition instead.
72289 </para>
72290 </listitem>
72291 </itemizedlist>
72292 </section>
72293 <section id="SECTsecconfdata">
72294 <title>Trust in configuration data</title>
72295 <para>
72296 <indexterm role="concept">
72297 <primary>security</primary>
72298 <secondary>data sources</secondary>
72299 </indexterm>
72300 <indexterm role="concept">
72301 <primary>security</primary>
72302 <secondary>regular expressions</secondary>
72303 </indexterm>
72304 <indexterm role="concept">
72305 <primary>regular expressions</primary>
72306 <secondary>security</secondary>
72307 </indexterm>
72308 <indexterm role="concept">
72309 <primary>PCRE</primary>
72310 <secondary>security</secondary>
72311 </indexterm>
72312 If configuration data for Exim can come from untrustworthy sources, there
72313 are some issues to be aware of:
72314 </para>
72315 <itemizedlist>
72316 <listitem>
72317 <para>
72318 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
72319 </para>
72320 </listitem>
72321 <listitem>
72322 <para>
72323 Letting untrusted data provide a regular expression is unwise.
72324 </para>
72325 </listitem>
72326 <listitem>
72327 <para>
72328 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
72329 data may result in pathological behaviour within PCRE.  Be aware of what
72330 "backtracking" means and consider options for being more strict with a regular
72331 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
72332 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
72333 possessive quantifiers or just not using regular expressions against untrusted
72334 data.
72335 </para>
72336 </listitem>
72337 <listitem>
72338 <para>
72339 It can be important to correctly use <option>${quote:...}</option>,
72340 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
72341 items to ensure that data is correctly constructed.
72342 </para>
72343 </listitem>
72344 <listitem>
72345 <para>
72346 Some lookups might return multiple results, even though normal usage is only
72347 expected to yield one result.
72348 </para>
72349 </listitem>
72350 </itemizedlist>
72351 </section>
72352 <section id="SECID272">
72353 <title>IPv4 source routing</title>
72354 <para>
72355 <indexterm role="concept">
72356 <primary>source routing</primary>
72357 <secondary>in IP packets</secondary>
72358 </indexterm>
72359 <indexterm role="concept">
72360 <primary>IP source routing</primary>
72361 </indexterm>
72362 Many operating systems suppress IP source-routed packets in the kernel, but
72363 some cannot be made to do this, so Exim does its own check. It logs incoming
72364 IPv4 source-routed TCP calls, and then drops them. Things are all different in
72365 IPv6. No special checking is currently done.
72366 </para>
72367 </section>
72368 <section id="SECID273">
72369 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
72370 <para>
72371 Support for these SMTP commands is disabled by default. If required, they can
72372 be enabled by defining suitable ACLs.
72373 </para>
72374 </section>
72375 <section id="SECID274">
72376 <title>Privileged users</title>
72377 <para>
72378 <indexterm role="concept">
72379 <primary>trusted users</primary>
72380 </indexterm>
72381 <indexterm role="concept">
72382 <primary>admin user</primary>
72383 </indexterm>
72384 <indexterm role="concept">
72385 <primary>privileged user</primary>
72386 </indexterm>
72387 <indexterm role="concept">
72388 <primary>user</primary>
72389 <secondary>trusted</secondary>
72390 </indexterm>
72391 <indexterm role="concept">
72392 <primary>user</primary>
72393 <secondary>admin</secondary>
72394 </indexterm>
72395 Exim recognizes two sets of users with special privileges. Trusted users are
72396 able to submit new messages to Exim locally, but supply their own sender
72397 addresses and information about a sending host. For other users submitting
72398 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
72399 permit a remote host to be specified.
72400 </para>
72401 <para>
72402 <indexterm role="option">
72403 <primary><option>-f</option></primary>
72404 </indexterm>
72405 However, an untrusted user is permitted to use the <option>-f</option> command line option
72406 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
72407 message should not cause an error report. This affects the message&#x2019;s envelope,
72408 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
72409 permitted to use specific forms of address with the <option>-f</option> option by setting
72410 the <option>untrusted_set_sender</option> option.
72411 </para>
72412 <para>
72413 Trusted users are used to run processes that receive mail messages from some
72414 other mail domain and pass them on to Exim for delivery either locally, or over
72415 the Internet. Exim trusts a caller that is running as root, as the Exim user,
72416 as any user listed in the <option>trusted_users</option> configuration option, or under any
72417 group listed in the <option>trusted_groups</option> option.
72418 </para>
72419 <para>
72420 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
72421 can freeze or thaw messages, cause them to be returned to their senders, remove
72422 them entirely, or modify them in various ways. In addition, admin users can run
72423 the Exim monitor and see all the information it is capable of providing, which
72424 includes the contents of files on the spool.
72425 </para>
72426 <para>
72427 <indexterm role="option">
72428 <primary><option>-M</option></primary>
72429 </indexterm>
72430 <indexterm role="option">
72431 <primary><option>-q</option></primary>
72432 </indexterm>
72433 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
72434 delivery of messages on its queue is restricted to admin users. This
72435 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
72436 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
72437 queue is also restricted to admin users. This restriction can be relaxed by
72438 setting <option>no_queue_list_requires_admin</option>.
72439 </para>
72440 <para>
72441 Exim recognizes an admin user if the calling process is running as root or as
72442 the Exim user or if any of the groups associated with the calling process is
72443 the Exim group. It is not necessary actually to be running under the Exim
72444 group. However, if admin users who are not root or the Exim user are to access
72445 the contents of files on the spool via the Exim monitor (which runs
72446 unprivileged), Exim must be built to allow group read access to its spool
72447 files.
72448 </para>
72449 <para>
72450 By default, regular users are trusted to perform basic testing and
72451 introspection commands, as themselves.  This setting can be tightened by
72452 setting the <option>commandline_checks_require_admin</option> option.
72453 This affects most of the checking options,
72454 such as <option>-be</option> and anything else <option>-b*</option>.
72455 </para>
72456 </section>
72457 <section id="SECID275">
72458 <title>Spool files</title>
72459 <para>
72460 <indexterm role="concept">
72461 <primary>spool directory</primary>
72462 <secondary>files</secondary>
72463 </indexterm>
72464 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
72465 set to the Exim group. The mode for spool files is defined in the
72466 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
72467 any user who is a member of the Exim group can access these files.
72468 </para>
72469 </section>
72470 <section id="SECID276">
72471 <title>Use of argv[0]</title>
72472 <para>
72473 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
72474 of specific strings, Exim assumes certain options. For example, calling Exim
72475 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
72476 to calling it with the option <option>-bS</option>. There are no security implications in
72477 this.
72478 </para>
72479 </section>
72480 <section id="SECID277">
72481 <title>Use of %f formatting</title>
72482 <para>
72483 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
72484 are actually stored in integer variables as 1000 times the load average.
72485 Consequently, their range is limited and so therefore is the length of the
72486 converted output.
72487 </para>
72488 </section>
72489 <section id="SECID278">
72490 <title>Embedded Exim path</title>
72491 <para>
72492 Exim uses its own path name, which is embedded in the code, only when it needs
72493 to re-exec in order to regain root privilege. Therefore, it is not root when it
72494 does so. If some bug allowed the path to get overwritten, it would lead to an
72495 arbitrary program&#x2019;s being run as exim, not as root.
72496 </para>
72497 </section>
72498 <section id="SECTdynmoddir">
72499 <title>Dynamic module directory</title>
72500 <para>
72501 Any dynamically loadable modules must be installed into the directory
72502 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
72503 loading it.
72504 </para>
72505 </section>
72506 <section id="SECID279">
72507 <title>Use of sprintf()</title>
72508 <para>
72509 <indexterm role="concept">
72510 <primary><function>sprintf()</function></primary>
72511 </indexterm>
72512 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
72513 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
72514 The intermediate formatting is done into a large fixed buffer by a function
72515 that runs through the format string itself, and checks the length of each
72516 conversion before performing it, thus preventing buffer overruns.
72517 </para>
72518 <para>
72519 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
72520 the output buffer is known to be sufficiently long to contain the converted
72521 string.
72522 </para>
72523 </section>
72524 <section id="SECID280">
72525 <title>Use of debug_printf() and log_write()</title>
72526 <para>
72527 Arbitrary strings are passed to both these functions, but they do their
72528 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
72529 the format string itself, and checks the length of each conversion.
72530 </para>
72531 </section>
72532 <section id="SECID281">
72533 <title>Use of strcat() and strcpy()</title>
72534 <para>
72535 These are used only in cases where the output buffer is known to be large
72536 enough to hold the result.
72537 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
72538 </para>
72539 </section>
72540 </chapter>
72541
72542 <chapter id="CHAPspool">
72543 <title>Format of spool files</title>
72544 <para>
72545 <indexterm role="concept" id="IIDforspo1" class="startofrange">
72546 <primary>format</primary>
72547 <secondary>spool files</secondary>
72548 </indexterm>
72549 <indexterm role="concept" id="IIDforspo2" class="startofrange">
72550 <primary>spool directory</primary>
72551 <secondary>format of files</secondary>
72552 </indexterm>
72553 <indexterm role="concept" id="IIDforspo3" class="startofrange">
72554 <primary>spool files</primary>
72555 <secondary>format of</secondary>
72556 </indexterm>
72557 <indexterm role="concept">
72558 <primary>spool files</primary>
72559 <secondary>editing</secondary>
72560 </indexterm>
72561 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
72562 followed by -D and -H, respectively. The data portion of the message is kept in
72563 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
72564 kept in the -H file, whose format is described in this chapter. Each of these
72565 two files contains the final component of its own name as its first line. This
72566 is insurance against disk crashes where the directory is lost but the files
72567 themselves are recoverable.
72568 </para>
72569 <para>
72570 The file formats may be changed, or new formats added, at any release.
72571 Spool files are not intended as an interface to other programs
72572 and should not be used as such.
72573 </para>
72574 <para>
72575 Some people are tempted into editing -D files in order to modify messages. You
72576 need to be extremely careful if you do this; it is not recommended and you are
72577 on your own if you do it. Here are some of the pitfalls:
72578 </para>
72579 <itemizedlist>
72580 <listitem>
72581 <para>
72582 You must ensure that Exim does not try to deliver the message while you are
72583 fiddling with it. The safest way is to take out a write lock on the -D file,
72584 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
72585 place, the lock will be retained. If you write a new file and rename it, the
72586 lock will be lost at the instant of rename.
72587 </para>
72588 </listitem>
72589 <listitem>
72590 <para>
72591 <indexterm role="variable">
72592 <primary><varname>$body_linecount</varname></primary>
72593 </indexterm>
72594 If you change the number of lines in the file, the value of
72595 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
72596 cause incomplete transmission of messages or undeliverable messages.
72597 </para>
72598 </listitem>
72599 <listitem>
72600 <para>
72601 If the message is in MIME format, you must take care not to break it.
72602 </para>
72603 </listitem>
72604 <listitem>
72605 <para>
72606 If the message is cryptographically signed, any change will invalidate the
72607 signature.
72608 </para>
72609 </listitem>
72610 </itemizedlist>
72611 <para>
72612 All in all, modifying -D files is fraught with danger.
72613 </para>
72614 <para>
72615 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
72616 its subdirectories when <option>split_spool_directory</option> is set). These are journal
72617 files, used to record addresses to which the message has been delivered during
72618 the course of a delivery attempt. If there are still undelivered recipients at
72619 the end, the -H file is updated, and the -J file is deleted. If, however, there
72620 is some kind of crash (for example, a power outage) before this happens, the -J
72621 file remains in existence. When Exim next processes the message, it notices the
72622 -J file and uses it to update the -H file before starting the next delivery
72623 attempt.
72624 </para>
72625 <para>
72626 Files whose names end with -K or .eml may also be seen in the spool.
72627 These are temporaries used for DKIM or malware processing, when that is used.
72628 They should be tidied up by normal operations; any old ones are probably
72629 relics of crashes and can be removed.
72630 </para>
72631 <section id="SECID282">
72632 <title>Format of the -H file</title>
72633 <para>
72634 <indexterm role="concept">
72635 <primary>uid (user id)</primary>
72636 <secondary>in spool file</secondary>
72637 </indexterm>
72638 <indexterm role="concept">
72639 <primary>gid (group id)</primary>
72640 <secondary>in spool file</secondary>
72641 </indexterm>
72642 The second line of the -H file contains the login name for the uid of the
72643 process that called Exim to read the message, followed by the numerical uid and
72644 gid. For a locally generated message, this is normally the user who sent the
72645 message. For a message received over TCP/IP via the daemon, it is
72646 normally the Exim user.
72647 </para>
72648 <para>
72649 The third line of the file contains the address of the message&#x2019;s sender as
72650 transmitted in the envelope, contained in angle brackets. The sender address is
72651 empty for bounce messages. For incoming SMTP mail, the sender address is given
72652 in the MAIL command. For locally generated mail, the sender address is
72653 created by Exim from the login name of the current user and the configured
72654 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
72655 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
72656 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
72657 </para>
72658 <para>
72659 The fourth line contains two numbers. The first is the time that the message
72660 was received, in the conventional Unix form &ndash; the number of seconds since the
72661 start of the epoch. The second number is a count of the number of messages
72662 warning of delayed delivery that have been sent to the sender.
72663 </para>
72664 <para>
72665 There follow a number of lines starting with a hyphen. These can appear in any
72666 order, and are omitted when not relevant:
72667 </para>
72668 <variablelist>
72669 <varlistentry>
72670 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72671 <listitem>
72672 <para>
72673 This item is obsolete, and is not generated from Exim release 4.61 onwards;
72674 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
72675 recognized, to provide backward compatibility. In the old format, a line of
72676 this form is present for every ACL variable that is not empty. The number
72677 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
72678 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
72679 the data string for the variable. The string itself starts at the beginning of
72680 the next line, and is followed by a newline character. It may contain internal
72681 newlines.
72682 </para>
72683 </listitem></varlistentry>
72684 <varlistentry>
72685 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72686 <listitem>
72687 <para>
72688 A line of this form is present for every ACL connection variable that is
72689 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
72690 The length is the length of the data string for the variable. The string itself
72691 starts at the beginning of the next line, and is followed by a newline
72692 character. It may contain internal newlines.
72693 </para>
72694 </listitem></varlistentry>
72695 <varlistentry>
72696 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72697 <listitem>
72698 <para>
72699 A line of this form is present for every ACL message variable that is defined.
72700 Note that there is a space between <option>-aclm</option> and the rest of the name. The
72701 length is the length of the data string for the variable. The string itself
72702 starts at the beginning of the next line, and is followed by a newline
72703 character. It may contain internal newlines.
72704 </para>
72705 </listitem></varlistentry>
72706 <varlistentry>
72707 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
72708 <listitem>
72709 <para>
72710 This is present if, when the message was received over SMTP, the value of
72711 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
72712 </para>
72713 </listitem></varlistentry>
72714 <varlistentry>
72715 <term><option>-allow_unqualified_recipient</option></term>
72716 <listitem>
72717 <para>
72718 This is present if unqualified recipient addresses are permitted in header
72719 lines (to stop such addresses from being qualified if rewriting occurs at
72720 transport time). Local messages that were input using <option>-bnq</option> and remote
72721 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
72722 </para>
72723 </listitem></varlistentry>
72724 <varlistentry>
72725 <term><option>-allow_unqualified_sender</option></term>
72726 <listitem>
72727 <para>
72728 This is present if unqualified sender addresses are permitted in header lines
72729 (to stop such addresses from being qualified if rewriting occurs at transport
72730 time). Local messages that were input using <option>-bnq</option> and remote messages from
72731 hosts that match <option>sender_unqualified_hosts</option> set this flag.
72732 </para>
72733 </listitem></varlistentry>
72734 <varlistentry>
72735 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72736 <listitem>
72737 <para>
72738 The id information for a message received on an authenticated SMTP connection
72739 &ndash; the value of the <varname>$authenticated_id</varname> variable.
72740 </para>
72741 </listitem></varlistentry>
72742 <varlistentry>
72743 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
72744 <listitem>
72745 <para>
72746 The address of an authenticated sender &ndash; the value of the
72747 <varname>$authenticated_sender</varname> variable.
72748 </para>
72749 </listitem></varlistentry>
72750 <varlistentry>
72751 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
72752 <listitem>
72753 <para>
72754 This records the number of lines in the body of the message, and is
72755 present unless <option>-spool_file_wireformat</option> is.
72756 </para>
72757 </listitem></varlistentry>
72758 <varlistentry>
72759 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
72760 <listitem>
72761 <para>
72762 This records the number of binary zero bytes in the body of the message, and is
72763 present if the number is greater than zero.
72764 </para>
72765 </listitem></varlistentry>
72766 <varlistentry>
72767 <term><option>-deliver_firsttime</option></term>
72768 <listitem>
72769 <para>
72770 This is written when a new message is first added to the spool. When the spool
72771 file is updated after a deferral, it is omitted.
72772 </para>
72773 </listitem></varlistentry>
72774 <varlistentry>
72775 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
72776 <listitem>
72777 <para>
72778 <indexterm role="concept">
72779 <primary>frozen messages</primary>
72780 <secondary>spool data</secondary>
72781 </indexterm>
72782 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
72783 </para>
72784 </listitem></varlistentry>
72785 <varlistentry>
72786 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72787 <listitem>
72788 <para>
72789 This records the host name as specified by a remote host in a HELO or EHLO
72790 command.
72791 </para>
72792 </listitem></varlistentry>
72793 <varlistentry>
72794 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
72795 <listitem>
72796 <para>
72797 This records the IP address of the host from which the message was received and
72798 the remote port number that was used. It is omitted for locally generated
72799 messages.
72800 </para>
72801 </listitem></varlistentry>
72802 <varlistentry>
72803 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72804 <listitem>
72805 <para>
72806 If the message was received on an authenticated SMTP connection, this records
72807 the name of the authenticator &ndash; the value of the
72808 <varname>$sender_host_authenticated</varname> variable.
72809 </para>
72810 </listitem></varlistentry>
72811 <varlistentry>
72812 <term><option>-host_lookup_failed</option></term>
72813 <listitem>
72814 <para>
72815 This is present if an attempt to look up the sending host&#x2019;s name from its IP
72816 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
72817 </para>
72818 </listitem></varlistentry>
72819 <varlistentry>
72820 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72821 <listitem>
72822 <para>
72823 <indexterm role="concept">
72824 <primary>reverse DNS lookup</primary>
72825 </indexterm>
72826 <indexterm role="concept">
72827 <primary>DNS</primary>
72828 <secondary>reverse lookup</secondary>
72829 </indexterm>
72830 This records the name of the remote host from which the message was received,
72831 if the host name was looked up from the IP address when the message was being
72832 received. It is not present if no reverse lookup was done.
72833 </para>
72834 </listitem></varlistentry>
72835 <varlistentry>
72836 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72837 <listitem>
72838 <para>
72839 For locally submitted messages, this records the login of the originating user,
72840 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
72841 ident value. For messages received over TCP/IP, this records the ident string
72842 supplied by the remote host, if any.
72843 </para>
72844 </listitem></varlistentry>
72845 <varlistentry>
72846 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
72847 <listitem>
72848 <para>
72849 This records the IP address of the local interface and the port number through
72850 which a message was received from a remote host. It is omitted for locally
72851 generated messages.
72852 </para>
72853 </listitem></varlistentry>
72854 <varlistentry>
72855 <term><option>-local</option></term>
72856 <listitem>
72857 <para>
72858 The message is from a local sender.
72859 </para>
72860 </listitem></varlistentry>
72861 <varlistentry>
72862 <term><option>-localerror</option></term>
72863 <listitem>
72864 <para>
72865 The message is a locally-generated bounce message.
72866 </para>
72867 </listitem></varlistentry>
72868 <varlistentry>
72869 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
72870 <listitem>
72871 <para>
72872 This records the data string that was returned by the <function>local_scan()</function> function
72873 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
72874 variable. It is omitted if no data was returned.
72875 </para>
72876 </listitem></varlistentry>
72877 <varlistentry>
72878 <term><option>-manual_thaw</option></term>
72879 <listitem>
72880 <para>
72881 The message was frozen but has been thawed manually, that is, by an explicit
72882 Exim command rather than via the auto-thaw process.
72883 </para>
72884 </listitem></varlistentry>
72885 <varlistentry>
72886 <term><option>-N</option></term>
72887 <listitem>
72888 <para>
72889 A testing delivery process was started using the <option>-N</option> option to suppress any
72890 actual deliveries, but delivery was deferred. At any further delivery attempts,
72891 <option>-N</option> is assumed.
72892 </para>
72893 </listitem></varlistentry>
72894 <varlistentry>
72895 <term><option>-received_protocol</option></term>
72896 <listitem>
72897 <para>
72898 This records the value of the <varname>$received_protocol</varname> variable, which contains
72899 the name of the protocol by which the message was received.
72900 </para>
72901 </listitem></varlistentry>
72902 <varlistentry>
72903 <term><option>-sender_set_untrusted</option></term>
72904 <listitem>
72905 <para>
72906 The envelope sender of this message was set by an untrusted local caller (used
72907 to ensure that the caller is displayed in queue listings).
72908 </para>
72909 </listitem></varlistentry>
72910 <varlistentry>
72911 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
72912 <listitem>
72913 <para>
72914 If a message was scanned by SpamAssassin, this is present. It records the value
72915 of <varname>$spam_score_int</varname>.
72916 </para>
72917 </listitem></varlistentry>
72918 <varlistentry>
72919 <term><option>-spool_file_wireformat</option></term>
72920 <listitem>
72921 <para>
72922 The -D file for this message is in wire-format (for ESMTP CHUNKING)
72923 rather than Unix-format.
72924 The line-ending is CRLF rather than newline.
72925 There is still, however, no leading-dot-stuffing.
72926 </para>
72927 </listitem></varlistentry>
72928 <varlistentry>
72929 <term><option>-tls_certificate_verified</option></term>
72930 <listitem>
72931 <para>
72932 A TLS certificate was received from the client that sent this message, and the
72933 certificate was verified by the server.
72934 </para>
72935 </listitem></varlistentry>
72936 <varlistentry>
72937 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
72938 <listitem>
72939 <para>
72940 When the message was received over an encrypted connection, this records the
72941 name of the cipher suite that was used.
72942 </para>
72943 </listitem></varlistentry>
72944 <varlistentry>
72945 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
72946 <listitem>
72947 <para>
72948 When the message was received over an encrypted connection, and a certificate
72949 was received from the client, this records the Distinguished Name from that
72950 certificate.
72951 </para>
72952 </listitem></varlistentry>
72953 </variablelist>
72954 <para>
72955 Any of the above may have an extra hyphen prepended, to indicate the the
72956 corresponding data is untrusted.
72957 </para>
72958 <para>
72959 Following the options there is a list of those addresses to which the message
72960 is not to be delivered. This set of addresses is initialized from the command
72961 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
72962 is set; otherwise it starts out empty. Whenever a successful delivery is made,
72963 the address is added to this set. The addresses are kept internally as a
72964 balanced binary tree, and it is a representation of that tree which is written
72965 to the spool file. If an address is expanded via an alias or forward file, the
72966 original address is added to the tree when deliveries to all its child
72967 addresses are complete.
72968 </para>
72969 <para>
72970 If the tree is empty, there is a single line in the spool file containing just
72971 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
72972 Y or N, followed by an address. The address is the value for the node of the
72973 tree, and the letters indicate whether the node has a left branch and/or a
72974 right branch attached to it, respectively. If branches exist, they immediately
72975 follow. Here is an example of a three-node tree:
72976 </para>
72977 <literallayout class="monospaced">
72978 YY darcy@austen.fict.example
72979 NN alice@wonderland.fict.example
72980 NN editor@thesaurus.ref.example
72981 </literallayout>
72982 <para>
72983 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
72984 This is a simple list, preceded by a count. It includes all the original
72985 recipients of the message, including those to whom the message has already been
72986 delivered. In the simplest case, the list contains one address per line. For
72987 example:
72988 </para>
72989 <literallayout class="monospaced">
72990 4
72991 editor@thesaurus.ref.example
72992 darcy@austen.fict.example
72993 rdo@foundation
72994 alice@wonderland.fict.example
72995 </literallayout>
72996 <para>
72997 However, when a child address has been added to the top-level addresses as a
72998 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
72999 line is of the following form:
73000 </para>
73001 <literallayout>
73002 &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;
73003 </literallayout>
73004 <para>
73005 The 01 flag bit indicates the presence of the three other fields that follow
73006 the top-level address. Other bits may be used in future to support additional
73007 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
73008 original parent of the <quote>one time</quote> address. The first two fields are the
73009 envelope sender that is associated with this address and its length. If the
73010 length is zero, there is no special envelope sender (there are then two space
73011 characters in the line). A non-empty field can arise from a <command>redirect</command> router
73012 that has an <option>errors_to</option> setting.
73013 </para>
73014 <para>
73015 A blank line separates the envelope and status information from the headers
73016 which follow. A header may occupy several lines of the file, and to save effort
73017 when reading it in, each header is preceded by a number and an identifying
73018 character. The number is the number of characters in the header, including any
73019 embedded newlines and the terminating newline. The character is one of the
73020 following:
73021 </para>
73022 <informaltable frame="none">
73023 <tgroup cols="2" colsep="0" rowsep="0">
73024 <colspec colwidth="50pt" align="left"/>
73025 <colspec colwidth="254pt" align="left"/>
73026 <tbody>
73027 <row>
73028 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
73029 <entry>header in which Exim has no special interest</entry>
73030 </row>
73031 <row>
73032 <entry><literal>B</literal></entry>
73033 <entry><emphasis>Bcc:</emphasis> header</entry>
73034 </row>
73035 <row>
73036 <entry><literal>C</literal></entry>
73037 <entry><emphasis>Cc:</emphasis> header</entry>
73038 </row>
73039 <row>
73040 <entry><literal>F</literal></entry>
73041 <entry><emphasis>From:</emphasis> header</entry>
73042 </row>
73043 <row>
73044 <entry><literal>I</literal></entry>
73045 <entry><emphasis>Message-id:</emphasis> header</entry>
73046 </row>
73047 <row>
73048 <entry><literal>P</literal></entry>
73049 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
73050 </row>
73051 <row>
73052 <entry><literal>R</literal></entry>
73053 <entry><emphasis>Reply-To:</emphasis> header</entry>
73054 </row>
73055 <row>
73056 <entry><literal>S</literal></entry>
73057 <entry><emphasis>Sender:</emphasis> header</entry>
73058 </row>
73059 <row>
73060 <entry><literal>T</literal></entry>
73061 <entry><emphasis>To:</emphasis> header</entry>
73062 </row>
73063 <row>
73064 <entry><literal>*</literal></entry>
73065 <entry>replaced or deleted header</entry>
73066 </row>
73067 </tbody>
73068 </tgroup>
73069 </informaltable>
73070 <para>
73071 Deleted or replaced (rewritten) headers remain in the spool file for debugging
73072 purposes. They are not transmitted when the message is delivered. Here is a
73073 typical set of headers:
73074 </para>
73075 <literallayout class="monospaced">
73076 111P Received: by hobbit.fict.example with local (Exim 4.00)
73077 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
73078 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
73079 038* X-rewrote-sender: bb@hobbit.fict.example
73080 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
73081 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
73082 099* To: alice@wonderland.fict.example, rdo@foundation,
73083 darcy@austen.fict.example, editor@thesaurus.ref.example
73084 104T To: alice@wonderland.fict.example, rdo@foundation.example,
73085 darcy@austen.fict.example, editor@thesaurus.ref.example
73086 038  Date: Fri, 11 May 2001 10:28:59 +0100
73087 </literallayout>
73088 <para>
73089 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
73090 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
73091 unqualified domain <emphasis>foundation</emphasis>.
73092 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
73093 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
73094 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
73095 </para>
73096 </section>
73097 <section id="SECID282a">
73098 <title>Format of the -D file</title>
73099 <para>
73100 The data file is traditionally in Unix-standard format: lines are ended with
73101 an ASCII newline character.
73102 However, when the <option>spool_wireformat</option> main option is used some -D files
73103 can have an alternate format.
73104 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
73105 The -D file lines (not including the first name-component line) are
73106 suitable for direct copying to the wire when transmitting using the
73107 ESMTP CHUNKING option, meaning lower processing overhead.
73108 Lines are terminated with an ASCII CRLF pair.
73109 There is no dot-stuffing (and no dot-termination).
73110 </para>
73111 </section>
73112 </chapter>
73113
73114 <chapter id="CHAPdkim">
73115 <title>DKIM, SPF and DMARC</title>
73116 <titleabbrev>DKIM, SPF and DMARC Support</titleabbrev>
73117 <section id="SECDKIM">
73118 <title>DKIM (DomainKeys Identified Mail)</title>
73119 <para>
73120 <indexterm role="concept">
73121 <primary>DKIM</primary>
73122 </indexterm>
73123 </para>
73124 <para>
73125 DKIM is a mechanism by which messages sent by some entity can be provably
73126 linked to a domain which that entity controls.  It permits reputation to
73127 be tracked on a per-domain basis, rather than merely upon source IP address.
73128 DKIM is documented in RFC 6376.
73129 </para>
73130 <para>
73131 As DKIM relies on the message being unchanged in transit, messages handled
73132 by a mailing-list (which traditionally adds to the message) will not match
73133 any original DKIM signature.
73134 </para>
73135 <para>
73136 DKIM support is compiled into Exim by default if TLS support is present.
73137 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
73138 </para>
73139 <para>
73140 Exim&#x2019;s DKIM implementation allows for
73141 </para>
73142 <orderedlist numeration="arabic">
73143 <listitem>
73144 <para>
73145 Signing outgoing messages: This function is implemented in the SMTP transport.
73146 It can co-exist with all other Exim features
73147 (including transport filters)
73148 except cutthrough delivery.
73149 </para>
73150 </listitem>
73151 <listitem>
73152 <para>
73153 Verifying signatures in incoming messages: This is implemented by an additional
73154 ACL (acl_smtp_dkim), which can be called several times per message, with
73155 different signature contexts.
73156 </para>
73157 </listitem>
73158 </orderedlist>
73159 <para>
73160 In typical Exim style, the verification implementation does not include any
73161 default "policy". Instead it enables you to build your own policy using
73162 Exim&#x2019;s standard controls.
73163 </para>
73164 <para>
73165 Please note that verification of DKIM signatures in incoming mail is turned
73166 on by default for logging (in the &lt;= line) purposes.
73167 </para>
73168 <para>
73169 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
73170 When set, for each signature in incoming email,
73171 exim will log a line displaying the most important signature details, and the
73172 signature status. Here is an example (with line-breaks added for clarity):
73173 </para>
73174 <literallayout class="monospaced">
73175 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
73176     d=facebookmail.com s=q1-2009b
73177     c=relaxed/relaxed a=rsa-sha1
73178     i=@facebookmail.com t=1252484542 [verification succeeded]
73179 </literallayout>
73180 <para>
73181 You might want to turn off DKIM verification processing entirely for internal
73182 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
73183 control modifier. This should typically be done in the RCPT ACL, at points
73184 where you accept mail from relay sources (internal hosts or authenticated
73185 senders).
73186 </para>
73187 </section>
73188 <section id="SECDKIMSIGN">
73189 <title>Signing outgoing messages</title>
73190 <para>
73191 <indexterm role="concept">
73192 <primary>DKIM</primary>
73193 <secondary>signing</secondary>
73194 </indexterm>
73195 </para>
73196 <para>
73197 For signing to be usable you must have published a DKIM record in DNS.
73198 Note that RFC 8301 (which does not cover EC keys) says:
73199 </para>
73200 <literallayout class="monospaced">
73201 rsa-sha1 MUST NOT be used for signing or verifying.
73202
73203 Signers MUST use RSA keys of at least 1024 bits for all keys.
73204 Signers SHOULD use RSA keys of at least 2048 bits.
73205 </literallayout>
73206 <para>
73207 Note also that the key content (the &#x2019;p=&#x2019; field)
73208 in the DNS record is different between RSA and EC keys;
73209 for the former it is the base64 of the ASN.1 for the RSA public key
73210 (equivalent to the private-key .pem with the header/trailer stripped)
73211 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
73212 </para>
73213 <para>
73214 Signing is enabled by setting private options on the SMTP transport.
73215 These options take (expandable) strings as arguments.
73216 </para>
73217 <para>
73218 <indexterm role="option">
73219 <primary><option>unset</option></primary>
73220 </indexterm>
73221 </para>
73222 <informaltable frame="all">
73223 <tgroup cols="4" colsep="0" rowsep="0">
73224 <colspec colwidth="8*" align="left"/>
73225 <colspec colwidth="6*" align="center"/>
73226 <colspec colwidth="6*" align="center"/>
73227 <colspec colwidth="6*" align="right"/>
73228 <tbody>
73229 <row>
73230 <entry><option>dkim_domain</option></entry>
73231 <entry>Use: <emphasis>smtp</emphasis></entry>
73232 <entry>Type: <emphasis>string</emphasis></entry>
73233 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
73234 </row>
73235 </tbody>
73236 </tgroup>
73237 </informaltable>
73238 <para>
73239 The domain(s) you want to sign with.
73240 After expansion, this can be a list.
73241 Each element in turn,
73242 lowercased,
73243 is put into the <option>$dkim_domain</option> expansion variable
73244 while expanding the remaining signing options.
73245 If it is empty after expansion, DKIM signing is not done,
73246 and no error will result even if <option>dkim_strict</option> is set.
73247 </para>
73248 <para>
73249 <indexterm role="option">
73250 <primary><option>unset</option></primary>
73251 </indexterm>
73252 </para>
73253 <informaltable frame="all">
73254 <tgroup cols="4" colsep="0" rowsep="0">
73255 <colspec colwidth="8*" align="left"/>
73256 <colspec colwidth="6*" align="center"/>
73257 <colspec colwidth="6*" align="center"/>
73258 <colspec colwidth="6*" align="right"/>
73259 <tbody>
73260 <row>
73261 <entry><option>dkim_selector</option></entry>
73262 <entry>Use: <emphasis>smtp</emphasis></entry>
73263 <entry>Type: <emphasis>string</emphasis></entry>
73264 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
73265 </row>
73266 </tbody>
73267 </tgroup>
73268 </informaltable>
73269 <para>
73270 This sets the key selector string.
73271 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
73272 Each element in turn is put in the expansion
73273 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
73274 option along with <option>$dkim_domain</option>.
73275 If the option is empty after expansion, DKIM signing is not done for this domain,
73276 and no error will result even if <option>dkim_strict</option> is set.
73277 </para>
73278 <para>
73279 <indexterm role="option">
73280 <primary><option>dkim_private_key</option></primary>
73281 </indexterm>
73282 </para>
73283 <informaltable frame="all">
73284 <tgroup cols="4" colsep="0" rowsep="0">
73285 <colspec colwidth="8*" align="left"/>
73286 <colspec colwidth="6*" align="center"/>
73287 <colspec colwidth="6*" align="center"/>
73288 <colspec colwidth="6*" align="right"/>
73289 <tbody>
73290 <row>
73291 <entry><option>dkim_private_key</option></entry>
73292 <entry>Use: <emphasis>smtp</emphasis></entry>
73293 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73294 <entry>Default: <emphasis>unset</emphasis></entry>
73295 </row>
73296 </tbody>
73297 </tgroup>
73298 </informaltable>
73299 <para>
73300 This sets the private key to use.
73301 You can use the <option>$dkim_domain</option> and
73302 <option>$dkim_selector</option> expansion variables to determine the private key to use.
73303 The result can either
73304 </para>
73305 <itemizedlist>
73306 <listitem>
73307 <para>
73308 be a valid RSA private key in ASCII armor (.pem file), including line breaks
73309 </para>
73310 </listitem>
73311 <listitem>
73312 <para>
73313 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
73314 be a valid Ed25519 private key (same format as above)
73315 </para>
73316 </listitem>
73317 <listitem>
73318 <para>
73319 start with a slash, in which case it is treated as a file that contains
73320 the private key
73321 </para>
73322 </listitem>
73323 <listitem>
73324 <para>
73325 be "0", "false" or the empty string, in which case the message will not
73326 be signed. This case will not result in an error, even if <option>dkim_strict</option>
73327 is set.
73328 </para>
73329 </listitem>
73330 </itemizedlist>
73331 <para>
73332 To generate keys under OpenSSL:
73333 </para>
73334 <literallayout class="monospaced">
73335 openssl genrsa -out dkim_rsa.private 2048
73336 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
73337 </literallayout>
73338 <para>
73339 The result file from the first command should be retained, and
73340 this option set to use it.
73341 Take the base-64 lines from the output of the second command, concatenated,
73342 for the DNS TXT record.
73343 See section 3.6 of RFC6376 for the record specification.
73344 </para>
73345 <para>
73346 Under GnuTLS:
73347 </para>
73348 <literallayout class="monospaced">
73349 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
73350 certtool --load-privkey=dkim_rsa.private --pubkey-info
73351 </literallayout>
73352 <para>
73353 Note that RFC 8301 says:
73354 </para>
73355 <literallayout class="monospaced">
73356 Signers MUST use RSA keys of at least 1024 bits for all keys.
73357 Signers SHOULD use RSA keys of at least 2048 bits.
73358 </literallayout>
73359 <para>
73360 EC keys for DKIM are defined by RFC 8463.
73361 They are considerably smaller than RSA keys for equivalent protection.
73362 As they are a recent development, users should consider dual-signing
73363 (by setting a list of selectors, and an expansion for this option)
73364 for some transition period.
73365 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
73366 for EC keys.
73367 </para>
73368 <para>
73369 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
73370 </para>
73371 <literallayout class="monospaced">
73372 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
73373 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
73374 </literallayout>
73375 <para>
73376 To produce the required public key value for a DNS record:
73377 </para>
73378 <literallayout class="monospaced">
73379 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
73380 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
73381 </literallayout>
73382 <para>
73383 Exim also supports an alternate format
73384 of Ed25519 keys in DNS which was a candidate during development
73385 of the standard, but not adopted.
73386 A future release will probably drop that support.
73387 </para>
73388 <para>
73389 <indexterm role="option">
73390 <primary><option>dkim_hash</option></primary>
73391 </indexterm>
73392 </para>
73393 <informaltable frame="all">
73394 <tgroup cols="4" colsep="0" rowsep="0">
73395 <colspec colwidth="8*" align="left"/>
73396 <colspec colwidth="6*" align="center"/>
73397 <colspec colwidth="6*" align="center"/>
73398 <colspec colwidth="6*" align="right"/>
73399 <tbody>
73400 <row>
73401 <entry><option>dkim_hash</option></entry>
73402 <entry>Use: <emphasis>smtp</emphasis></entry>
73403 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73404 <entry>Default: <emphasis>sha256</emphasis></entry>
73405 </row>
73406 </tbody>
73407 </tgroup>
73408 </informaltable>
73409 <para>
73410 Can be set to any one of the supported hash methods, which are:
73411 </para>
73412 <itemizedlist>
73413 <listitem>
73414 <para>
73415 <literal>sha1</literal> &ndash; should not be used, is old and insecure
73416 </para>
73417 </listitem>
73418 <listitem>
73419 <para>
73420 <literal>sha256</literal> &ndash; the default
73421 </para>
73422 </listitem>
73423 <listitem>
73424 <para>
73425 <literal>sha512</literal> &ndash; possibly more secure but less well supported
73426 </para>
73427 </listitem>
73428 </itemizedlist>
73429 <para>
73430 Note that RFC 8301 says:
73431 </para>
73432 <literallayout class="monospaced">
73433 rsa-sha1 MUST NOT be used for signing or verifying.
73434 </literallayout>
73435 <para>
73436 <indexterm role="option">
73437 <primary><option>dkim_identity</option></primary>
73438 </indexterm>
73439 </para>
73440 <informaltable frame="all">
73441 <tgroup cols="4" colsep="0" rowsep="0">
73442 <colspec colwidth="8*" align="left"/>
73443 <colspec colwidth="6*" align="center"/>
73444 <colspec colwidth="6*" align="center"/>
73445 <colspec colwidth="6*" align="right"/>
73446 <tbody>
73447 <row>
73448 <entry><option>dkim_identity</option></entry>
73449 <entry>Use: <emphasis>smtp</emphasis></entry>
73450 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73451 <entry>Default: <emphasis>unset</emphasis></entry>
73452 </row>
73453 </tbody>
73454 </tgroup>
73455 </informaltable>
73456 <para>
73457 If set after expansion, the value is used to set an "i=" tag in
73458 the signing header.  The DKIM standards restrict the permissible
73459 syntax of this optional tag to a mail address, with possibly-empty
73460 local part, an @, and a domain identical to or subdomain of the "d="
73461 tag value.  Note that Exim does not check the value.
73462 </para>
73463 <para>
73464 <indexterm role="option">
73465 <primary><option>dkim_canon</option></primary>
73466 </indexterm>
73467 </para>
73468 <informaltable frame="all">
73469 <tgroup cols="4" colsep="0" rowsep="0">
73470 <colspec colwidth="8*" align="left"/>
73471 <colspec colwidth="6*" align="center"/>
73472 <colspec colwidth="6*" align="center"/>
73473 <colspec colwidth="6*" align="right"/>
73474 <tbody>
73475 <row>
73476 <entry><option>dkim_canon</option></entry>
73477 <entry>Use: <emphasis>smtp</emphasis></entry>
73478 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73479 <entry>Default: <emphasis>unset</emphasis></entry>
73480 </row>
73481 </tbody>
73482 </tgroup>
73483 </informaltable>
73484 <para>
73485 This option sets the canonicalization method used when signing a message.
73486 The DKIM RFC currently supports two methods: "simple" and "relaxed".
73487 The option defaults to "relaxed" when unset. Note: the current implementation
73488 only supports signing with the same canonicalization method for both headers and body.
73489 </para>
73490 <para>
73491 <indexterm role="option">
73492 <primary><option>dkim_strict</option></primary>
73493 </indexterm>
73494 </para>
73495 <informaltable frame="all">
73496 <tgroup cols="4" colsep="0" rowsep="0">
73497 <colspec colwidth="8*" align="left"/>
73498 <colspec colwidth="6*" align="center"/>
73499 <colspec colwidth="6*" align="center"/>
73500 <colspec colwidth="6*" align="right"/>
73501 <tbody>
73502 <row>
73503 <entry><option>dkim_strict</option></entry>
73504 <entry>Use: <emphasis>smtp</emphasis></entry>
73505 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73506 <entry>Default: <emphasis>unset</emphasis></entry>
73507 </row>
73508 </tbody>
73509 </tgroup>
73510 </informaltable>
73511 <para>
73512 This  option  defines  how  Exim  behaves  when  signing a message that
73513 should be signed fails for some reason.  When the expansion evaluates to
73514 either <quote>1</quote> or <quote>true</quote>, Exim will defer. Otherwise Exim will send the message
73515 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
73516 variables here.
73517 </para>
73518 <para>
73519 <indexterm role="option">
73520 <primary><option>dkim_sign_headers</option></primary>
73521 </indexterm>
73522 </para>
73523 <informaltable frame="all">
73524 <tgroup cols="4" colsep="0" rowsep="0">
73525 <colspec colwidth="8*" align="left"/>
73526 <colspec colwidth="6*" align="center"/>
73527 <colspec colwidth="6*" align="center"/>
73528 <colspec colwidth="6*" align="right"/>
73529 <tbody>
73530 <row>
73531 <entry><option>dkim_sign_headers</option></entry>
73532 <entry>Use: <emphasis>smtp</emphasis></entry>
73533 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73534 <entry>Default: <emphasis>see below</emphasis></entry>
73535 </row>
73536 </tbody>
73537 </tgroup>
73538 </informaltable>
73539 <para>
73540 If set, this option must expand to a colon-separated
73541 list of header names.
73542 Headers with these names, or the absence or such a header, will be included
73543 in the message signature.
73544 When unspecified, the header names listed in RFC4871 will be used,
73545 whether or not each header is present in the message.
73546 The default list is available for the expansion in the macro
73547 <quote>_DKIM_SIGN_HEADERS</quote>
73548 </para>
73549 <para revisionflag="changed">
73550 and an oversigning variant is in <quote>_DKIM_OVERSIGN_HEADERS</quote>.
73551 </para>
73552 <para>
73553 If a name is repeated, multiple headers by that name (or the absence thereof)
73554 will be signed.  The textually later headers in the headers part of the
73555 message are signed first, if there are multiples.
73556 </para>
73557 <para>
73558 A name can be prefixed with either an <quote>=</quote> or a <quote>+</quote> character.
73559 If an <quote>=</quote> prefix is used, all headers that are present with this name
73560 will be signed.
73561 If a <quote>+</quote> prefix if used, all headers that are present with this name
73562 will be signed, and one signature added for a missing header with the
73563 name will be appended.
73564 </para>
73565 <para>
73566 <indexterm role="option">
73567 <primary><option>dkim_timestamps</option></primary>
73568 </indexterm>
73569 </para>
73570 <informaltable frame="all">
73571 <tgroup cols="4" colsep="0" rowsep="0">
73572 <colspec colwidth="8*" align="left"/>
73573 <colspec colwidth="6*" align="center"/>
73574 <colspec colwidth="6*" align="center"/>
73575 <colspec colwidth="6*" align="right"/>
73576 <tbody>
73577 <row>
73578 <entry><option>dkim_timestamps</option></entry>
73579 <entry>Use: <emphasis>smtp</emphasis></entry>
73580 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
73581 <entry>Default: <emphasis>unset</emphasis></entry>
73582 </row>
73583 </tbody>
73584 </tgroup>
73585 </informaltable>
73586 <para>
73587 This option controls the inclusion of timestamp information in the signature.
73588 If not set, no such information will be included.
73589 Otherwise, must be an unsigned number giving an offset in seconds from the current time
73590 for the expiry tag
73591 (eg. 1209600 for two weeks);
73592 both creation (t=) and expiry (x=) tags will be included.
73593 </para>
73594 <para>
73595 RFC 6376 lists these tags as RECOMMENDED.
73596 </para>
73597 </section>
73598 <section id="SECDKIMVFY">
73599 <title>Verifying DKIM signatures in incoming mail</title>
73600 <para>
73601 <indexterm role="concept">
73602 <primary>DKIM</primary>
73603 <secondary>verification</secondary>
73604 </indexterm>
73605 </para>
73606 <para>
73607 Verification of DKIM signatures in SMTP incoming email is done for all
73608 messages for which an ACL control <option>dkim_disable_verify</option> has not been set.
73609 <indexterm role="concept">
73610 <primary>DKIM</primary>
73611 <secondary>selecting signature algorithms</secondary>
73612 </indexterm>
73613 Individual classes of signature algorithm can be ignored by changing
73614 the main options <option>dkim_verify_hashes</option> or <option>dkim_verify_keytypes</option>.
73615 The <option>dkim_verify_minimal</option> option can be set to cease verification
73616 processing for a message once the first passing signature is found.
73617 </para>
73618 <para>
73619 <indexterm role="concept">
73620 <primary>authentication</primary>
73621 <secondary>expansion item</secondary>
73622 </indexterm>
73623 Performing verification sets up information used by the
73624 <option>authresults</option> expansion item.
73625 </para>
73626 <para>
73627 For most purposes the default option settings suffice and the remainder
73628 of this section can be ignored.
73629 </para>
73630 <para>
73631 The results of verification are made available to the
73632 <option>acl_smtp_dkim</option> ACL, which can examine and modify them.
73633 A missing ACL definition defaults to accept.
73634 By default, the ACL is called once for each
73635 syntactically(!) correct signature in the incoming message.
73636 If any ACL call does not accept, the message is not accepted.
73637 If a cutthrough delivery was in progress for the message, that is
73638 summarily dropped (having wasted the transmission effort).
73639 </para>
73640 <para>
73641 To evaluate the verification result in the ACL
73642 a large number of expansion variables
73643 containing the signature status and its details are set up during the
73644 runtime of the ACL.
73645 </para>
73646 <para>
73647 Calling the ACL only for existing signatures is not sufficient to build
73648 more advanced policies. For that reason, the main option
73649 <option>dkim_verify_signers</option>, and an expansion variable
73650 <option>$dkim_signers</option> exist.
73651 </para>
73652 <para>
73653 The main option <option>dkim_verify_signers</option> can be set to a colon-separated
73654 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
73655 called. It is expanded when the message has been received. At this point,
73656 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
73657 list of signer domains and identities for the message. When
73658 <option>dkim_verify_signers</option> is not specified in the main configuration,
73659 it defaults as:
73660 </para>
73661 <literallayout class="monospaced">
73662 dkim_verify_signers = $dkim_signers
73663 </literallayout>
73664 <para>
73665 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
73666 DKIM signature in the message. Current DKIM verifiers may want to explicitly
73667 call the ACL for known domains or identities. This would be achieved as follows:
73668 </para>
73669 <literallayout class="monospaced">
73670 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
73671 </literallayout>
73672 <para>
73673 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
73674 and "ebay.com", plus all domains and identities that have signatures in the message.
73675 You can also be more creative in constructing your policy. For example:
73676 </para>
73677 <literallayout class="monospaced">
73678 dkim_verify_signers = $sender_address_domain:$dkim_signers
73679 </literallayout>
73680 <para>
73681 If a domain or identity is listed several times in the (expanded) value of
73682 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
73683 </para>
73684 <para>
73685 Note that if the option is set using untrustworthy data
73686 (such as the From: header)
73687 care should be taken to force lowercase for domains
73688 and for the domain part if identities.
73689 The default setting can be regarded as trustworthy in this respect.
73690 </para>
73691 <para>
73692 If multiple signatures match a domain (or identity), the ACL is called once
73693 for each matching signature.
73694 </para>
73695 <para>
73696 Inside the DKIM ACL, the following expansion variables are
73697 available (from most to least important):
73698 </para>
73699 <variablelist>
73700 <varlistentry>
73701 <term><option>$dkim_cur_signer</option></term>
73702 <listitem>
73703 <para>
73704 The signer that is being evaluated in this ACL run. This can be a domain or
73705 an identity. This is one of the list items from the expanded main option
73706 <option>dkim_verify_signers</option> (see above).
73707 </para>
73708 </listitem></varlistentry>
73709 <varlistentry>
73710 <term><option>$dkim_verify_status</option></term>
73711 <listitem>
73712 <para>
73713 Within the DKIM ACL,
73714 a string describing the general status of the signature. One of
73715 </para>
73716 <itemizedlist>
73717 <listitem>
73718 <para>
73719 <option>none</option>: There is no signature in the message for the current domain or
73720 identity (as reflected by <option>$dkim_cur_signer</option>).
73721 </para>
73722 </listitem>
73723 <listitem>
73724 <para>
73725 <option>invalid</option>: The signature could not be verified due to a processing error.
73726 More detail is available in <option>$dkim_verify_reason</option>.
73727 </para>
73728 </listitem>
73729 <listitem>
73730 <para>
73731 <option>fail</option>: Verification of the signature failed.  More detail is
73732 available in <option>$dkim_verify_reason</option>.
73733 </para>
73734 </listitem>
73735 <listitem>
73736 <para>
73737 <option>pass</option>: The signature passed verification. It is valid.
73738 </para>
73739 </listitem>
73740 </itemizedlist>
73741 <para>
73742 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
73743 This might, for instance, be done to enforce a policy restriction on
73744 hash-method or key-size:
73745 </para>
73746 <literallayout class="monospaced">
73747   warn condition       = ${if eq {$dkim_verify_status}{pass}}
73748        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
73749        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
73750                                   {&lt; {$dkim_key_length}{1024}}}}
73751        logwrite        = NOTE: forcing DKIM verify fail (was pass)
73752        set dkim_verify_status = fail
73753        set dkim_verify_reason = hash too weak or key too short
73754 </literallayout>
73755 <para>
73756 So long as a DKIM ACL is defined (it need do no more than accept),
73757 after all the DKIM ACL runs have completed, the value becomes a
73758 colon-separated list of the values after each run.
73759 This is maintained for the mime, prdr and data ACLs.
73760 </para>
73761 </listitem></varlistentry>
73762 <varlistentry>
73763 <term><option>$dkim_verify_reason</option></term>
73764 <listitem>
73765 <para>
73766 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
73767 "fail" or "invalid". One of
73768 </para>
73769 <itemizedlist>
73770 <listitem>
73771 <para>
73772 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
73773 key for the domain could not be retrieved. This may be a temporary problem.
73774 </para>
73775 </listitem>
73776 <listitem>
73777 <para>
73778 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
73779 record for the domain is syntactically invalid.
73780 </para>
73781 </listitem>
73782 <listitem>
73783 <para>
73784 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
73785 body hash does not match the one specified in the signature header. This
73786 means that the message body was modified in transit.
73787 </para>
73788 </listitem>
73789 <listitem>
73790 <para>
73791 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
73792 could not be verified. This may mean that headers were modified,
73793 re-written or otherwise changed in a way which is incompatible with
73794 DKIM verification. It may of course also mean that the signature is forged.
73795 </para>
73796 </listitem>
73797 </itemizedlist>
73798 <para>
73799 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
73800 </para>
73801 </listitem></varlistentry>
73802 <varlistentry>
73803 <term><option>$dkim_domain</option></term>
73804 <listitem>
73805 <para>
73806 The signing domain. IMPORTANT: This variable is only populated if there is
73807 an actual signature in the message for the current domain or identity (as
73808 reflected by <option>$dkim_cur_signer</option>).
73809 </para>
73810 </listitem></varlistentry>
73811 <varlistentry>
73812 <term><option>$dkim_identity</option></term>
73813 <listitem>
73814 <para>
73815 The signing identity, if present. IMPORTANT: This variable is only populated
73816 if there is an actual signature in the message for the current domain or
73817 identity (as reflected by <option>$dkim_cur_signer</option>).
73818 </para>
73819 </listitem></varlistentry>
73820 <varlistentry>
73821 <term><option>$dkim_selector</option></term>
73822 <listitem>
73823 <para>
73824 The key record selector string.
73825 </para>
73826 </listitem></varlistentry>
73827 <varlistentry>
73828 <term><option>$dkim_algo</option></term>
73829 <listitem>
73830 <para>
73831 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
73832 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
73833 may also be &#x2019;ed25519-sha256&#x2019;.
73834 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
73835 for EC keys.
73836 </para>
73837 <para>
73838 Note that RFC 8301 says:
73839 </para>
73840 <literallayout class="monospaced">
73841 rsa-sha1 MUST NOT be used for signing or verifying.
73842
73843 DKIM signatures identified as having been signed with historic
73844 algorithms (currently, rsa-sha1) have permanently failed evaluation
73845 </literallayout>
73846 <para>
73847 To enforce this you must either have a DKIM ACL which checks this variable
73848 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above,
73849 or have set the main option <option>dkim_verify_hashes</option> to exclude
73850 processing of such signatures.
73851 </para>
73852 </listitem></varlistentry>
73853 <varlistentry>
73854 <term><option>$dkim_canon_body</option></term>
73855 <listitem>
73856 <para>
73857 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
73858 </para>
73859 </listitem></varlistentry>
73860 <varlistentry>
73861 <term><option>$dkim_canon_headers</option></term>
73862 <listitem>
73863 <para>
73864 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
73865 </para>
73866 </listitem></varlistentry>
73867 <varlistentry>
73868 <term><option>$dkim_copiedheaders</option></term>
73869 <listitem>
73870 <para>
73871 A transcript of headers and their values which are included in the signature
73872 (copied from the &#x2019;z=&#x2019; tag of the signature).
73873 Note that RFC6376 requires that verification fail if the From: header is
73874 not included in the signature.  Exim does not enforce this; sites wishing
73875 strict enforcement should code the check explicitly.
73876 </para>
73877 </listitem></varlistentry>
73878 <varlistentry>
73879 <term><option>$dkim_bodylength</option></term>
73880 <listitem>
73881 <para>
73882 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
73883 limit was set by the signer, "9999999999999" is returned. This makes sure
73884 that this variable always expands to an integer value.
73885 <emphasis role="bold">Note:</emphasis> The presence of the signature tag specifying a signing body length
73886 is one possible route to spoofing of valid DKIM signatures.
73887 A paranoid implementation might wish to regard signature where this variable
73888 shows less than the "no limit" return as being invalid.
73889 </para>
73890 </listitem></varlistentry>
73891 <varlistentry>
73892 <term><option>$dkim_created</option></term>
73893 <listitem>
73894 <para>
73895 UNIX timestamp reflecting the date and time when the signature was created.
73896 When this was not specified by the signer, "0" is returned.
73897 </para>
73898 </listitem></varlistentry>
73899 <varlistentry>
73900 <term><option>$dkim_expires</option></term>
73901 <listitem>
73902 <para>
73903 UNIX timestamp reflecting the date and time when the signer wants the
73904 signature to be treated as "expired". When this was not specified by the
73905 signer, "9999999999999" is returned. This makes it possible to do useful
73906 integer size comparisons against this value.
73907 Note that Exim does not check this value.
73908 </para>
73909 </listitem></varlistentry>
73910 <varlistentry>
73911 <term><option>$dkim_headernames</option></term>
73912 <listitem>
73913 <para>
73914 A colon-separated list of names of headers included in the signature.
73915 </para>
73916 </listitem></varlistentry>
73917 <varlistentry>
73918 <term><option>$dkim_key_testing</option></term>
73919 <listitem>
73920 <para>
73921 "1" if the key record has the "testing" flag set, "0" if not.
73922 </para>
73923 </listitem></varlistentry>
73924 <varlistentry>
73925 <term><option>$dkim_key_nosubdomains</option></term>
73926 <listitem>
73927 <para>
73928 "1" if the key record forbids subdomaining, "0" otherwise.
73929 </para>
73930 </listitem></varlistentry>
73931 <varlistentry>
73932 <term><option>$dkim_key_srvtype</option></term>
73933 <listitem>
73934 <para>
73935 Service type (tag s=) from the key record. Defaults to "*" if not specified
73936 in the key record.
73937 </para>
73938 </listitem></varlistentry>
73939 <varlistentry>
73940 <term><option>$dkim_key_granularity</option></term>
73941 <listitem>
73942 <para>
73943 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
73944 in the key record.
73945 </para>
73946 </listitem></varlistentry>
73947 <varlistentry>
73948 <term><option>$dkim_key_notes</option></term>
73949 <listitem>
73950 <para>
73951 Notes from the key record (tag n=).
73952 </para>
73953 </listitem></varlistentry>
73954 <varlistentry>
73955 <term><option>$dkim_key_length</option></term>
73956 <listitem>
73957 <para>
73958 Number of bits in the key.
73959 </para>
73960 <para revisionflag="changed">
73961 Valid only once the key is loaded, which is at the time the header signature
73962 is verified, which is after the body hash is.
73963 </para>
73964 <para>
73965 Note that RFC 8301 says:
73966 </para>
73967 <literallayout class="monospaced">
73968 Verifiers MUST NOT consider signatures using RSA keys of
73969 less than 1024 bits as valid signatures.
73970 </literallayout>
73971 <para>
73972 This is enforced by the default setting for the <option>dkim_verify_min_keysizes</option>
73973 option.
73974 </para>
73975 </listitem></varlistentry>
73976 </variablelist>
73977 <para>
73978 In addition, two ACL conditions are provided:
73979 </para>
73980 <variablelist>
73981 <varlistentry>
73982 <term><option>dkim_signers</option></term>
73983 <listitem>
73984 <para>
73985 ACL condition that checks a colon-separated list of domains or identities
73986 for a match against the domain or identity that the ACL is currently verifying
73987 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
73988 verb to a group of domains or identities. For example:
73989 </para>
73990 <literallayout class="monospaced">
73991 # Warn when Mail purportedly from GMail has no gmail signature
73992 warn sender_domains = gmail.com
73993      dkim_signers = gmail.com
73994      dkim_status = none
73995      log_message = GMail sender without gmail.com DKIM signature
73996 </literallayout>
73997 <para>
73998 Note that the above does not check for a total lack of DKIM signing;
73999 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
74000 </para>
74001 </listitem></varlistentry>
74002 <varlistentry>
74003 <term><option>dkim_status</option></term>
74004 <listitem>
74005 <para>
74006 ACL condition that checks a colon-separated list of possible DKIM verification
74007 results against the actual result of verification. This is typically used
74008 to restrict an ACL verb to a list of verification outcomes, for example:
74009 </para>
74010 <literallayout class="monospaced">
74011 deny sender_domains = paypal.com:paypal.de
74012      dkim_signers = paypal.com:paypal.de
74013      dkim_status = none:invalid:fail
74014      message = Mail from Paypal with invalid/missing signature
74015 </literallayout>
74016 <para>
74017 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
74018 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
74019 for more information of what they mean.
74020 </para>
74021 </listitem></varlistentry>
74022 </variablelist>
74023 </section>
74024 <section id="SECSPF">
74025 <title>SPF (Sender Policy Framework)</title>
74026 <para>
74027 <indexterm role="concept">
74028 <primary>SPF</primary>
74029 <secondary>verification</secondary>
74030 </indexterm>
74031 </para>
74032 <para>
74033 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
74034 messages with its domain in the envelope from, documented by RFC 7208.
74035 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
74036 the <emphasis role="bold"><ulink url="http://openspf.org">http://openspf.org</ulink></emphasis>.
74037 </para>
74038 <para>
74039 Messages sent by a system not authorised will fail checking of such assertions.
74040 This includes retransmissions done by traditional forwarders.
74041 </para>
74042 <para>
74043 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
74044 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
74045 <emphasis role="bold"><ulink url="https://www.libspf2.org/">https://www.libspf2.org/</ulink></emphasis>.
74046 There is no Exim involvement in the transmission of messages;
74047 publishing certain DNS records is all that is required.
74048 </para>
74049 <para>
74050 For verification, an ACL condition and an expansion lookup are provided.
74051 <indexterm role="concept">
74052 <primary>authentication</primary>
74053 <secondary>expansion item</secondary>
74054 </indexterm>
74055 Performing verification sets up information used by the
74056 <option>authresults</option> expansion item.
74057 </para>
74058 <para>
74059 <indexterm role="concept">
74060 <primary>SPF</primary>
74061 <secondary>ACL condition</secondary>
74062 </indexterm>
74063 <indexterm role="concept">
74064 <primary>ACL</primary>
74065 <secondary>spf condition</secondary>
74066 </indexterm>
74067 The ACL condition "spf" can be used at or after the MAIL ACL.
74068 It takes as an argument a list of strings giving the outcome of the SPF check,
74069 and will succeed for any matching outcome.
74070 Valid strings are:
74071 </para>
74072 <variablelist>
74073 <varlistentry>
74074 <term><option>pass</option></term>
74075 <listitem>
74076 <para>
74077 The SPF check passed, the sending host is positively verified by SPF.
74078 </para>
74079 </listitem></varlistentry>
74080 <varlistentry>
74081 <term><option>fail</option></term>
74082 <listitem>
74083 <para>
74084 The SPF check failed, the sending host is NOT allowed to send mail for the
74085 domain in the envelope-from address.
74086 </para>
74087 </listitem></varlistentry>
74088 <varlistentry>
74089 <term><option>softfail</option></term>
74090 <listitem>
74091 <para>
74092 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
74093 is a forgery.
74094 </para>
74095 </listitem></varlistentry>
74096 <varlistentry>
74097 <term><option>none</option></term>
74098 <listitem>
74099 <para>
74100 The queried domain does not publish SPF records.
74101 </para>
74102 </listitem></varlistentry>
74103 <varlistentry>
74104 <term><option>neutral</option></term>
74105 <listitem>
74106 <para>
74107 The SPF check returned a "neutral" state.  This means the queried domain has
74108 published a SPF record, but wants to allow outside servers to send mail under
74109 its domain as well.  This should be treated like "none".
74110 </para>
74111 </listitem></varlistentry>
74112 <varlistentry>
74113 <term><option>permerror</option></term>
74114 <listitem>
74115 <para>
74116 This indicates a syntax error in the SPF record of the queried domain.
74117 You may deny messages when this occurs.
74118 </para>
74119 </listitem></varlistentry>
74120 <varlistentry>
74121 <term><option>temperror</option></term>
74122 <listitem>
74123 <para>
74124 This indicates a temporary error during all processing, including Exim&#x2019;s
74125 SPF processing.  You may defer messages when this occurs.
74126 </para>
74127 </listitem></varlistentry>
74128 </variablelist>
74129 <para>
74130 You can prefix each string with an exclamation mark to  invert
74131 its meaning,  for example  "!fail" will  match all  results but
74132 "fail".  The  string  list is  evaluated  left-to-right,  in a
74133 short-circuit fashion.
74134 </para>
74135 <para>
74136 Example:
74137 </para>
74138 <literallayout class="monospaced">
74139 deny spf = fail
74140      message = $sender_host_address is not allowed to send mail from \
74141                ${if def:sender_address_domain \
74142                     {$sender_address_domain}{$sender_helo_name}}.  \
74143                Please see http://www.open-spf.org/Why;\
74144                identity=${if def:sender_address_domain \
74145                              {$sender_address}{$sender_helo_name}};\
74146                ip=$sender_host_address
74147 </literallayout>
74148 <para>
74149 Note: The above mentioned URL may not be as helpful as expected. You are
74150 encouraged to replace the link with a link to a site with more
74151 explanations.
74152 </para>
74153 <para>
74154 When the spf condition has run, it sets up several expansion
74155 variables:
74156 </para>
74157 <para>
74158 <indexterm role="concept">
74159 <primary>SPF</primary>
74160 <secondary>verification variables</secondary>
74161 </indexterm>
74162 </para>
74163 <variablelist>
74164 <varlistentry>
74165 <term><varname>$spf_header_comment</varname></term>
74166 <listitem>
74167 <para>
74168 <indexterm role="variable">
74169 <primary><varname>$spf_header_comment</varname></primary>
74170 </indexterm>
74171   This contains a human-readable string describing the outcome
74172   of the SPF check. You can add it to a custom header or use
74173   it for logging purposes.
74174 </para>
74175 </listitem></varlistentry>
74176 <varlistentry>
74177 <term><varname>$spf_received</varname></term>
74178 <listitem>
74179 <para>
74180 <indexterm role="variable">
74181 <primary><varname>$spf_received</varname></primary>
74182 </indexterm>
74183   This contains a complete Received-SPF: header that can be
74184   added to the message. Please note that according to the SPF
74185   draft, this header must be added at the top of the header
74186   list. Please see section 10 on how you can do this.
74187 </para>
74188 <para>
74189   Note: in case of "Best-guess" (see below), the convention is
74190   to put this string in a header called X-SPF-Guess: instead.
74191 </para>
74192 </listitem></varlistentry>
74193 <varlistentry>
74194 <term><varname>$spf_result</varname></term>
74195 <listitem>
74196 <para>
74197 <indexterm role="variable">
74198 <primary><varname>$spf_result</varname></primary>
74199 </indexterm>
74200   This contains the outcome of the SPF check in string form,
74201   one of pass, fail, softfail, none, neutral, permerror or
74202   temperror.
74203 </para>
74204 </listitem></varlistentry>
74205 <varlistentry>
74206 <term><varname>$spf_result_guessed</varname></term>
74207 <listitem>
74208 <para>
74209 <indexterm role="variable">
74210 <primary><varname>$spf_result_guessed</varname></primary>
74211 </indexterm>
74212   This boolean is true only if a best-guess operation was used
74213   and required in order to obtain a result.
74214 </para>
74215 </listitem></varlistentry>
74216 <varlistentry>
74217 <term><varname>$spf_smtp_comment</varname></term>
74218 <listitem>
74219 <para>
74220 <indexterm role="variable">
74221 <primary><varname>$spf_smtp_comment</varname></primary>
74222 </indexterm>
74223 <indexterm role="variable">
74224 <primary><option>spf_smtp_comment_template</option></primary>
74225 </indexterm>
74226   This contains a string that can be used in a SMTP response
74227   to the calling party. Useful for "fail".
74228 </para>
74229 <para revisionflag="changed">
74230   The string is generated by the SPF library from the template configured in the main config
74231   option <option>spf_smtp_comment_template</option>.
74232 </para>
74233 </listitem></varlistentry>
74234 </variablelist>
74235 <para>
74236 <indexterm role="concept">
74237 <primary>SPF</primary>
74238 <secondary>ACL condition</secondary>
74239 </indexterm>
74240 <indexterm role="concept">
74241 <primary>ACL</primary>
74242 <secondary>spf_guess condition</secondary>
74243 </indexterm>
74244 <indexterm role="concept">
74245 <primary>SPF</primary>
74246 <secondary>best guess</secondary>
74247 </indexterm>
74248 In addition to SPF, you can also perform checks for so-called
74249 "Best-guess".  Strictly speaking, "Best-guess" is not standard
74250 SPF, but it is supported by the same framework that enables SPF
74251 capability.
74252 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>
74253 for a description of what it means.
74254 </para>
74255 <para>
74256 To access this feature, simply use the spf_guess condition in place
74257 of the spf one.  For example:
74258 </para>
74259 <literallayout class="monospaced">
74260 deny spf_guess = fail
74261      message = $sender_host_address doesn't look trustworthy to me
74262 </literallayout>
74263 <para>
74264 In case you decide to reject messages based on this check, you
74265 should note that although it uses the same framework, "Best-guess"
74266 is not SPF, and therefore you should not mention SPF at all in your
74267 reject message.
74268 </para>
74269 <para>
74270 When the spf_guess condition has run, it sets up the same expansion
74271 variables as when spf condition is run, described above.
74272 </para>
74273 <para>
74274 Additionally, since Best-guess is not standardized, you may redefine
74275 what "Best-guess" means to you by redefining the main configuration
74276 <option>spf_guess</option> option.
74277 For example, the following:
74278 </para>
74279 <literallayout class="monospaced">
74280 spf_guess = v=spf1 a/16 mx/16 ptr ?all
74281 </literallayout>
74282 <para>
74283 would relax host matching rules to a broader network range.
74284 </para>
74285 <para>
74286 <indexterm role="concept">
74287 <primary>SPF</primary>
74288 <secondary>lookup expansion</secondary>
74289 </indexterm>
74290 <indexterm role="concept">
74291 <primary>lookup</primary>
74292 <secondary>spf</secondary>
74293 </indexterm>
74294 A lookup expansion is also available. It takes an email
74295 address as the key and an IP address
74296 (v4 or v6)
74297 as the database:
74298 </para>
74299 <literallayout class="monospaced">
74300   ${lookup {username@domain} spf {ip.ip.ip.ip}}
74301 </literallayout>
74302 <para>
74303 The lookup will return the same result strings as can appear in
74304 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
74305 </para>
74306 </section>
74307 <section id="SECDMARC">
74308 <title>DMARC</title>
74309 <para>
74310 <indexterm role="concept">
74311 <primary>DMARC</primary>
74312 <secondary>verification</secondary>
74313 </indexterm>
74314 </para>
74315 <para>
74316 DMARC combines feedback from SPF, DKIM, and header From: in order
74317 to attempt to provide better indicators of the authenticity of an
74318 email.  This document does not explain the fundamentals; you
74319 should read and understand how it works by visiting the website at
74320 <emphasis role="bold"><ulink url="http://www.dmarc.org/">http://www.dmarc.org/</ulink></emphasis>.
74321 </para>
74322 <para>
74323 If Exim is built with DMARC support,
74324 the libopendmarc library is used.
74325 </para>
74326 <para>
74327 For building Exim yourself, obtain the library from
74328 <emphasis role="bold"><ulink url="http://sourceforge.net/projects/opendmarc/">http://sourceforge.net/projects/opendmarc/</ulink></emphasis>
74329 to obtain a copy, or find it in your favorite package
74330 repository.  You will need to attend to the local/Makefile feature
74331 SUPPORT_DMARC and the associated LDFLAGS addition.
74332 This description assumes
74333 that headers will be in /usr/local/include, and that the libraries
74334 are in /usr/local/lib.
74335 </para>
74336 <para>
74337 There are three main-configuration options:
74338 <indexterm role="concept">
74339 <primary>DMARC</primary>
74340 <secondary>configuration options</secondary>
74341 </indexterm>
74342 </para>
74343 <para>
74344 The <option>dmarc_tld_file</option> option
74345 <indexterm role="option">
74346 <primary><option>dmarc_tld_file</option></primary>
74347 </indexterm>
74348 defines the location of a text file of valid
74349 top level domains the opendmarc library uses
74350 during domain parsing. Maintained by Mozilla,
74351 the most current version can be downloaded
74352 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>.
74353 See also the util/renew-opendmarc-tlds.sh script.
74354 </para>
74355 <para revisionflag="changed">
74356 The default for the option is unset.
74357 If not set, DMARC processing is disabled.
74358 </para>
74359 <para>
74360 The <option>dmarc_history_file</option> option, if set
74361 <indexterm role="option">
74362 <primary><option>dmarc_history_file</option></primary>
74363 </indexterm>
74364 defines the location of a file to log results
74365 of dmarc verification on inbound emails. The
74366 contents are importable by the opendmarc tools
74367 which will manage the data, send out DMARC
74368 reports, and expire the data. Make sure the
74369 directory of this file is writable by the user
74370 exim runs as.
74371 The default is unset.
74372 </para>
74373 <para>
74374 The <option>dmarc_forensic_sender</option> option
74375 <indexterm role="option">
74376 <primary><option>dmarc_forensic_sender</option></primary>
74377 </indexterm>
74378 defines an alternate email address to use when sending a
74379 forensic report detailing alignment failures
74380 if a sender domain&#x2019;s dmarc record specifies it
74381 and you have configured Exim to send them.
74382 If set, this is expanded and used for the
74383 From: header line; the address is extracted
74384 from it and used for the envelope from.
74385 If not set (the default), the From: header is expanded from
74386 the dsn_from option, and &lt;&gt; is used for the
74387 envelope from.
74388 </para>
74389 <para>
74390 <indexterm role="concept">
74391 <primary>DMARC</primary>
74392 <secondary>controls</secondary>
74393 </indexterm>
74394 By default, the DMARC processing will run for any remote,
74395 non-authenticated user.  It makes sense to only verify DMARC
74396 status of messages coming from remote, untrusted sources.  You can
74397 use standard conditions such as hosts, senders, etc, to decide that
74398 DMARC verification should *not* be performed for them and disable
74399 DMARC with an ACL control modifier:
74400 </para>
74401 <literallayout class="monospaced">
74402   control = dmarc_disable_verify
74403 </literallayout>
74404 <para>
74405 A DMARC record can also specify a "forensic address", which gives
74406 exim an email address to submit reports about failed alignment.
74407 Exim does not do this by default because in certain conditions it
74408 results in unintended information leakage (what lists a user might
74409 be subscribed to, etc).  You must configure exim to submit forensic
74410 reports to the owner of the domain.  If the DMARC record contains a
74411 forensic address and you specify the control statement below, then
74412 exim will send these forensic emails.  It is also advised that you
74413 configure a <option>dmarc_forensic_sender</option> because the default sender address
74414 construction might be inadequate.
74415 </para>
74416 <literallayout class="monospaced">
74417   control = dmarc_enable_forensic
74418 </literallayout>
74419 <para>
74420 (AGAIN: You can choose not to send these forensic reports by simply
74421 not putting the dmarc_enable_forensic control line at any point in
74422 your exim config.  If you don&#x2019;t tell exim to send them, it will not
74423 send them.)
74424 </para>
74425 <para>
74426 There are no options to either control.  Both must appear before
74427 the DATA acl.
74428 </para>
74429 <para>
74430 DMARC checks cam be run on incoming SMTP  messages by using the
74431 <quote>dmarc_status</quote> ACL condition in the DATA ACL.  You are required to
74432 call the <quote>spf</quote> condition first in the ACLs, then the <quote>dmarc_status</quote>
74433 condition.  Putting this condition in the ACLs is required in order
74434 for a DMARC check to actually occur.  All of the variables are set
74435 up before the DATA ACL, but there is no actual DMARC check that
74436 occurs until a <quote>dmarc_status</quote> condition is encountered in the ACLs.
74437 </para>
74438 <para>
74439 The <quote>dmarc_status</quote> condition takes a list of strings on its
74440 right-hand side.  These strings describe recommended action based
74441 on the DMARC check.  To understand what the policy recommendations
74442 mean, refer to the DMARC website above.  Valid strings are:
74443 </para>
74444 <literallayout>
74445 <emphasis>accept      </emphasis> The DMARC check passed and the library recommends accepting the email.
74446 <emphasis>reject      </emphasis> The DMARC check failed and the library recommends rejecting the email.
74447 <emphasis>quarantine  </emphasis> The DMARC check failed and the library recommends keeping it for further inspection.
74448 <emphasis>none        </emphasis> The DMARC check passed and the library recommends no specific action, neutral.
74449 <emphasis>norecord    </emphasis> No policy section in the DMARC record for this sender domain.
74450 <emphasis>nofrom      </emphasis> Unable to determine the domain of the sender.
74451 <emphasis>temperror   </emphasis> Library error or dns error.
74452 <emphasis>off         </emphasis> The DMARC check was disabled for this email.
74453 </literallayout>
74454 <para>
74455 You can prefix each string with an exclamation mark to invert its
74456 meaning, for example "!accept" will match all results but
74457 "accept".  The string list is evaluated left-to-right in a
74458 short-circuit fashion.  When a string matches the outcome of the
74459 DMARC check, the condition succeeds.  If none of the listed
74460 strings matches the outcome of the DMARC check, the condition
74461 fails.
74462 </para>
74463 <para>
74464 Of course, you can also use any other lookup method that Exim
74465 supports, including LDAP, Postgres, MySQL, etc, as long as the
74466 result is a list of colon-separated strings.
74467 </para>
74468 <para>
74469 Performing the check sets up information used by the
74470 <option>authresults</option> expansion item.
74471 </para>
74472 <para>
74473 Several expansion variables are set before the DATA ACL is
74474 processed, and you can use them in this ACL.  The following
74475 expansion variables are available:
74476 </para>
74477 <variablelist>
74478 <varlistentry>
74479 <term><varname>$dmarc_status</varname></term>
74480 <listitem>
74481 <para>
74482 <indexterm role="variable">
74483 <primary><varname>$dmarc_status</varname></primary>
74484 </indexterm>
74485 <indexterm role="concept">
74486 <primary>DMARC</primary>
74487 <secondary>result</secondary>
74488 </indexterm>
74489 A one word status indicating what the DMARC library
74490 thinks of the email.  It is a combination of the results of
74491 DMARC record lookup and the SPF/DKIM/DMARC processing results
74492 (if a DMARC record was found).  The actual policy declared
74493 in the DMARC record is in a separate expansion variable.
74494 </para>
74495 </listitem></varlistentry>
74496 <varlistentry>
74497 <term><varname>$dmarc_status_text</varname></term>
74498 <listitem>
74499 <para>
74500 <indexterm role="variable">
74501 <primary><varname>$dmarc_status_text</varname></primary>
74502 </indexterm>
74503 Slightly longer, human readable status.
74504 </para>
74505 </listitem></varlistentry>
74506 <varlistentry>
74507 <term><varname>$dmarc_used_domain</varname></term>
74508 <listitem>
74509 <para>
74510 <indexterm role="variable">
74511 <primary><varname>$dmarc_used_domain</varname></primary>
74512 </indexterm>
74513 The domain which DMARC used to look up the DMARC policy record.
74514 </para>
74515 </listitem></varlistentry>
74516 <varlistentry>
74517 <term><varname>$dmarc_domain_policy</varname></term>
74518 <listitem>
74519 <para>
74520 <indexterm role="variable">
74521 <primary><varname>$dmarc_domain_policy</varname></primary>
74522 </indexterm>
74523 The policy declared in the DMARC record.  Valid values
74524 are "none", "reject" and "quarantine".  It is blank when there
74525 is any error, including no DMARC record.
74526 </para>
74527 </listitem></varlistentry>
74528 </variablelist>
74529 <para>
74530 By default, Exim&#x2019;s DMARC configuration is intended to be
74531 non-intrusive and conservative.  To facilitate this, Exim will not
74532 create any type of logging files without explicit configuration by
74533 you, the admin.  Nor will Exim send out any emails/reports about
74534 DMARC issues without explicit configuration by you, the admin (other
74535 than typical bounce messages that may come about due to ACL
74536 processing or failure delivery issues).
74537 </para>
74538 <para>
74539 In order to log statistics suitable to be imported by the opendmarc
74540 tools, you need to:
74541 </para>
74542 <itemizedlist>
74543 <listitem>
74544 <para>
74545 Configure the global option <option>dmarc_history_file</option>
74546 </para>
74547 </listitem>
74548 <listitem>
74549 <para>
74550 Configure cron jobs to call the appropriate opendmarc history
74551 import scripts and truncating the dmarc_history_file
74552 </para>
74553 </listitem>
74554 </itemizedlist>
74555 <para>
74556 In order to send forensic reports, you need to:
74557 </para>
74558 <itemizedlist>
74559 <listitem>
74560 <para>
74561 Configure the global option <option>dmarc_forensic_sender</option>
74562 </para>
74563 </listitem>
74564 <listitem>
74565 <para>
74566 Configure, somewhere before the DATA ACL, the control option to
74567 enable sending DMARC forensic reports
74568 </para>
74569 </listitem>
74570 </itemizedlist>
74571 <para>
74572 Example usage:
74573 </para>
74574 <literallayout class="monospaced">
74575 (RCPT ACL)
74576   warn    domains        = +local_domains
74577           hosts          = +local_hosts
74578           control        = dmarc_disable_verify
74579
74580   warn    !domains       = +screwed_up_dmarc_records
74581           control        = dmarc_enable_forensic
74582
74583   warn    condition      = (lookup if destined to mailing list)
74584           set acl_m_mailing_list = 1
74585
74586 (DATA ACL)
74587   warn    dmarc_status   = accept : none : off
74588           !authenticated = *
74589           log_message    = DMARC DEBUG: $dmarc_status $dmarc_used_domain
74590
74591   warn    dmarc_status   = !accept
74592           !authenticated = *
74593           log_message    = DMARC DEBUG: '$dmarc_status' for $dmarc_used_domain
74594
74595   warn    dmarc_status   = quarantine
74596           !authenticated = *
74597           set $acl_m_quarantine = 1
74598           # Do something in a transport with this flag variable
74599
74600   deny    condition      = ${if eq{$dmarc_domain_policy}{reject}}
74601           condition      = ${if eq{$acl_m_mailing_list}{1}}
74602           message        = Messages from $dmarc_used_domain break mailing lists
74603
74604   deny    dmarc_status   = reject
74605           !authenticated = *
74606           message        = Message from $dmarc_used_domain failed sender's DMARC policy, REJECT
74607
74608   warn    add_header     = :at_start:${authresults {$primary_hostname}}
74609 </literallayout>
74610 </section>
74611 </chapter>
74612
74613 <chapter id="CHAPproxies">
74614 <title>Proxies</title>
74615 <titleabbrev>Proxy support</titleabbrev>
74616 <para>
74617 <indexterm role="concept">
74618 <primary>proxy support</primary>
74619 </indexterm>
74620 <indexterm role="concept">
74621 <primary>proxy</primary>
74622 <secondary>access via</secondary>
74623 </indexterm>
74624 </para>
74625 <para>
74626 A proxy is an intermediate system through which communication is passed.
74627 Proxies may provide a security, availability or load-distribution function.
74628 </para>
74629 <section id="SECTproxyInbound">
74630 <title>Inbound proxies</title>
74631 <para>
74632 <indexterm role="concept">
74633 <primary>proxy</primary>
74634 <secondary>inbound</secondary>
74635 </indexterm>
74636 <indexterm role="concept">
74637 <primary>proxy</primary>
74638 <secondary>server side</secondary>
74639 </indexterm>
74640 <indexterm role="concept">
74641 <primary>proxy</primary>
74642 <secondary>Proxy protocol</secondary>
74643 </indexterm>
74644 <indexterm role="concept">
74645 <primary>Proxy protocol</primary>
74646 <secondary>proxy</secondary>
74647 </indexterm>
74648 </para>
74649 <para>
74650 Exim has support for receiving inbound SMTP connections via a proxy
74651 that uses <quote>Proxy Protocol</quote> to speak to it.
74652 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
74653 in Local/Makefile.
74654 </para>
74655 <para>
74656 It was built on the HAProxy specification, found at
74657 <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>.
74658 </para>
74659 <para>
74660 The purpose of this facility is so that an application load balancer,
74661 such as HAProxy, can sit in front of several Exim servers
74662 to distribute load.
74663 Exim uses the local protocol communication with the proxy to obtain
74664 the remote SMTP system IP address and port information.
74665 There is no logging if a host passes or
74666 fails Proxy Protocol negotiation, but it can easily be determined and
74667 recorded in an ACL (example is below).
74668 </para>
74669 <para>
74670 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
74671 main configuration option to a hostlist; connections from these
74672 hosts will use Proxy Protocol.
74673 Exim supports both version 1 and version 2 of the Proxy Protocol and
74674 automatically determines which version is in use.
74675 </para>
74676 <para>
74677 The Proxy Protocol header is the first data received on a TCP connection
74678 and is inserted before any TLS-on-connect handshake from the client; Exim
74679 negotiates TLS between Exim-as-server and the remote client, not between
74680 Exim and the proxy server.
74681 </para>
74682 <para>
74683 The following expansion variables are usable
74684 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
74685 of the proxy):
74686 </para>
74687 <literallayout>
74688 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
74689 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
74690 <emphasis>proxy_local_address      </emphasis> IP of proxy server inbound or IP of local interface of proxy
74691 <emphasis>proxy_local_port         </emphasis> Port of proxy server inbound or Port on local interface of proxy
74692 <emphasis>proxy_session            </emphasis> boolean: SMTP connection via proxy
74693 </literallayout>
74694 <para>
74695 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
74696 there was a protocol error.
74697 The variables <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>
74698 will have values for the actual client system, not the proxy.
74699 </para>
74700 <para>
74701 Since the real connections are all coming from the proxy, and the
74702 per host connection tracking is done before Proxy Protocol is
74703 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
74704 handle all of the parallel volume you expect per inbound proxy.
74705 With the option set so high, you lose the ability
74706 to protect your server from many connections from one IP.
74707 In order to prevent your server from overload, you
74708 need to add a per connection ratelimit to your connect ACL.
74709 A possible solution is:
74710 </para>
74711 <literallayout>
74712   # Set max number of connections per host
74713   LIMIT   = 5
74714   # Or do some kind of IP lookup in a flat file or database
74715   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
74716
74717   defer   ratelimit      = LIMIT / 5s / per_conn / strict
74718           message        = Too many connections from this IP right now
74719 </literallayout>
74720 </section>
74721 <section id="SECTproxySOCKS">
74722 <title>Outbound proxies</title>
74723 <para>
74724 <indexterm role="concept">
74725 <primary>proxy</primary>
74726 <secondary>outbound</secondary>
74727 </indexterm>
74728 <indexterm role="concept">
74729 <primary>proxy</primary>
74730 <secondary>client side</secondary>
74731 </indexterm>
74732 <indexterm role="concept">
74733 <primary>proxy</primary>
74734 <secondary>SOCKS</secondary>
74735 </indexterm>
74736 <indexterm role="concept">
74737 <primary>SOCKS</primary>
74738 <secondary>proxy</secondary>
74739 </indexterm>
74740 Exim has support for sending outbound SMTP via a proxy
74741 using a protocol called SOCKS5 (defined by RFC1928).
74742 The support can be optionally included by defining SUPPORT_SOCKS=yes in
74743 Local/Makefile.
74744 </para>
74745 <para>
74746 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
74747 on an smtp transport.
74748 The option value is expanded and should then be a list
74749 (colon-separated by default) of proxy specifiers.
74750 Each proxy specifier is a list
74751 (space-separated by default) where the initial element
74752 is an IP address and any subsequent elements are options.
74753 </para>
74754 <para>
74755 Options are a string &lt;name&gt;=&lt;value&gt;.
74756 The list of options is in the following table:
74757 </para>
74758 <literallayout>
74759 <emphasis>auth   </emphasis> authentication method
74760 <emphasis>name   </emphasis> authentication username
74761 <emphasis>pass   </emphasis> authentication password
74762 <emphasis>port   </emphasis> tcp port
74763 <emphasis>tmo    </emphasis> connection timeout
74764 <emphasis>pri    </emphasis> priority
74765 <emphasis>weight </emphasis> selection bias
74766 </literallayout>
74767 <para>
74768 More details on each of these options follows:
74769 </para>
74770 <itemizedlist>
74771 <listitem>
74772 <para>
74773 <indexterm role="concept">
74774 <primary>authentication</primary>
74775 <secondary>to proxy</secondary>
74776 </indexterm>
74777 <indexterm role="concept">
74778 <primary>proxy</primary>
74779 <secondary>authentication</secondary>
74780 </indexterm>
74781 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
74782 Using <quote>name</quote> selects username/password authentication per RFC 1929
74783 for access to the proxy.
74784 Default is <quote>none</quote>.
74785 </para>
74786 </listitem>
74787 <listitem>
74788 <para>
74789 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
74790 Default is empty.
74791 </para>
74792 </listitem>
74793 <listitem>
74794 <para>
74795 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
74796 Default is empty.
74797 </para>
74798 </listitem>
74799 <listitem>
74800 <para>
74801 <option>port</option>: the TCP port number to use for the connection to the proxy.
74802 Default is 1080.
74803 </para>
74804 </listitem>
74805 <listitem>
74806 <para>
74807 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
74808 Default is 5.
74809 </para>
74810 </listitem>
74811 <listitem>
74812 <para>
74813 <option>pri</option>: specifies a priority for the proxy within the list,
74814 higher values being tried first.
74815 The default priority is 1.
74816 </para>
74817 </listitem>
74818 <listitem>
74819 <para>
74820 <option>weight</option>: specifies a selection bias.
74821 Within a priority set servers are queried in a random fashion,
74822 weighted by this value.
74823 The default value for selection bias is 1.
74824 </para>
74825 </listitem>
74826 </itemizedlist>
74827 <para>
74828 Proxies from the list are tried according to their priority
74829 and weight settings until one responds.  The timeout for the
74830 overall connection applies to the set of proxied attempts.
74831 </para>
74832 </section>
74833 <section id="SECTproxyLog">
74834 <title>Logging</title>
74835 <para>
74836 To log the (local) IP of a proxy in the incoming or delivery logline,
74837 add <quote>+proxy</quote> to the <option>log_selector</option> option.
74838 This will add a component tagged with <quote>PRX=</quote> to the line.
74839 </para>
74840 </section>
74841 </chapter>
74842
74843 <chapter id="CHAPi18n">
74844 <title>Internationalisation</title>
74845 <titleabbrev>Internationalisation"</titleabbrev>
74846 <para>
74847 <indexterm role="concept">
74848 <primary>internationalisation</primary>
74849 <secondary>email address</secondary>
74850 </indexterm>
74851 <indexterm role="concept">
74852 <primary>EAI</primary>
74853 </indexterm>
74854 <indexterm role="concept">
74855 <primary>i18n</primary>
74856 </indexterm>
74857 <indexterm role="concept">
74858 <primary>utf8</primary>
74859 <secondary>mail name handling</secondary>
74860 </indexterm>
74861 </para>
74862 <para>
74863 Exim has support for Internationalised mail names.
74864 To include this it must be built with SUPPORT_I18N and the libidn library.
74865 Standards supported are RFCs 2060, 5890, 6530 and 6533.
74866 </para>
74867 <para>
74868 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
74869 instead of it) then IDNA2008 is supported; this adds an extra library
74870 requirement, upon libidn2.
74871 </para>
74872 <section id="SECTi18nMTA">
74873 <title>MTA operations</title>
74874 <para>
74875 <indexterm role="concept">
74876 <primary>SMTPUTF8</primary>
74877 <secondary>ESMTP option</secondary>
74878 </indexterm>
74879 <indexterm role="concept">
74880 <primary>ESMTP extensions</primary>
74881 <secondary>SMTPUTF8</secondary>
74882 </indexterm>
74883 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
74884 a host list.  If this matches the sending host and
74885 accept_8bitmime is true (the default) then the ESMTP option
74886 SMTPUTF8 will be advertised.
74887 </para>
74888 <para>
74889 If the sender specifies the SMTPUTF8 option on a MAIL command
74890 international handling for the message is enabled and
74891 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
74892 </para>
74893 <para>
74894 The option <option>allow_utf8_domains</option> is set to true for this
74895 message. All DNS lookups are converted to a-label form
74896 whatever the setting of <option>allow_utf8_domains</option>
74897 when Exim is built with SUPPORT_I18N.
74898 </para>
74899 <para>
74900 Both localparts and domain are maintained as the original
74901 UTF-8 form internally; any comparison or regular-expression use will
74902 require appropriate care.  Filenames created, eg. by
74903 the appendfile transport, will have UTF-8 names.
74904 </para>
74905 <para>
74906 HELO names sent by the smtp transport will have any UTF-8
74907 components expanded to a-label form,
74908 and any certificate name checks will be done using the a-label
74909 form of the name.
74910 </para>
74911 <para>
74912 <indexterm role="concept">
74913 <primary>log</primary>
74914 <secondary>protocol</secondary>
74915 </indexterm>
74916 <indexterm role="concept">
74917 <primary>SMTPUTF8</primary>
74918 <secondary>logging</secondary>
74919 </indexterm>
74920 <indexterm role="concept">
74921 <primary>i18n</primary>
74922 <secondary>logging</secondary>
74923 </indexterm>
74924 Log lines and Received-by: header lines will acquire a "utf8"
74925 prefix on the protocol element, eg. utf8esmtp.
74926 </para>
74927 <para>
74928 The following expansion operators can be used:
74929 </para>
74930 <literallayout class="monospaced">
74931 ${utf8_domain_to_alabel:str}
74932 ${utf8_domain_from_alabel:str}
74933 ${utf8_localpart_to_alabel:str}
74934 ${utf8_localpart_from_alabel:str}
74935 </literallayout>
74936 <para>
74937 <indexterm role="concept">
74938 <primary>utf8</primary>
74939 <secondary>address downconversion</secondary>
74940 </indexterm>
74941 <indexterm role="concept">
74942 <primary>i18n</primary>
74943 <secondary>utf8 address downconversion</secondary>
74944 </indexterm>
74945 The RCPT ACL
74946 may use the following modifier:
74947 </para>
74948 <literallayout>
74949 control = utf8_downconvert
74950 control = utf8_downconvert/&lt;value&gt;
74951 </literallayout>
74952 <para>
74953 This sets a flag requiring that envelope addresses are converted to
74954 a-label form before smtp delivery.
74955 This is usually for use in a Message Submission Agent context,
74956 but could be used for any message.
74957 </para>
74958 <para>
74959 If a value is appended it may be:
74960 </para>
74961 <literallayout>
74962 <literal>1  </literal> mandatory downconversion
74963 <literal>0  </literal> no downconversion
74964 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
74965 </literallayout>
74966 <para>
74967 If no value is given, 1 is used.
74968 </para>
74969 <para>
74970 If mua_wrapper is set, the utf8_downconvert control
74971 is initially set to -1.
74972 </para>
74973 <para>
74974 The smtp transport has an option <option>utf8_downconvert</option>.
74975 If set it must expand to one of the three values described above,
74976 or an empty string.
74977 If non-empty it overrides value previously set
74978 (due to mua_wrapper or by an ACL control).
74979 </para>
74980 <para>
74981 There is no explicit support for VRFY and EXPN.
74982 Configurations supporting these should inspect
74983 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
74984 </para>
74985 <para>
74986 There is no support for LMTP on Unix sockets.
74987 Using the "lmtp" protocol option on an smtp transport,
74988 for LMTP over TCP, should work as expected.
74989 </para>
74990 <para>
74991 There is no support for DSN unitext handling,
74992 and no provision for converting logging from or to UTF-8.
74993 </para>
74994 </section>
74995 <section id="SECTi18nMDA">
74996 <title>MDA operations</title>
74997 <para>
74998 To aid in constructing names suitable for IMAP folders
74999 the following expansion operator can be used:
75000 </para>
75001 <literallayout class="monospaced">
75002 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
75003 </literallayout>
75004 <para>
75005 The string is converted from the charset specified by
75006 the "headers charset" command (in a filter file)
75007 or <option>headers_charset</option> main configuration option (otherwise),
75008 to the
75009 modified UTF-7 encoding specified by RFC 2060,
75010 with the following exception: All occurrences of &lt;sep&gt;
75011 (which has to be a single character)
75012 are replaced with periods ("."), and all periods and slashes that are not
75013 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
75014 </para>
75015 <para>
75016 The third argument can be omitted, defaulting to an empty string.
75017 The second argument can be omitted, defaulting to "/".
75018 </para>
75019 <para>
75020 This is the encoding used by Courier for Maildir names on disk, and followed
75021 by many other IMAP servers.
75022 </para>
75023 <para>
75024 Examples:
75025 </para>
75026 <literallayout>
75027 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
75028 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
75029 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
75030 </literallayout>
75031 <para>
75032 Note that the source charset setting is vital, and also that characters
75033 must be representable in UTF-16.
75034 </para>
75035 </section>
75036 </chapter>
75037
75038 <chapter id="CHAPevents">
75039 <title>Events</title>
75040 <titleabbrev>Events</titleabbrev>
75041 <para>
75042 <indexterm role="concept">
75043 <primary>events</primary>
75044 </indexterm>
75045 </para>
75046 <para>
75047 The events mechanism in Exim can be used to intercept processing at a number
75048 of points.  It was originally invented to give a way to do customised logging
75049 actions (for example, to a database) but can also be used to modify some
75050 processing actions.
75051 </para>
75052 <para>
75053 Most installations will never need to use Events.
75054 The support can be left out of a build by defining DISABLE_EVENT=yes
75055 in <filename>Local/Makefile</filename>.
75056 </para>
75057 <para>
75058 There are two major classes of events: main and transport.
75059 The main configuration option <option>event_action</option> controls reception events;
75060 a transport option <option>event_action</option> controls delivery events.
75061 </para>
75062 <para>
75063 Both options are a string which is expanded when the event fires.
75064 An example might look like:
75065 <indexterm role="concept">
75066 <primary>logging</primary>
75067 <secondary>custom</secondary>
75068 </indexterm>
75069 </para>
75070 <literallayout class="monospaced">
75071 event_action = ${if eq {msg:delivery}{$event_name} \
75072 {${lookup pgsql {SELECT * FROM record_Delivery( \
75073     '${quote_pgsql:$sender_address_domain}',\
75074     '${quote_pgsql:${lc:$sender_address_local_part}}', \
75075     '${quote_pgsql:$domain}', \
75076     '${quote_pgsql:${lc:$local_part}}', \
75077     '${quote_pgsql:$host_address}', \
75078     '${quote_pgsql:${lc:$host}}', \
75079     '${quote_pgsql:$message_exim_id}')}} \
75080 } {}}
75081 </literallayout>
75082 <para>
75083 Events have names which correspond to the point in process at which they fire.
75084 The name is placed in the variable <varname>$event_name</varname> and the event action
75085 expansion must check this, as it will be called for every possible event type.
75086 </para>
75087 <para revisionflag="changed">
75088 The current list of events is:
75089 </para>
75090 <literallayout>
75091 <literal>dane:fail              after    transport  </literal> per connection
75092 <literal>msg:complete           after    main       </literal> per message
75093 <literal>msg:defer              after    transport  </literal> per message per delivery try
75094 <literal>msg:delivery           after    transport  </literal> per recipient
75095 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
75096 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
75097 <literal>msg:host:defer         after    transport  </literal> per host per delivery try; host errors
75098 <literal>msg:fail:delivery      after    transport  </literal> per recipient
75099 <literal>msg:fail:internal      after    main       </literal> per recipient
75100 <literal>tcp:connect            before   transport  </literal> per connection
75101 <literal>tcp:close              after    transport  </literal> per connection
75102 <literal>tls:cert               before   both       </literal> per certificate in verification chain
75103 <literal>smtp:connect           after    transport  </literal> per connection
75104 <literal>smtp:ehlo              after    transport  </literal> per connection
75105 </literallayout>
75106 <para>
75107 New event types may be added in future.
75108 </para>
75109 <para>
75110 The event name is a colon-separated list, defining the type of
75111 event in a tree of possibilities.  It may be used as a list
75112 or just matched on as a whole.  There will be no spaces in the name.
75113 </para>
75114 <para>
75115 The second column in the table above describes whether the event fires
75116 before or after the action is associates with.  Those which fire before
75117 can be used to affect that action (more on this below).
75118 </para>
75119 <para>
75120 The third column in the table above says what section of the configuration
75121 should define the event action.
75122 </para>
75123 <para>
75124 An additional variable, <varname>$event_data</varname>, is filled with information varying
75125 with the event type:
75126 </para>
75127 <literallayout>
75128 <literal>dane:fail            </literal> failure reason
75129 <literal>msg:defer            </literal> error string
75130 <literal>msg:delivery         </literal> smtp confirmation message
75131 <literal>msg:fail:internal    </literal> failure reason
75132 <literal>msg:fail:delivery    </literal> smtp error message
75133 <literal>msg:host:defer       </literal> error string
75134 <literal>msg:rcpt:host:defer  </literal> error string
75135 <literal>msg:rcpt:defer       </literal> error string
75136 <literal>tls:cert             </literal> verification chain depth
75137 <literal>smtp:connect         </literal> smtp banner
75138 <literal>smtp:ehlo            </literal> smtp ehlo response
75139 </literallayout>
75140 <para>
75141 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
75142 </para>
75143 <para>
75144 For complex operations an ACL expansion can be used in <option>event_action</option>
75145 however due to the multiple contexts that Exim operates in during
75146 the course of its processing:
75147 </para>
75148 <itemizedlist>
75149 <listitem>
75150 <para>
75151 variables set in transport events will not be visible outside that
75152 transport call
75153 </para>
75154 </listitem>
75155 <listitem>
75156 <para>
75157 acl_m variables in a server context are lost on a new connection,
75158 and after smtp helo/ehlo/mail/starttls/rset commands
75159 </para>
75160 </listitem>
75161 </itemizedlist>
75162 <para>
75163 Using an ACL expansion with the logwrite modifier can be
75164 a useful way of writing to the main log.
75165 </para>
75166 <para>
75167 The expansion of the event_action option should normally
75168 return an empty string.  Should it return anything else the
75169 following will be forced:
75170 </para>
75171 <literallayout>
75172 <literal>tcp:connect      </literal>  do not connect
75173 <literal>tls:cert         </literal>  refuse verification
75174 <literal>smtp:connect     </literal>  close connection
75175 </literallayout>
75176 <para>
75177 All other message types ignore the result string, and
75178 no other use is made of it.
75179 </para>
75180 <para>
75181 For a tcp:connect event, if the connection is being made to a proxy
75182 then the address and port variables will be that of the proxy and not
75183 the target system.
75184 </para>
75185 <para>
75186 For tls:cert events, if GnuTLS is in use this will trigger only per
75187 chain element received on the connection.
75188 For OpenSSL it will trigger for every chain element including those
75189 loaded locally.
75190 </para>
75191 </chapter>
75192
75193 <chapter id="CHID13">
75194 <title>Adding new drivers or lookup types</title>
75195 <titleabbrev>Adding drivers or lookups</titleabbrev>
75196 <para>
75197 <indexterm role="concept">
75198 <primary>adding drivers</primary>
75199 </indexterm>
75200 <indexterm role="concept">
75201 <primary>new drivers, adding</primary>
75202 </indexterm>
75203 <indexterm role="concept">
75204 <primary>drivers</primary>
75205 <secondary>adding new</secondary>
75206 </indexterm>
75207 The following actions have to be taken in order to add a new router, transport,
75208 authenticator, or lookup type to Exim:
75209 </para>
75210 <orderedlist numeration="arabic">
75211 <listitem>
75212 <para>
75213 Choose a name for the driver or lookup type that does not conflict with any
75214 existing name; I will use <quote>newdriver</quote> in what follows.
75215 </para>
75216 </listitem>
75217 <listitem>
75218 <para>
75219 Add to <filename>src/EDITME</filename> the line:
75220 </para>
75221 <literallayout>
75222 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
75223 </literallayout>
75224 <para>
75225 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
75226 code is not to be included in the binary by default, comment this line out. You
75227 should also add any relevant comments about the driver or lookup type.
75228 </para>
75229 </listitem>
75230 <listitem>
75231 <para>
75232 Add to <filename>src/config.h.defaults</filename> the line:
75233 </para>
75234 <literallayout class="monospaced">
75235 #define &lt;type&gt;_NEWDRIVER
75236 </literallayout>
75237 </listitem>
75238 <listitem>
75239 <para>
75240 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
75241 and create a table entry as is done for all the other drivers and lookup types.
75242 </para>
75243 </listitem>
75244 <listitem>
75245 <para>
75246 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
75247 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
75248 Add your <literal>NEWDRIVER</literal> to that list.
75249 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
75250 simple form that most lookups have.
75251 </para>
75252 </listitem>
75253 <listitem>
75254 <para>
75255 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
75256 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
75257 driver or lookup type and add it to the definition of OBJ.
75258 </para>
75259 </listitem>
75260 <listitem>
75261 <para>
75262 Edit <filename>OS/Makefile-Base</filename> adding a <filename>.o</filename> file for the predefined-macros, to the
75263 definition of OBJ_MACRO.  Add a set of line to do the compile also.
75264 </para>
75265 </listitem>
75266 <listitem>
75267 <para>
75268 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
75269 <filename>src</filename>.
75270 </para>
75271 </listitem>
75272 <listitem>
75273 <para>
75274 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
75275 as for other drivers and lookups.
75276 </para>
75277 </listitem>
75278 </orderedlist>
75279 <para>
75280 Then all you need to do is write the code! A good way to start is to make a
75281 proforma by copying an existing module of the same type, globally changing all
75282 occurrences of the name, and cutting out most of the code. Note that any
75283 options you create must be listed in alphabetical order, because the tables are
75284 searched using a binary chop procedure.
75285 </para>
75286 <para>
75287 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
75288 the interface that is expected.
75289 </para>
75290 <?sdop
75291   format="newpage"
75292   foot_right_recto="&chaptertitle;"
75293   foot_right_verso="&chaptertitle;"
75294 ?>
75295 </chapter>
75296
75297 <index role="option">
75298 <title>Options index</title>
75299 </index>
75300
75301 <index role="variable">
75302 <title>Variables index</title>
75303 </index>
75304
75305 <index role="concept">
75306 <title>Concept index</title>
75307 </index>
75308
75309 </book>